aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-11-01 13:45:25 +1030
committerAlan Modra <amodra@gmail.com>2019-11-05 14:32:19 +1030
commitf2aaebdb97977ee7a5c83c02af871e758e7d594b (patch)
tree6fba5fa0f963bd0460e7aae7a112be529ddaf67b /ld
parentcbb54a288a91084361cd4d57c88a73540494980b (diff)
downloadgdb-f2aaebdb97977ee7a5c83c02af871e758e7d594b.zip
gdb-f2aaebdb97977ee7a5c83c02af871e758e7d594b.tar.gz
gdb-f2aaebdb97977ee7a5c83c02af871e758e7d594b.tar.bz2
GENERATE_SHLIB_SCRIPT vs. EMBEDDED.
A target that sets EMBEDDED non-empty is one that doesn't want to put the ELF file header or program header in a memory image. Likely the target isn't interested in supporting dynamically loaded executables, shared libraries, or PIEs, because loaders for such binaries generally require program headers to be present. This isn't 100% true though. The target might be one where the loader accesses the file system in order to retrieve headers. Also, note that not all "shared libraries" require gcc -shared or the shared library support in the linker. I believe one implementation of shared libraries on uclinux is like this. So, this patch removes GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT in most emulparams files where EMBEDDED is set, restoring the shared lib and pie support in emulparams files that unset EMBEDDED after including a file where the support is removed. Exceptions to the general rule that EMBEDDED disables shared libs are: arm*-*-symbianelf*, where the OS wants shared library support without ELF program headers in the image, and sh*-*-uclinux*, where I've left things as they were, ie. both EMBEDDED and GENERATE_SHLIB_SCRIPT because I'm unsure as to the shared library scheme. * emulparams/aarch64elf.sh (GENERATE_SHLIB_SCRIPT), (GENERATE_PIE_SCRIPT): Don't set. * emulparams/aarch64elf32.sh (GENERATE_SHLIB_SCRIPT), (GENERATE_PIE_SCRIPT): Don't set. * emulparams/arcelf.sh (GENERATE_SHLIB_SCRIPT): Don't set. * emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT), (GENERATE_PIE_SCRIPT): Don't set. * emulparams/armelf_fbsd.sh (GENERATE_SHLIB_SCRIPT): Set. * emulparams/armelf_nbsd.sh (GENERATE_SHLIB_SCRIPT), (GENERATE_PIE_SCRIPT): Set. * emulparams/armelf_vxworks.sh (GENERATE_SHLIB_SCRIPT): Set. * emulparams/armsymbian.sh (GENERATE_SHLIB_SCRIPT): Set. * emulparams/elf32bfin.sh (GENERATE_SHLIB_SCRIPT): Don't set. * emulparams/elf32microblaze.sh (GENERATE_SHLIB_SCRIPT): Don't set. * emulparams/score3_elf.sh (GENERATE_SHLIB_SCRIPT): Don't set. * emulparams/shelf.sh (GENERATE_SHLIB_SCRIPT): Don't set. * emulparams/shelf_nbsd.sh (GENERATE_SHLIB_SCRIPT), (GENERATE_PIE_SCRIPT): Set. * emulparams/shelf_uclinux.sh (GENERATE_SHLIB_SCRIPT): Set.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog22
-rw-r--r--ld/emulparams/aarch64elf.sh3
-rw-r--r--ld/emulparams/aarch64elf32.sh3
-rw-r--r--ld/emulparams/arcelf.sh2
-rw-r--r--ld/emulparams/armelf.sh3
-rw-r--r--ld/emulparams/armelf_fbsd.sh2
-rw-r--r--ld/emulparams/armelf_nbsd.sh2
-rw-r--r--ld/emulparams/armelf_vxworks.sh1
-rw-r--r--ld/emulparams/armsymbian.sh2
-rw-r--r--ld/emulparams/elf32bfin.sh1
-rw-r--r--ld/emulparams/elf32microblaze.sh3
-rw-r--r--ld/emulparams/score3_elf.sh1
-rw-r--r--ld/emulparams/shelf.sh1
-rw-r--r--ld/emulparams/shelf_nbsd.sh2
-rw-r--r--ld/emulparams/shelf_uclinux.sh1
15 files changed, 31 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2741f87..431e5b6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,27 @@
2019-11-05 Alan Modra <amodra@gmail.com>
+ * emulparams/aarch64elf.sh (GENERATE_SHLIB_SCRIPT),
+ (GENERATE_PIE_SCRIPT): Don't set.
+ * emulparams/aarch64elf32.sh (GENERATE_SHLIB_SCRIPT),
+ (GENERATE_PIE_SCRIPT): Don't set.
+ * emulparams/arcelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
+ * emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT),
+ (GENERATE_PIE_SCRIPT): Don't set.
+ * emulparams/armelf_fbsd.sh (GENERATE_SHLIB_SCRIPT): Set.
+ * emulparams/armelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
+ (GENERATE_PIE_SCRIPT): Set.
+ * emulparams/armelf_vxworks.sh (GENERATE_SHLIB_SCRIPT): Set.
+ * emulparams/armsymbian.sh (GENERATE_SHLIB_SCRIPT): Set.
+ * emulparams/elf32bfin.sh (GENERATE_SHLIB_SCRIPT): Don't set.
+ * emulparams/elf32microblaze.sh (GENERATE_SHLIB_SCRIPT): Don't set.
+ * emulparams/score3_elf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
+ * emulparams/shelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
+ * emulparams/shelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
+ (GENERATE_PIE_SCRIPT): Set.
+ * emulparams/shelf_uclinux.sh (GENERATE_SHLIB_SCRIPT): Set.
+
+2019-11-05 Alan Modra <amodra@gmail.com>
+
* emulparams/elf32bfinfd.sh: Unset EMBEDDED rather assigning as empty.
* emulparams/elf32frvfd.sh: Likewise.
* emulparams/elf32lm32fd.sh: Likewise.
diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh
index 8f68e51..5c70b55 100644
--- a/ld/emulparams/aarch64elf.sh
+++ b/ld/emulparams/aarch64elf.sh
@@ -12,9 +12,6 @@ NO_REL_RELOCS=yes
TEMPLATE_NAME=elf
EXTRA_EM_FILE=aarch64elf
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
-
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ENTRY=_start
diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh
index 5a08d9e..a94025a 100644
--- a/ld/emulparams/aarch64elf32.sh
+++ b/ld/emulparams/aarch64elf32.sh
@@ -12,9 +12,6 @@ NO_REL_RELOCS=yes
TEMPLATE_NAME=elf
EXTRA_EM_FILE=aarch64elf
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
-
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
ENTRY=_start
diff --git a/ld/emulparams/arcelf.sh b/ld/emulparams/arcelf.sh
index 625ec39..b6d8f9f 100644
--- a/ld/emulparams/arcelf.sh
+++ b/ld/emulparams/arcelf.sh
@@ -19,5 +19,3 @@ SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;'
JLI_START_TABLE='__JLI_TABLE__ = .;'
OTHER_SECTIONS="/DISCARD/ : { *(.__arc_profile_*) }"
EMBEDDED=yes
-
-GENERATE_SHLIB_SCRIPT=yes
diff --git a/ld/emulparams/armelf.sh b/ld/emulparams/armelf.sh
index 0e3147c..8977fd6 100644
--- a/ld/emulparams/armelf.sh
+++ b/ld/emulparams/armelf.sh
@@ -32,9 +32,6 @@ OTHER_READONLY_SECTIONS="
DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__data_start = .${CREATE_SHLIB+)};"
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
-
ARCH=arm
MACHINE=
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
diff --git a/ld/emulparams/armelf_fbsd.sh b/ld/emulparams/armelf_fbsd.sh
index be88c2f..4428b91 100644
--- a/ld/emulparams/armelf_fbsd.sh
+++ b/ld/emulparams/armelf_fbsd.sh
@@ -5,7 +5,7 @@ TEXT_START_ADDR=0x00010000
TARGET2_TYPE=got-rel
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
-
unset STACK_ADDR
unset EMBEDDED
diff --git a/ld/emulparams/armelf_nbsd.sh b/ld/emulparams/armelf_nbsd.sh
index 37e1a4a..4595459 100644
--- a/ld/emulparams/armelf_nbsd.sh
+++ b/ld/emulparams/armelf_nbsd.sh
@@ -3,5 +3,7 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
TEXT_START_ADDR=0x00008000
TARGET2_TYPE=got-rel
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
unset STACK_ADDR
unset EMBEDDED
diff --git a/ld/emulparams/armelf_vxworks.sh b/ld/emulparams/armelf_vxworks.sh
index 5f57535..e344209 100644
--- a/ld/emulparams/armelf_vxworks.sh
+++ b/ld/emulparams/armelf_vxworks.sh
@@ -4,3 +4,4 @@ BIG_OUTPUT_FORMAT="elf32-bigarm-vxworks"
LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT"
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
source_sh ${srcdir}/emulparams/vxworks.sh
+GENERATE_SHLIB_SCRIPT=yes
diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh
index 1959685..183750a 100644
--- a/ld/emulparams/armsymbian.sh
+++ b/ld/emulparams/armsymbian.sh
@@ -8,6 +8,8 @@ TARGET1_IS_REL=1
TARGET2_TYPE=abs
# On BPABI systems, program headers should not be mapped.
EMBEDDED=yes
+# Nonetheless, shared libraries are also supported
+GENERATE_SHLIB_SCRIPT=yes
# As for armelf.sh, but add the SymbianOS-specific
# .ARM.exidx$${Base,Limit} symbols.
diff --git a/ld/emulparams/elf32bfin.sh b/ld/emulparams/elf32bfin.sh
index 8d298b4..6e08035 100644
--- a/ld/emulparams/elf32bfin.sh
+++ b/ld/emulparams/elf32bfin.sh
@@ -6,7 +6,6 @@ TARGET_PAGE_SIZE=0x1000
ARCH=bfin
MACHINE=
TEMPLATE_NAME=elf
-GENERATE_SHLIB_SCRIPT=yes
EMBEDDED=yes
USER_LABEL_PREFIX=_
EXTRA_EM_FILE=bfin
diff --git a/ld/emulparams/elf32microblaze.sh b/ld/emulparams/elf32microblaze.sh
index f867018..698adb7 100644
--- a/ld/emulparams/elf32microblaze.sh
+++ b/ld/emulparams/elf32microblaze.sh
@@ -21,6 +21,3 @@ NOP=0x80000000
#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
TEMPLATE_NAME=elf
-#GENERATE_SHLIB_SCRIPT=yes
-
-
diff --git a/ld/emulparams/score3_elf.sh b/ld/emulparams/score3_elf.sh
index 7be7883..7840187 100644
--- a/ld/emulparams/score3_elf.sh
+++ b/ld/emulparams/score3_elf.sh
@@ -26,4 +26,3 @@ ARCH=score3
MACHINE=
ENTRY=_start
EMBEDDED=yes
-GENERATE_SHLIB_SCRIPT=yes
diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh
index 63c2ff1..96c18c0 100644
--- a/ld/emulparams/shelf.sh
+++ b/ld/emulparams/shelf.sh
@@ -9,7 +9,6 @@ MAXPAGESIZE=128
ARCH=sh
MACHINE=
TEMPLATE_NAME=elf
-GENERATE_SHLIB_SCRIPT=yes
EMBEDDED=yes
# These are for compatibility with the COFF toolchain.
ENTRY=start
diff --git a/ld/emulparams/shelf_nbsd.sh b/ld/emulparams/shelf_nbsd.sh
index 3913996..57db803 100644
--- a/ld/emulparams/shelf_nbsd.sh
+++ b/ld/emulparams/shelf_nbsd.sh
@@ -11,5 +11,7 @@ DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
ENTRY=_start
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
unset EMBEDDED
unset STACK_ADDR
diff --git a/ld/emulparams/shelf_uclinux.sh b/ld/emulparams/shelf_uclinux.sh
index a22c35a..41044f0 100644
--- a/ld/emulparams/shelf_uclinux.sh
+++ b/ld/emulparams/shelf_uclinux.sh
@@ -2,3 +2,4 @@ source_sh ${srcdir}/emulparams/shelf.sh
# We do not want a .stack section
unset STACK_ADDR
+GENERATE_SHLIB_SCRIPT=yes