aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-21 12:00:55 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-21 12:01:05 -0700
commit3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359 (patch)
tree94a9137c5a3cfabb589c090994f03fd98704ed66 /ld
parent0d4c07afb1e5e37e8e296858f8b14a3b4adf950b (diff)
downloadgdb-3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359.zip
gdb-3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359.tar.gz
gdb-3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359.tar.bz2
Require --no-dynamic-linker with -static -E/--dynamic-list
When -static -E/--dynamic-list are passed to linker, linker may create executable with dynamic sections which aren't supported by run-time. We require --no-dynamic-linker together with -static -E/--dynamic-list before adding dynamic symbol table to static executable. bfd/ PR ld/19617 PR ld/21086 * elflink.c (elf_link_add_object_symbols): Require --no-dynamic-linker with -E/--dynamic-list when creating dynamic sections. ld/ PR ld/19617 PR ld/21086 * testsuite/ld-elf/pr19617a.d: Pass --no-dynamic-linker to ld. * testsuite/ld-elf/pr19617b.d: Likewise. * testsuite/ld-elf/pr19617c.d: Likewise. *testsuite/ld-i386/pr19636-4d.d: Likewise. * testsuite/ld-elf/readelf.exp: Pass --no-dynamic-linker to ld with --export-dynamic. * testsuite/ld-elf/shared.exp: Pass --no-dynamic-linker to ld with -E.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/testsuite/ld-elf/pr19617a.d2
-rw-r--r--ld/testsuite/ld-elf/pr19617b.d2
-rw-r--r--ld/testsuite/ld-elf/pr19617c.d2
-rw-r--r--ld/testsuite/ld-elf/pr21086.c8
-rw-r--r--ld/testsuite/ld-elf/pr21086.list3
-rw-r--r--ld/testsuite/ld-elf/readelf.exp2
-rw-r--r--ld/testsuite/ld-elf/shared.exp4
-rw-r--r--ld/testsuite/ld-i386/pr19636-4d.d2
9 files changed, 31 insertions, 7 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index fb88dc7..86d9e51 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2017-04-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19617
+ PR ld/21086
+ * testsuite/ld-elf/pr19617a.d: Pass --no-dynamic-linker to ld.
+ * testsuite/ld-elf/pr19617b.d: Likewise.
+ * testsuite/ld-elf/pr19617c.d: Likewise.
+ *testsuite/ld-i386/pr19636-4d.d: Likewise.
+ * testsuite/ld-elf/readelf.exp: Pass --no-dynamic-linker to ld
+ with --export-dynamic.
+ * testsuite/ld-elf/shared.exp: Pass --no-dynamic-linker to ld
+ with -E.
+
2017-04-20 H.J. Lu <hongjiu.lu@intel.com>
PR ld/21402
diff --git a/ld/testsuite/ld-elf/pr19617a.d b/ld/testsuite/ld-elf/pr19617a.d
index 784aacb..132021f 100644
--- a/ld/testsuite/ld-elf/pr19617a.d
+++ b/ld/testsuite/ld-elf/pr19617a.d
@@ -1,5 +1,5 @@
#source: pr19617.s
-#ld: -E
+#ld: -E --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
diff --git a/ld/testsuite/ld-elf/pr19617b.d b/ld/testsuite/ld-elf/pr19617b.d
index e1dcb71..4d1886f 100644
--- a/ld/testsuite/ld-elf/pr19617b.d
+++ b/ld/testsuite/ld-elf/pr19617b.d
@@ -1,5 +1,5 @@
#source: pr19617.s
-#ld: --dynamic-list-data
+#ld: --dynamic-list-data --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
diff --git a/ld/testsuite/ld-elf/pr19617c.d b/ld/testsuite/ld-elf/pr19617c.d
index 00e2e7e..9ac8fc1 100644
--- a/ld/testsuite/ld-elf/pr19617c.d
+++ b/ld/testsuite/ld-elf/pr19617c.d
@@ -1,5 +1,5 @@
#source: pr19617.s
-#ld: --dynamic-list-data
+#ld: --dynamic-list-data --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
diff --git a/ld/testsuite/ld-elf/pr21086.c b/ld/testsuite/ld-elf/pr21086.c
new file mode 100644
index 0000000..8fb892c
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21086.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main ()
+{
+ printf ("PASS\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-elf/pr21086.list b/ld/testsuite/ld-elf/pr21086.list
new file mode 100644
index 0000000..a4e712f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21086.list
@@ -0,0 +1,3 @@
+{
+ main;
+};
diff --git a/ld/testsuite/ld-elf/readelf.exp b/ld/testsuite/ld-elf/readelf.exp
index 92ca1c5..6831c19 100644
--- a/ld/testsuite/ld-elf/readelf.exp
+++ b/ld/testsuite/ld-elf/readelf.exp
@@ -43,7 +43,7 @@ if [check_shared_lib_support] {
run_ld_link_tests [list \
[list \
"readelf version information" \
- "$LFLAGS -e 0 --export-dynamic -T ver_def.ld\
+ "$LFLAGS --no-dynamic-linker -e 0 --export-dynamic -T ver_def.ld\
--version-script=ver_def.ver" \
"" "" \
{ver_def.s} \
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 4859170..0fd41ff 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -104,13 +104,13 @@ if { [check_gc_sections_available] } {
"pr20828-v.so"] \
[list \
"PR ld/20828 forcibly exported symbol version without section GC" \
- "$LFLAGS -e foo -E -T pr20828-v.ld" "" "" \
+ "$LFLAGS --no-dynamic-linker -e foo -E -T pr20828-v.ld" "" "" \
{pr20828-v.s} \
{{objdump -p pr20828-v.od}} \
"pr20828-v-1"] \
[list \
"PR ld/20828 forcibly exported symbol version with section GC" \
- "$LFLAGS -e foo --gc-sections -E -T pr20828-v.ld" "" "" \
+ "$LFLAGS --no-dynamic-linker -e foo --gc-sections -E -T pr20828-v.ld" "" "" \
{pr20828-v.s} \
{{objdump -p pr20828-v.od}} \
"pr20828-v-2"]]
diff --git a/ld/testsuite/ld-i386/pr19636-4d.d b/ld/testsuite/ld-i386/pr19636-4d.d
index a9487f0..e3db609 100644
--- a/ld/testsuite/ld-i386/pr19636-4d.d
+++ b/ld/testsuite/ld-i386/pr19636-4d.d
@@ -1,6 +1,6 @@
#source: pr19636-4.s
#as: --32
-#ld: -E --defsym foobar=0x100 -m elf_i386
+#ld: -E --defsym foobar=0x100 -m elf_i386 --no-dynamic-linker
#readelf : --dyn-syms --wide
Symbol table '\.dynsym' contains [0-9]+ entries: