mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 14:53:32 +08:00
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.
This commit is contained in:
parent
0d4c07afb1
commit
3c5fce9bc2
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2017-04-20 Maciej W. Rozycki <macro@imgtec.com>
|
||||
|
||||
* elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
|
||||
|
@ -3851,6 +3851,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
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
|
||||
|
13
ld/ChangeLog
13
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
#source: pr19617.s
|
||||
#ld: -E
|
||||
#ld: -E --no-dynamic-linker
|
||||
#readelf : --dyn-syms --wide
|
||||
#target: *-*-linux* *-*-gnu* *-*-solaris*
|
||||
|
||||
|
@ -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*
|
||||
|
||||
|
@ -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*
|
||||
|
||||
|
8
ld/testsuite/ld-elf/pr21086.c
Normal file
8
ld/testsuite/ld-elf/pr21086.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
printf ("PASS\n");
|
||||
return 0;
|
||||
}
|
3
ld/testsuite/ld-elf/pr21086.list
Normal file
3
ld/testsuite/ld-elf/pr21086.list
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
main;
|
||||
};
|
@ -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} \
|
||||
|
@ -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"]]
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user