aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-10-22 05:20:44 +0000
committerAlan Modra <amodra@gmail.com>2008-10-22 05:20:44 +0000
commit485cf679681e0218e710df1df17a9158c1445e47 (patch)
tree41b2cc090512ff188afec8a921b2d32a97d9659b /ld
parentdaily update (diff)
downloadbinutils-gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.gz
binutils-gdb-485cf679681e0218e710df1df17a9158c1445e47.tar.bz2
binutils-gdb-485cf679681e0218e710df1df17a9158c1445e47.zip
* 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')
-rw-r--r--ld/ChangeLog28
-rw-r--r--ld/emulparams/arcelf.sh1
-rw-r--r--ld/emulparams/criself.sh1
-rw-r--r--ld/emulparams/crislinux.sh1
-rw-r--r--ld/emulparams/elf32_i860.sh1
-rw-r--r--ld/emulparams/elf32_i960.sh1
-rw-r--r--ld/emulparams/elf32_sparc.sh1
-rw-r--r--ld/emulparams/elf32_spu.sh1
-rw-r--r--ld/emulparams/elf32am33lin.sh1
-rwxr-xr-xld/emulparams/elf32fr30.sh1
-rw-r--r--ld/emulparams/elf32ip2k.sh1
-rw-r--r--ld/emulparams/elf32mcore.sh1
-rwxr-xr-xld/emulparams/elf32openrisc.sh1
-rw-r--r--ld/emulparams/elf32ppccommon.sh1
-rw-r--r--ld/emulparams/elf32ppcwindiss.sh1
-rw-r--r--ld/emulparams/elf32vax.sh1
-rw-r--r--ld/emulparams/elf64_s390.sh1
-rw-r--r--ld/emulparams/elf64_sparc.sh1
-rw-r--r--ld/emulparams/elf64alpha.sh1
-rw-r--r--ld/emulparams/elf64mmix.sh1
-rw-r--r--ld/emulparams/elf64ppc.sh1
-rw-r--r--ld/emulparams/elf_i386.sh1
-rw-r--r--ld/emulparams/elf_i386_be.sh1
-rw-r--r--ld/emulparams/elf_i386_ldso.sh1
-rw-r--r--ld/emulparams/elf_i386_vxworks.sh1
-rw-r--r--ld/emulparams/elf_s390.sh1
-rw-r--r--ld/emulparams/elf_x86_64.sh1
-rw-r--r--ld/emulparams/h8300elf.sh1
-rw-r--r--ld/emulparams/hppa64linux.sh1
-rw-r--r--ld/emulparams/hppalinux.sh1
-rw-r--r--ld/emulparams/i386lynx.sh1
-rw-r--r--ld/emulparams/i386moss.sh1
-rw-r--r--ld/emulparams/i386nto.sh1
-rw-r--r--ld/emulparams/m68kelf.sh1
-rw-r--r--ld/emulparams/mn10200.sh1
-rw-r--r--ld/emulparams/or32elf.sh1
-rw-r--r--ld/emulparams/pjelf.sh1
-rw-r--r--ld/emulparams/ppclynx.sh1
-rw-r--r--ld/emulparams/scoreelf.sh1
-rw-r--r--ld/emulparams/shelf.sh1
-rw-r--r--ld/emulparams/shelf32.sh1
-rw-r--r--ld/emulparams/shelf_nto.sh1
-rw-r--r--ld/emulparams/shelf_vxworks.sh1
-rw-r--r--ld/emulparams/shlelf32_linux.sh1
-rw-r--r--ld/emulparams/shlelf_linux.sh1
-rw-r--r--ld/emulparams/shlelf_nto.sh1
-rw-r--r--ld/scripttempl/elf.sc58
47 files changed, 123 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7677999b581..8e8cfa156ca 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 31db4a9be11..cd334d62324 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 1d374ae44bb..f709a1bb63e 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 e41024c9a7a..8a1a5b8e5b0 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 589067f818b..482e3d1e5c4 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 1ef729297ab..56d91d7265d 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 3db6d8838d1..aef813eea57 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 8248d5dee7b..1ed58c341b5 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 2f8b9624aa5..b34d2b8751e 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 d078155909a..1764a325698 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 17fb7aba9c7..0db227fe3a2 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 31d65dc8838..60479501bc9 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 53e88ddf86a..bbe9a3e8b3a 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 1a12890b063..15cb3b123a7 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 d217de94007..b40d782673e 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 4c6ef397173..9ddc754c663 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 ede836ccf2c..ae8f26e411e 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 03cab9efd32..9397b87dbc6 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 a42e75d0358..82f505de69b 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 7f867fb8cff..787b50d6545 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 8b0c587607a..b9631b654ec 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 908515a7adb..05d31a81933 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 b61738c4a0c..efe1a86bfac 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 b4ac9603a4f..4b0d3fb6930 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 90a98b3dcf3..693312845e9 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 e252e8e09f6..218558bd54e 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 cdd41195ca7..4b24710f457 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 fb4db40ddcf..38b8a3692f2 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 1af8e37d376..92939bf8888 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 4c4f94334ba..9fa46151500 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 6d9d9fe11d6..93afb3d7f37 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 81161b7b5ae..095d85ab921 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 078289c384b..626f9c13aa1 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 f8dab2b13fc..66da64896b1 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 74f48d0c486..9cec0b537fe 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 5cb3208ccce..5d85b047c19 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 e4d2fa59f07..37f00340e4a 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 42039082a2c..76aefd6eb26 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 0ca5e56a1f8..dfb5aca83f2 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 6f66bf5efa4..5757b81da31 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 c72fadb8fa1..966bd3093cd 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 70a0610ad7e..c4d71aa9993 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 a87d5294762..77619cb2ac6 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 ba32e79e9e5..81aea39c81f 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 f91bb52526c..95b6acc5d07 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 c6c04f6b29b..16f65087eb0 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 5c35e4f4aa6..120db064903 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) }