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.
Cherry-pick of
3c5fce9bc29b216af7d10f8d6e4d8c3f11a48359.
Change-Id: Ia85dd5cd783d60a63164ae34ea096d73806b9987
+2017-04-27 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ Backport from mainline:
+ 2017-04-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
2016-09-15 Christophe Lyon <christophe.lyon@linaro.org>
Backport from mainline:
* elf32-arm.c (elf32_arm_count_additional_relocs): Return zero if
there is no arm data associated with the section.
-
if (!just_syms
&& (bfd_link_pic (info)
|| (!bfd_link_relocatable (info)
+ && info->nointerp
&& (info->export_dynamic || info->dynamic)))
&& is_elf_hash_table (htab)
&& info->output_bfd->xvec == abfd->xvec
--- /dev/null
+2017-04-27 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ Backport from mainline:
+ 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.
#source: pr19617.s
-#ld: -E
+#ld: -E --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
#source: pr19617.s
-#ld: --dynamic-list-data
+#ld: --dynamic-list-data --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
#source: pr19617.s
-#ld: --dynamic-list-data
+#ld: --dynamic-list-data --no-dynamic-linker
#readelf : --dyn-syms --wide
#target: *-*-linux* *-*-gnu* *-*-solaris*
--- /dev/null
+#include <stdio.h>
+
+int
+main ()
+{
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null
+{
+ main;
+};
#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: