Add some Irix 5 support, mostly from Kazumoto Kojima

<kkojima@info.kanagawa-u.ac.jp>:
	* emulparams/elf32bmip.sh (SCRIPT_NAME): Change to elfmips.
	(SHLIB_TEXT_START_ADDR): Define.
	(OTHER_GOT_SYMBOLS): Define.
	(OTHER_READWRITE_SECTIONS): Remove initialization of _gp.
	(EXECUTABLE_SYMBOLS): Don't define.
	(DYNAMIC_LINK): Don't define.
	* emulparams/elf32lmip.sh: Same changes as elf32bmip.sh.
	* scripttempl/elfmips.sc: New file.
	* configure.host (mips*-dec-bsd*): Change mips to mips*.
	(mips*-sgi-irix4*): Likewise.
	(mips*-sgi-irix5*): New entry.
	* Makefile.in (eelf32bmip.c): Depend upon elfmips.sc rather than
	elf.sc.
	(eelf32lmip.c): Likewise.
This commit is contained in:
Ian Lance Taylor 1996-01-15 20:13:04 +00:00
parent 21a3c2ff37
commit fe1379d45a
6 changed files with 243 additions and 2 deletions

View file

@ -1,3 +1,22 @@
Mon Jan 15 15:07:19 1996 Ian Lance Taylor <ian@cygnus.com>
Add some Irix 5 support, mostly from Kazumoto Kojima
<kkojima@info.kanagawa-u.ac.jp>:
* emulparams/elf32bmip.sh (SCRIPT_NAME): Change to elfmips.
(SHLIB_TEXT_START_ADDR): Define.
(OTHER_GOT_SYMBOLS): Define.
(OTHER_READWRITE_SECTIONS): Remove initialization of _gp.
(EXECUTABLE_SYMBOLS): Don't define.
(DYNAMIC_LINK): Don't define.
* emulparams/elf32lmip.sh: Same changes as elf32bmip.sh.
* scripttempl/elfmips.sc: New file.
* configure.host (mips*-dec-bsd*): Change mips to mips*.
(mips*-sgi-irix4*): Likewise.
(mips*-sgi-irix5*): New entry.
* Makefile.in (eelf32bmip.c): Depend upon elfmips.sc rather than
elf.sc.
(eelf32lmip.c): Likewise.
Sat Jan 13 09:41:43 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* scripttempl/elfppc.sc: Remove support for .rel.* sections. Add

View file

@ -410,10 +410,10 @@ eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386
eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32bmip
eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32lmip
eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

View file

@ -0,0 +1,27 @@
SCRIPT_NAME=elfmips
OUTPUT_FORMAT="elf32-bigmips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
TEXT_START_ADDR=0x0400000
DATA_ADDR=0x10000000
MAXPAGESIZE=0x40000
NONPAGED_TEXT_START_ADDR=0x0400000
SHLIB_TEXT_START_ADDR=0x5ffe0000
OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
OTHER_GOT_SYMBOLS='
_gp = . + 0x7ff0;
'
OTHER_READWRITE_SECTIONS='
.lit8 : { *(.lit8) }
.lit4 : { *(.lit4) }
'
TEXT_START_SYMBOLS='_ftext = . ;'
DATA_START_SYMBOLS='_fdata = . ;'
OTHER_BSS_SYMBOLS='_fbss = .;'
OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
ARCH=mips
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes

View file

@ -0,0 +1,27 @@
SCRIPT_NAME=elfmips
OUTPUT_FORMAT="elf32-littlemips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
TEXT_START_ADDR=0x0400000
DATA_ADDR=0x10000000
MAXPAGESIZE=0x40000
NONPAGED_TEXT_START_ADDR=0x0400000
SHLIB_TEXT_START_ADDR=0x5ffe0000
OTHER_READONLY_SECTIONS='.reginfo : { *(.reginfo) }'
OTHER_GOT_SYMBOLS='
_gp = . + 0x7ff0;
'
OTHER_READWRITE_SECTIONS='
.lit8 : { *(.lit8) }
.lit4 : { *(.lit4) }
'
TEXT_START_SYMBOLS='_ftext = . ;'
DATA_START_SYMBOLS='_fdata = . ;'
OTHER_BSS_SYMBOLS='_fbss = .;'
OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
ARCH=mips
TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes

View file

@ -41,6 +41,7 @@ aout.sc
delta68.sc
ebmon29k.sc
elf.sc
elfmips.sc
elfppc.sc
go32coff.sc
h8300.sc

167
ld/scripttempl/elfmips.sc Normal file
View file

