diff options
author | Nick Clifton <nickc@redhat.com> | 2017-10-23 18:16:49 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-10-23 18:16:49 +0100 |
commit | 66cae56016a12f7cbdc94be6f82c1cad1c59b521 (patch) | |
tree | a89554827cf870a421e3af26f6b7d6c389abefe4 /bfd | |
parent | fe4e2a3c9281851c9da99a6e36a2bc96e4279476 (diff) | |
download | gdb-66cae56016a12f7cbdc94be6f82c1cad1c59b521.zip gdb-66cae56016a12f7cbdc94be6f82c1cad1c59b521.tar.gz gdb-66cae56016a12f7cbdc94be6f82c1cad1c59b521.tar.bz2 |
Make sure that undefined symbols added to the linker command line via the -u option appear in the output executable, if they have not been resolved.
PR 22319
bfd * elflink.c (elf_link_output_extsym): Keep global undefined
symbols if they have been marked as needed.
ld * testsuite/ld-elf/pr22310.s: New test source file.
* testsuite/ld-elf/pr22310.d: New test driver.
* testsuite/ld-mmix/undef-3.d: Update expected output from readelf.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fde334d..73d1f4b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-10-23 Nick Clifton <nickc@redhat.com> + + PR 22319 + * elflink.c (elf_link_output_extsym): Keep global undefined + symbols if they have been marked as needed. + 2017-10-23 Maciej W. Rozycki <macro@imgtec.com> * elfn32-mips.c (mips_elf_n32_mkobject): New prototype and diff --git a/bfd/elflink.c b/bfd/elflink.c index b401e68..de13d04 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -9910,8 +9910,11 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) relocatable output or when needed for --emit-relocs. */ else if (input_sec == bfd_und_section_ptr && h->indx != -2 + /* PR 22319 Do not strip global undefined symbols marked as being needed. */ + && (h->mark != 1 || ELF_ST_BIND (sym.st_info) != STB_GLOBAL) && !bfd_link_relocatable (flinfo->info)) return TRUE; + /* Also strip others that we couldn't earlier due to dynamic symbol processing. */ if (strip) |