diff options
author | Alan Modra <amodra@gmail.com> | 2008-10-22 05:20:44 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2008-10-22 05:20:44 +0000 |
commit | 485cf679681e0218e710df1df17a9158c1445e47 (patch) | |
tree | 41b2cc090512ff188afec8a921b2d32a97d9659b /ld | |
parent | 11d5096372dd488db0b6c1211f59b789de8889e9 (diff) | |
download | gdb-485cf679681e0218e710df1df17a9158c1445e47.zip gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.gz gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.bz2 |
* scripttempl/elf.sc (NO_REL_RELOCS, NO_RELA_RELOCS, NON_ALLOC_DYN):
Handle these defines.
* emulparams/criself.sh, * emulparams/crislinux.sh,
* emulparams/elf32am33lin.sh, * emulparams/elf32fr30.sh,
* emulparams/elf32_i860.sh, * emulparams/elf32ip2k.sh,
* emulparams/elf32mcore.sh, * emulparams/elf32ppccommon.sh,
* emulparams/elf32ppcwindiss.sh, * emulparams/elf32_sparc.sh,
* emulparams/elf32_spu.sh, * emulparams/elf32vax.sh,
* emulparams/elf64alpha.sh, * emulparams/elf64mmix.sh,
* emulparams/elf64ppc.sh, * emulparams/elf64_s390.sh,
* emulparams/elf64_sparc.sh, * emulparams/elf_s390.sh,
* emulparams/elf_x86_64.sh, * emulparams/h8300elf.sh,
* emulparams/hppa64linux.sh, * emulparams/hppalinux.sh,
* emulparams/m68kelf.sh, * emulparams/mn10200.sh,
* emulparams/pjelf.sh, * emulparams/ppclynx.sh,
* emulparams/shelf32.sh, * emulparams/shelf_nto.sh,
* emulparams/shelf.sh, * emulparams/shelf_vxworks.sh,
* emulparams/shlelf32_linux.sh, * emulparams/shlelf_linux.sh,
* emulparams/shlelf_nto.sh (NO_REL_RELOCS): Set.
* emulparams/arcelf.sh, * emulparams/elf32_i960.sh,
* emulparams/elf32openrisc.sh, * emulparams/elf_i386_be.sh,
* emulparams/elf_i386_ldso.sh, * emulparams/elf_i386.sh,
* emulparams/elf_i386_vxworks.sh, * emulparams/i386lynx.sh,
* emulparams/i386moss.sh, * emulparams/i386nto.sh,
* emulparams/or32elf.sh, * emulparams/scoreelf.sh (NO_RELA_RELOCS): Set.
Diffstat (limited to 'ld')
47 files changed, 123 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 7677999..8e8cfa1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,33 @@ 2008-10-22 Alan Modra <amodra@bigpond.net.au> + * scripttempl/elf.sc (NO_REL_RELOCS, NO_RELA_RELOCS, NON_ALLOC_DYN): + Handle these defines. + * emulparams/criself.sh, * emulparams/crislinux.sh, + * emulparams/elf32am33lin.sh, * emulparams/elf32fr30.sh, + * emulparams/elf32_i860.sh, * emulparams/elf32ip2k.sh, + * emulparams/elf32mcore.sh, * emulparams/elf32ppccommon.sh, + * emulparams/elf32ppcwindiss.sh, * emulparams/elf32_sparc.sh, + * emulparams/elf32_spu.sh, * emulparams/elf32vax.sh, + * emulparams/elf64alpha.sh, * emulparams/elf64mmix.sh, + * emulparams/elf64ppc.sh, * emulparams/elf64_s390.sh, + * emulparams/elf64_sparc.sh, * emulparams/elf_s390.sh, + * emulparams/elf_x86_64.sh, * emulparams/h8300elf.sh, + * emulparams/hppa64linux.sh, * emulparams/hppalinux.sh, + * emulparams/m68kelf.sh, * emulparams/mn10200.sh, + * emulparams/pjelf.sh, * emulparams/ppclynx.sh, + * emulparams/shelf32.sh, * emulparams/shelf_nto.sh, + * emulparams/shelf.sh, * emulparams/shelf_vxworks.sh, + * emulparams/shlelf32_linux.sh, * emulparams/shlelf_linux.sh, + * emulparams/shlelf_nto.sh (NO_REL_RELOCS): Set. + * emulparams/arcelf.sh, * emulparams/elf32_i960.sh, + * emulparams/elf32openrisc.sh, * emulparams/elf_i386_be.sh, + * emulparams/elf_i386_ldso.sh, * emulparams/elf_i386.sh, + * emulparams/elf_i386_vxworks.sh, * emulparams/i386lynx.sh, + * emulparams/i386moss.sh, * emulparams/i386nto.sh, + * emulparams/or32elf.sh, * emulparams/scoreelf.sh (NO_RELA_RELOCS): Set. + +2008-10-22 Alan Modra <amodra@bigpond.net.au> + * ldlang.c (lang_output_section_find_by_flags): Handle non-alloc sections. * emultempl/elf32.em (enum orphan_save_index): Add orphan_nonalloc. diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh index 31db4a9..cd334d6 100644 --- a/ld/emulparams/arcelf.sh +++ b/ld/emulparams/arcelf.sh @@ -4,6 +4,7 @@ EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-littlearc" LITTLE_OUTPUT_FORMAT="elf32-littlearc" BIG_OUTPUT_FORMAT="elf32-bigarc" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x0 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=arc diff --git a/ld/emulparams/criself.sh b/ld/emulparams/criself.sh index 1d374ae..f709a1b 100644 --- a/ld/emulparams/criself.sh +++ b/ld/emulparams/criself.sh @@ -5,6 +5,7 @@ TEMPLATE_NAME=elf32 # Symbols have underscore prepended. OUTPUT_FORMAT="elf32-us-cris" +NO_REL_RELOCS=yes ARCH=cris MAXPAGESIZE=32 ENTRY=__start diff --git a/ld/emulparams/crislinux.sh b/ld/emulparams/crislinux.sh index e41024c..8a1a5b8 100644 --- a/ld/emulparams/crislinux.sh +++ b/ld/emulparams/crislinux.sh @@ -2,6 +2,7 @@ MACHINE= SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-cris" +NO_REL_RELOCS=yes ARCH=cris TEMPLATE_NAME=elf32 diff --git a/ld/emulparams/elf32_i860.sh b/ld/emulparams/elf32_i860.sh index 589067f..482e3d1 100644 --- a/ld/emulparams/elf32_i860.sh +++ b/ld/emulparams/elf32_i860.sh @@ -5,6 +5,7 @@ EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-i860-little" BIG_OUTPUT_FORMAT="elf32-i860" LITTLE_OUTPUT_FORMAT="elf32-i860-little" +NO_REL_RELOCS=yes TEXT_START_ADDR=0 PAGE_SIZE=0x1000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/elf32_i960.sh b/ld/emulparams/elf32_i960.sh index 1ef7292..56d91d7 100644 --- a/ld/emulparams/elf32_i960.sh +++ b/ld/emulparams/elf32_i960.sh @@ -1,6 +1,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=elf32 OUTPUT_FORMAT="elf32-i960" +NO_RELA_RELOCS=yes ARCH=i960 MACHINE= TEXT_START_ADDR=0 diff --git a/ld/emulparams/elf32_sparc.sh b/ld/emulparams/elf32_sparc.sh index 3db6d88..aef813e 100644 --- a/ld/emulparams/elf32_sparc.sh +++ b/ld/emulparams/elf32_sparc.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sparc" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh index 8248d5d..1ed58c3 100644 --- a/ld/emulparams/elf32_spu.sh +++ b/ld/emulparams/elf32_spu.sh @@ -2,6 +2,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=elf32 EXTRA_EM_FILE=spuelf OUTPUT_FORMAT="elf32-spu" +NO_REL_RELOCS=yes ARCH=spu MACHINE= ALIGNMENT=16 diff --git a/ld/emulparams/elf32am33lin.sh b/ld/emulparams/elf32am33lin.sh index 2f8b962..b34d2b8 100644 --- a/ld/emulparams/elf32am33lin.sh +++ b/ld/emulparams/elf32am33lin.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-am33lin" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x8000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=mn10300 diff --git a/ld/emulparams/elf32fr30.sh b/ld/emulparams/elf32fr30.sh index d078155..1764a32 100755 --- a/ld/emulparams/elf32fr30.sh +++ b/ld/emulparams/elf32fr30.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=generic EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-fr30" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 ARCH=fr30 MAXPAGESIZE=256 diff --git a/ld/emulparams/elf32ip2k.sh b/ld/emulparams/elf32ip2k.sh index 17fb7ab..0db227f 100644 --- a/ld/emulparams/elf32ip2k.sh +++ b/ld/emulparams/elf32ip2k.sh @@ -2,6 +2,7 @@ TEMPLATE_NAME=elf32 MACHINE= SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-ip2k" +NO_REL_RELOCS=yes # See also `include/elf/ip2k.h' DATA_ADDR=0x01000100 TEXT_START_ADDR=0x02010000 diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh index 31d65dc..6047950 100644 --- a/ld/emulparams/elf32mcore.sh +++ b/ld/emulparams/elf32mcore.sh @@ -2,6 +2,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-mcore-little" BIG_OUTPUT_FORMAT="elf32-mcore-big" LITTLE_OUTPUT_FORMAT="elf32-mcore-little" +NO_REL_RELOCS=yes PAGE_SIZE=0x1000 TARGET_PAGE_SIZE=0x400 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/elf32openrisc.sh b/ld/emulparams/elf32openrisc.sh index 53e88dd..bbe9a3e 100755 --- a/ld/emulparams/elf32openrisc.sh +++ b/ld/emulparams/elf32openrisc.sh @@ -1,6 +1,7 @@ MACHINE= SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-openrisc" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x10000 ARCH=openrisc MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh index 1a12890..15cb3b1 100644 --- a/ld/emulparams/elf32ppccommon.sh +++ b/ld/emulparams/elf32ppccommon.sh @@ -5,6 +5,7 @@ GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-powerpc" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x01800000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf32ppcwindiss.sh b/ld/emulparams/elf32ppcwindiss.sh index d217de9..b40d782 100644 --- a/ld/emulparams/elf32ppcwindiss.sh +++ b/ld/emulparams/elf32ppcwindiss.sh @@ -1,6 +1,7 @@ TEMPLATE_NAME=elf32 SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-powerpc" +NO_REL_RELOCS=yes ARCH=powerpc MACHINE= EMBEDDED=yes diff --git a/ld/emulparams/elf32vax.sh b/ld/emulparams/elf32vax.sh index 4c6ef39..9ddc754 100644 --- a/ld/emulparams/elf32vax.sh +++ b/ld/emulparams/elf32vax.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-vax" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 case ${LD_FLAG} in n|N) TEXT_START_ADDR=0x1000 ;; diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh index ede836c..ae8f26e 100644 --- a/ld/emulparams/elf64_s390.sh +++ b/ld/emulparams/elf64_s390.sh @@ -1,6 +1,7 @@ SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-s390" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x80000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf64_sparc.sh b/ld/emulparams/elf64_sparc.sh index 03cab9e..9397b87 100644 --- a/ld/emulparams/elf64_sparc.sh +++ b/ld/emulparams/elf64_sparc.sh @@ -2,6 +2,7 @@ SCRIPT_NAME=elf ELFSIZE=64 TEMPLATE_NAME=elf32 OUTPUT_FORMAT="elf64-sparc" +NO_REL_RELOCS=yes MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" ARCH="sparc:v9" diff --git a/ld/emulparams/elf64alpha.sh b/ld/emulparams/elf64alpha.sh index a42e75d..82f505d 100644 --- a/ld/emulparams/elf64alpha.sh +++ b/ld/emulparams/elf64alpha.sh @@ -4,6 +4,7 @@ ELFSIZE=64 TEMPLATE_NAME=elf32 EXTRA_EM_FILE=alphaelf OUTPUT_FORMAT="elf64-alpha" +NO_REL_RELOCS=yes TEXT_START_ADDR="0x120000000" MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf64mmix.sh b/ld/emulparams/elf64mmix.sh index 7f867fb..787b50d 100644 --- a/ld/emulparams/elf64mmix.sh +++ b/ld/emulparams/elf64mmix.sh @@ -3,6 +3,7 @@ GENERATE_SHLIB_SCRIPT=yes ELFSIZE=64 SCRIPT_NAME=elf OUTPUT_FORMAT="elf64-mmix" +NO_REL_RELOCS=yes ENTRY=_start. # Default to 0 as mmixal does. diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh index 8b0c587..b9631b6 100644 --- a/ld/emulparams/elf64ppc.sh +++ b/ld/emulparams/elf64ppc.sh @@ -5,6 +5,7 @@ GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes SCRIPT_NAME=elf OUTPUT_FORMAT="elf64-powerpc" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000000 #SEGMENT_SIZE=0x10000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh index 908515a..05d31a8 100644 --- a/ld/emulparams/elf_i386.sh +++ b/ld/emulparams/elf_i386.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x08048000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh index b61738c..efe1a86 100644 --- a/ld/emulparams/elf_i386_be.sh +++ b/ld/emulparams/elf_i386_be.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x80000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=i386 diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh index b4ac960..4b0d3fb 100644 --- a/ld/emulparams/elf_i386_ldso.sh +++ b/ld/emulparams/elf_i386_ldso.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x08048000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=i386 diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh index 90a98b3..6933128 100644 --- a/ld/emulparams/elf_i386_vxworks.sh +++ b/ld/emulparams/elf_i386_vxworks.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386-vxworks" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x08048000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf_s390.sh b/ld/emulparams/elf_s390.sh index e252e8e..218558b 100644 --- a/ld/emulparams/elf_s390.sh +++ b/ld/emulparams/elf_s390.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-s390" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x00400000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh index cdd4119..4b24710 100644 --- a/ld/emulparams/elf_x86_64.sh +++ b/ld/emulparams/elf_x86_64.sh @@ -1,6 +1,7 @@ SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-x86-64" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x400000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/h8300elf.sh b/ld/emulparams/h8300elf.sh index fb4db40..38b8a36 100644 --- a/ld/emulparams/h8300elf.sh +++ b/ld/emulparams/h8300elf.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-h8300" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x100 MAXPAGESIZE=2 TARGET_PAGE_SIZE=128 diff --git a/ld/emulparams/hppa64linux.sh b/ld/emulparams/hppa64linux.sh index 1af8e37..92939bf 100644 --- a/ld/emulparams/hppa64linux.sh +++ b/ld/emulparams/hppa64linux.sh @@ -5,6 +5,7 @@ SCRIPT_NAME=elf ELFSIZE=64 # FIXME: this output format is for hpux. OUTPUT_FORMAT="elf64-hppa-linux" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 TARGET_PAGE_SIZE=0x10000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/hppalinux.sh b/ld/emulparams/hppalinux.sh index 4c4f943..9fa4615 100644 --- a/ld/emulparams/hppalinux.sh +++ b/ld/emulparams/hppalinux.sh @@ -4,6 +4,7 @@ SCRIPT_NAME=elf ELFSIZE=32 OUTPUT_FORMAT="elf32-hppa-linux" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x10000 TARGET_PAGE_SIZE=0x10000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/i386lynx.sh b/ld/emulparams/i386lynx.sh index 6d9d9fe..93afb3d 100644 --- a/ld/emulparams/i386lynx.sh +++ b/ld/emulparams/i386lynx.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes ENTRY=_main TEXT_BASE=0x0 DYN_TEXT_BASE=0x00400000 diff --git a/ld/emulparams/i386moss.sh b/ld/emulparams/i386moss.sh index 81161b7..095d85a 100644 --- a/ld/emulparams/i386moss.sh +++ b/ld/emulparams/i386moss.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x00002000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=i386 diff --git a/ld/emulparams/i386nto.sh b/ld/emulparams/i386nto.sh index 078289c..626f9c1 100644 --- a/ld/emulparams/i386nto.sh +++ b/ld/emulparams/i386nto.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x08048000 TEXT_START_SYMBOLS='_btext = .;' MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/m68kelf.sh b/ld/emulparams/m68kelf.sh index f8dab2b..66da648 100644 --- a/ld/emulparams/m68kelf.sh +++ b/ld/emulparams/m68kelf.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-m68k" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x80000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/mn10200.sh b/ld/emulparams/mn10200.sh index 74f48d0..9cec0b5 100644 --- a/ld/emulparams/mn10200.sh +++ b/ld/emulparams/mn10200.sh @@ -5,6 +5,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=generic EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-mn10200" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x0 ARCH=mn10200 MACHINE= diff --git a/ld/emulparams/or32elf.sh b/ld/emulparams/or32elf.sh index 5cb3208..5d85b04 100644 --- a/ld/emulparams/or32elf.sh +++ b/ld/emulparams/or32elf.sh @@ -2,6 +2,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=generic EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-or32" +NO_RELA_RELOCS=yes TEXT_START_ADDR=0x1000000 TARGET_PAGE_SIZE=0x1000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" diff --git a/ld/emulparams/pjelf.sh b/ld/emulparams/pjelf.sh index e4d2fa5..37f0034 100644 --- a/ld/emulparams/pjelf.sh +++ b/ld/emulparams/pjelf.sh @@ -2,6 +2,7 @@ SCRIPT_NAME=elf TEMPLATE_NAME=generic EXTRA_EM_FILE=genelf OUTPUT_FORMAT="elf32-pj" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x1000000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=pj diff --git a/ld/emulparams/ppclynx.sh b/ld/emulparams/ppclynx.sh index 4203908..76aefd6 100644 --- a/ld/emulparams/ppclynx.sh +++ b/ld/emulparams/ppclynx.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-powerpc" +NO_REL_RELOCS=yes TEXT_BASE=0x00002000 DYN_TEXT_BASE=0x00400000 TEXT_START_ADDR="(DEFINED(_DYNAMIC) ? ${DYN_TEXT_BASE} : ${TEXT_BASE})" diff --git a/ld/emulparams/scoreelf.sh b/ld/emulparams/scoreelf.sh index 0ca5e56..dfb5aca 100644 --- a/ld/emulparams/scoreelf.sh +++ b/ld/emulparams/scoreelf.sh @@ -4,6 +4,7 @@ TEMPLATE_NAME=elf32 OUTPUT_FORMAT="elf32-bigscore" BIG_OUTPUT_FORMAT="elf32-bigscore" LITTLE_OUTPUT_FORMAT="elf32-littlescore" +NO_RELA_RELOCS=yes GROUP="-lm -lc -lglsim -lgcc -lstdc++" TEXT_START_ADDR=0x00000000 diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh index 6f66bf5..5757b81 100644 --- a/ld/emulparams/shelf.sh +++ b/ld/emulparams/shelf.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x1000 MAXPAGESIZE=128 ARCH=sh diff --git a/ld/emulparams/shelf32.sh b/ld/emulparams/shelf32.sh index c72fadb..966bd30 100644 --- a/ld/emulparams/shelf32.sh +++ b/ld/emulparams/shelf32.sh @@ -2,6 +2,7 @@ # sh[l]elf(32|64).sh parameter scripts. SCRIPT_NAME=elf OUTPUT_FORMAT=${OUTPUT_FORMAT-"elf32-sh64"} +NO_REL_RELOCS=yes TEXT_START_ADDR=0x1000 MAXPAGESIZE=128 ARCH=sh diff --git a/ld/emulparams/shelf_nto.sh b/ld/emulparams/shelf_nto.sh index 70a0610..c4d71aa 100644 --- a/ld/emulparams/shelf_nto.sh +++ b/ld/emulparams/shelf_nto.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x08040000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=sh diff --git a/ld/emulparams/shelf_vxworks.sh b/ld/emulparams/shelf_vxworks.sh index a87d529..77619cb 100644 --- a/ld/emulparams/shelf_vxworks.sh +++ b/ld/emulparams/shelf_vxworks.sh @@ -2,6 +2,7 @@ # shlelf_vxworks.sh SCRIPT_NAME=elf +NO_REL_RELOCS=yes BIG_OUTPUT_FORMAT="elf32-sh-vxworks" LITTLE_OUTPUT_FORMAT="elf32-shl-vxworks" OUTPUT_FORMAT="$BIG_OUTPUT_FORMAT" diff --git a/ld/emulparams/shlelf32_linux.sh b/ld/emulparams/shlelf32_linux.sh index ba32e79..81aea39 100644 --- a/ld/emulparams/shlelf32_linux.sh +++ b/ld/emulparams/shlelf32_linux.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh64-linux" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x400000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh index f91bb52..95b6acc 100644 --- a/ld/emulparams/shlelf_linux.sh +++ b/ld/emulparams/shlelf_linux.sh @@ -3,6 +3,7 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-sh-linux" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x400000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" diff --git a/ld/emulparams/shlelf_nto.sh b/ld/emulparams/shlelf_nto.sh index c6c04f6..16f6508 100644 --- a/ld/emulparams/shlelf_nto.sh +++ b/ld/emulparams/shlelf_nto.sh @@ -1,5 +1,6 @@ SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-shl" +NO_REL_RELOCS=yes TEXT_START_ADDR=0x08040000 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" ARCH=sh diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 5c35e4f..120db06 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -36,6 +36,9 @@ # DATA_PLT - .plt should be in data segment, not text segment. # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement. # BSS_PLT - .plt should be in bss segment +# NO_REL_RELOCS - Don't include .rel.* sections in script +# NO_RELA_RELOCS - Don't include .rela.* sections in script +# NON_ALLOC_DYN - Place dynamic sections after data segment. # TEXT_DYNAMIC - .dynamic in text segment, not data segment. # EMBEDDED - whether this is for an embedded system. # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set @@ -268,6 +271,11 @@ SECTIONS ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} ${INITIAL_READONLY_SECTIONS} .note.gnu.build-id : { *(.note.gnu.build-id) } +EOF + +test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN +test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC= +cat > ldscripts/dyntmp.$$ <<EOF ${TEXT_DYNAMIC+${DYNAMIC}} .hash ${RELOCATING-0} : { *(.hash) } .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) } @@ -276,10 +284,10 @@ SECTIONS .gnu.version ${RELOCATING-0} : { *(.gnu.version) } .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } - EOF + if [ "x$COMBRELOC" = x ]; then - COMBRELOCCAT=cat + COMBRELOCCAT="cat >> ldscripts/dyntmp.$$" else COMBRELOCCAT="cat > $COMBRELOC" fi @@ -316,27 +324,45 @@ eval $COMBRELOCCAT <<EOF .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } ${REL_LARGE} EOF + if [ -n "$COMBRELOC" ]; then -cat <<EOF +cat >> ldscripts/dyntmp.$$ <<EOF .rel.dyn ${RELOCATING-0} : { EOF -sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC -cat <<EOF +sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ +cat >> ldscripts/dyntmp.$$ <<EOF } .rela.dyn ${RELOCATING-0} : { EOF -sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC -cat <<EOF +sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ +cat >> ldscripts/dyntmp.$$ <<EOF } EOF fi -cat <<EOF + +cat >> ldscripts/dyntmp.$$ <<EOF .rel.plt ${RELOCATING-0} : { *(.rel.plt) } .rela.plt ${RELOCATING-0} : { *(.rela.plt) } ${OTHER_PLT_RELOC_SECTIONS} +EOF +if test -z "${NON_ALLOC_DYN}"; then + if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then + cat ldscripts/dyntmp.$$ + else + if test -z "${NO_REL_RELOCS}"; then + sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$ + fi + if test -z "${NO_RELA_RELOCS}"; then + sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$ + fi + fi + rm -f ldscripts/dyntmp.$$ +fi + +cat <<EOF .init ${RELOCATING-0} : { ${RELOCATING+${INIT_START}} @@ -464,7 +490,23 @@ cat <<EOF ${RELOCATING+${OTHER_END_SYMBOLS}} ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}} ${RELOCATING+${DATA_SEGMENT_END}} +EOF +if test -n "${NON_ALLOC_DYN}"; then + if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then + cat ldscripts/dyntmp.$$ + else + if test -z "${NO_REL_RELOCS}"; then + sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$ + fi + if test -z "${NO_RELA_RELOCS}"; then + sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$ + fi + fi + rm -f ldscripts/dyntmp.$$ +fi + +cat <<EOF /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } |