From 904ecb2d787a2b9e501232d4e3852dc9659fca77 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 10 Sep 1999 06:30:37 +0000 Subject: [PATCH] * emulparms/elf64hppa.sh (OTHER_READONLY_SECTIONS): Put stubs before unwinders so that they are closer to the text section. (OTHER_BSS_SECTIONS): Define. (EXECUTABLE_SYMBOLS): Provide __SYSTEM_ID and _FPU_STATUS. (INIT_START, INIT_END): Define. (FINI_START, FINI_END): Define. * scripttempl/elf.sc: Add support for INIT_START, INIT_END, FINI_START, FINI_END and OTHER_BSS_SECTIONS. --- ld/ChangeLog | 11 +++++++++++ ld/emulparams/elf64hppa.sh | 23 ++++++++++++++++++++++- ld/scripttempl/elf.sc | 21 +++++++++++++++++++-- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 205bac54161..4e1b3afc5f0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +Fri Sep 10 00:22:50 1999 Jeffrey A Law (law@cygnus.com) + + * emulparms/elf64hppa.sh (OTHER_READONLY_SECTIONS): Put stubs before + unwinders so that they are closer to the text section. + (OTHER_BSS_SECTIONS): Define. + (EXECUTABLE_SYMBOLS): Provide __SYSTEM_ID and _FPU_STATUS. + (INIT_START, INIT_END): Define. + (FINI_START, FINI_END): Define. + * scripttempl/elf.sc: Add support for INIT_START, INIT_END, + FINI_START, FINI_END and OTHER_BSS_SECTIONS. + Thu Sep 9 21:43:58 1999 Jeffrey A Law (law@cygnus.com) * emulparms/elf64hppa.sh (TEXT_START_ADDR): Move up one page. diff --git a/ld/emulparams/elf64hppa.sh b/ld/emulparams/elf64hppa.sh index 8356fc3e889..06bbfc23dc4 100755 --- a/ld/emulparams/elf64hppa.sh +++ b/ld/emulparams/elf64hppa.sh @@ -10,6 +10,27 @@ MACHINE=hppa2.0w ENTRY="main" TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes -OTHER_READONLY_SECTIONS='.stubs : { *(.stubs) } .PARISC.unwind : { *(.PARISC.unwind) }' +# We really want multiple .stub sections, one for each input .text section, +# but for now this is good enough. +OTHER_READONLY_SECTIONS='.PARISC.unwind : { *(.PARISC.unwind) } .stubs : { *(.stubs) }' + +# The PA64 ELF port treats .plt sections differently than most. We also have +# to create a .opd section. Combine the .opd, .plt and .dlt together into a +# single .dlt section in the output file. OTHER_READWRITE_SECTIONS='.dlt : { *(.opd) *(.plt) *(.dlt) }' + +# The PA64 ELF port has two additional bss sections. huge bss and thread bss. +# Make sure they end up in the appropriate location. We also have to set +# __TLS_SIZE to the size of the thread bss section. +OTHER_BSS_SECTIONS='.hbss : { *(.hbss) } .tbss : { *(.tbss) } __TLS_SIZE = SIZEOF(.tbss);' + +# The linker is required to define these two symbols. +EXECUTABLE_SYMBOLS='__SYSTEM_ID = 0x214; _FPU_STATUS = 0x0;' DATA_PLT= + +# The PA64 ELF port needs two additional initializer sections and also wants +# a start/end symbol pair for the .init and .fini sections. +INIT_START='KEEP (*(.HP.init)); __preinit_start = .; KEEP (*(.preinit)); __preinit_end = .;__init_start = .;' +INIT_END='__init_end = .;' +FINI_START='__fini_start = .;' +FINI_END='__fini_end = .;' diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 3ffd3e17fa8..57f60a928ca 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -8,6 +8,7 @@ # OTHER_TEXT_SECTIONS - these get put in .text when relocating # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... # (e.g., .PARISC.global) +# OTHER_BSS_SECTIONS - other than .bss .sbss ... # OTHER_SECTIONS - at the end # EXECUTABLE_SYMBOLS - symbols that must be defined for an # executable (e.g., _DYNAMIC_LINK) @@ -26,6 +27,10 @@ # start address of shared library. # INPUT_FILES - INPUT command of files to always include # WRITABLE_RODATA - if set, the .rodata section should be writable +# INIT_START, INIT_END - statements just before and just after +# combination of .init sections. +# FINI_START, FINI_END - statements just before and just after +# combination of .fini sections. # # When adding sections, do note that the names of some sections are used # when specifying the start address of the next. @@ -169,7 +174,13 @@ SECTIONS .rel.plt ${RELOCATING-0} : { *(.rel.plt) } .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - .init ${RELOCATING-0} : { KEEP (*(.init)) } =${NOP-0} + .init ${RELOCATING-0} : + { + ${INIT_START} + KEEP (*(.init)) + ${INIT_END} + } =${NOP-0} + ${DATA_PLT-${PLT}} .text ${RELOCATING-0} : { @@ -184,7 +195,12 @@ SECTIONS } =${NOP-0} ${RELOCATING+_etext = .;} ${RELOCATING+PROVIDE (etext = .);} - .fini ${RELOCATING-0} : { KEEP (*(.fini)) } =${NOP-0} + .fini ${RELOCATING-0} : + { + ${FINI_START} + KEEP (*(.fini)) + ${FINI_END} + } =${NOP-0} ${WRITABLE_RODATA-${RODATA}} .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+${OTHER_READONLY_SECTIONS}} @@ -233,6 +249,7 @@ SECTIONS .bss section disappears because there are no input sections. */ ${RELOCATING+. = ALIGN(${ALIGNMENT});} } + ${RELOCATING+${OTHER_BSS_SECTIONS}} ${RELOCATING+. = ALIGN(${ALIGNMENT});} ${RELOCATING+_end = .;} ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} -- 2.30.2