diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-01-15 20:13:04 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-01-15 20:13:04 +0000 |
commit | fe1379d45a55a99399806c755cf8533b7c22be67 (patch) | |
tree | c3abbeee90fe776a377913f7c0bc63752c29dcad /ld | |
parent | 21a3c2ff37b7814667f52cd15de2fdef3d8c9d12 (diff) | |
download | gdb-fe1379d45a55a99399806c755cf8533b7c22be67.zip gdb-fe1379d45a55a99399806c755cf8533b7c22be67.tar.gz gdb-fe1379d45a55a99399806c755cf8533b7c22be67.tar.bz2 |
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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 19 | ||||
-rw-r--r-- | ld/Makefile.in | 4 | ||||
-rw-r--r-- | ld/emulparams/elf32bmip.sh | 27 | ||||
-rw-r--r-- | ld/emulparams/elf32lmip.sh | 27 | ||||
-rw-r--r-- | ld/scripttempl/.Sanitize | 1 | ||||
-rw-r--r-- | ld/scripttempl/elfmips.sc | 167 |
6 files changed, 243 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 3613f5f..ee31948 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -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 diff --git a/ld/Makefile.in b/ld/Makefile.in index 62e7032..37b675c 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -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} diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh new file mode 100644 index 0000000..0136740 --- /dev/null +++ b/ld/emulparams/elf32bmip.sh @@ -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 diff --git a/ld/emulparams/elf32lmip.sh b/ld/emulparams/elf32lmip.sh new file mode 100644 index 0000000..1d060dd --- /dev/null +++ b/ld/emulparams/elf32lmip.sh @@ -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 diff --git a/ld/scripttempl/.Sanitize b/ld/scripttempl/.Sanitize index 1ec22ae..8021484 100644 --- a/ld/scripttempl/.Sanitize +++ b/ld/scripttempl/.Sanitize @@ -41,6 +41,7 @@ aout.sc delta68.sc ebmon29k.sc elf.sc +elfmips.sc elfppc.sc go32coff.sc h8300.sc diff --git a/ld/scripttempl/elfmips.sc b/ld/scripttempl/elfmips.sc new file mode 100644 index 0000000..43c94c7 --- /dev/null +++ b/ld/scripttempl/elfmips.sc @@ -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 |