@ -0,0 +1,167 @@
#
# Unusual variables checked by this code:
# NOP - two byte opcode for no-op (defaults to 0)
# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
# (e.g., .PARISC.milli)
# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
# (e.g., .PARISC.global)
# OTHER_SECTIONS - at the end
# EXECUTABLE_SYMBOLS - symbols that must be defined for an
# executable (e.g., _DYNAMIC_LINK)
# TEXT_START_SYMBOLS - symbols that appear at the start of the
# .text section.
# DATA_START_SYMBOLS - symbols that appear at the start of the
# .data section.
# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
# .bss section besides __bss_start.
#
# When adding sections, do note that the names of some sections are used
# when specifying the start address of the next.
#
# We use a start address of __start for Irix 5, _start for other
# targets. This is for compatibility with Irix 5, and with old MIPS
# ELF toolchains.
if [ -z "$ENTRY" ]; then
case "${target_alias}" in
mips*-*-irix5*) ENTRY=__start ;;
*) ENTRY=_start ;;
esac
fi
test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
test "$LD_FLAG" = "N" && DATA_ADDR=.
INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
ENTRY(${ENTRY})
${RELOCATING+${LIB_SEARCH_DIRS}}
${RELOCATING+/* Do we need any of these for elf?
__DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
${RELOCATING+${EXECUTABLE_SYMBOLS}}
${RELOCATING- /* For some reason, the Solaris linker makes bad executables
if gld -r is used and the intermediate file has sections starting
at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
bug. But for now assigning the zero vmas works. */}
SECTIONS
{
/* Read-only sections, merged into text segment: */
${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR} + SIZEOF_HEADERS;}}
${CREATE_SHLIB-${INTERP}}
.reginfo ${RELOCATING-0} : { *(.reginfo) }
.dynamic ${RELOCATING-0} : { *(.dynamic) }
.dynstr ${RELOCATING-0} : { *(.dynstr) }
.dynsym ${RELOCATING-0} : { *(.dynsym) }
.hash ${RELOCATING-0} : { *(.hash) }
.rel.text ${RELOCATING-0} : { *(.rel.text) }
.rela.text ${RELOCATING-0} : { *(.rela.text) }
.rel.data ${RELOCATING-0} : { *(.rel.data) }
.rela.data ${RELOCATING-0} : { *(.rela.data) }
.rel.rodata ${RELOCATING-0} : { *(.rel.rodata) }
.rela.rodata ${RELOCATING-0} : { *(.rela.rodata) }
.rel.got ${RELOCATING-0} : { *(.rel.got) }
.rela.got ${RELOCATING-0} : { *(.rela.got) }
.rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
.rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
.rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
.rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
.rel.init ${RELOCATING-0} : { *(.rel.init) }
.rela.init ${RELOCATING-0} : { *(.rela.init) }
.rel.fini ${RELOCATING-0} : { *(.rel.fini) }
.rela.fini ${RELOCATING-0} : { *(.rela.fini) }
.rel.bss ${RELOCATING-0} : { *(.rel.bss) }
.rela.bss ${RELOCATING-0} : { *(.rela.bss) }
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
.rodata ${RELOCATING-0} : { *(.rodata) }
.rodata1 ${RELOCATING-0} : { *(.rodata1) }
.init ${RELOCATING-0} : { *(.init) } =${NOP-0}
.text ${RELOCATING-0} :
{
${CREATE_SHLIB-${RELOCATING+${TEXT_START_SYMBOLS}}}
*(.text)
*(.stub)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =${NOP-0}
${CREATE_SHLIB-${RELOCATING+_etext = .;}}
${CREATE_SHLIB-${RELOCATING+PROVIDE (etext = .);}}
.fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. It would
be more correct to do this:
${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE})
+ ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE}))
& (${MAXPAGESIZE} - 1)};}
The current expression does not correctly handle the case of a
text segment ending precisely at the end of a page; it causes the
data segment to skip a page. The above expression does not have
this problem, but it will currently (2/95) cause BFD to allocate
a single segment, combining both text and data, for this case.
This will prevent the text segment from being shared among
multiple executions of the program; I think that is more
important than losing a page of the virtual address space (note
that no actual memory is lost; the page which is skipped can not
be referenced). */
${CREATE_SHLIB-${RELOCATING+. += ${DATA_ADDR} - ${TEXT_START_ADDR};}}
${CREATE_SHLIB+${RELOCATING+. += 0x10000;}}
.data ${RELOCATING-0} :
{
${CREATE_SHLIB-${RELOCATING+${DATA_START_SYMBOLS}}}
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
}
.data1 ${RELOCATING-0} : { *(.data1) }
.ctors ${RELOCATING-0} : { *(.ctors) }
.dtors ${RELOCATING-0} : { *(.dtors) }
${RELOCATING+${OTHER_GOT_SYMBOLS}}
.got ${RELOCATING-0} :
{
*(.got.plt) *(.got)
}
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata ${RELOCATING-0} : { *(.sdata) }
${RELOCATING+${OTHER_READWRITE_SECTIONS}}
${CREATE_SHLIB-${RELOCATING+_edata = .;}}
${CREATE_SHLIB-${RELOCATING+PROVIDE (edata = .);}}
${CREATE_SHLIB-${RELOCATING+__bss_start = .;}}
${CREATE_SHLIB-${RELOCATING+${OTHER_BSS_SYMBOLS}}}
.sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
.bss ${RELOCATING-0} :
{
*(.dynbss)
*(.bss)
*(COMMON)
}
${CREATE_SHLIB-${RELOCATING+_end = . ;}}
${CREATE_SHLIB-${RELOCATING+PROVIDE (end = .);}}
/* These are needed for ELF backends which have not yet been
converted to the new style linker. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
/* DWARF debug sections.
Symbols in the .debug DWARF section are relative to the beginning of the
section so we begin .debug at 0. It's not clear yet what needs to happen
for the others. */
.debug 0 : { *(.debug) }
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_sfnames 0 : { *(.debug_sfnames) }
.line 0 : { *(.line) }
/* These must appear regardless of ${RELOCATING}. */
${OTHER_SECTIONS}
}
EOF