From: Maciej W. Rozycki Date: Wed, 26 Apr 2017 21:18:13 +0000 (+0100) Subject: ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC X-Git-Tag: users/ARM/embedded-binutils-2_28-branch-2017q2~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e1b086f4e20861f912d5f3b9b34180881b7273b;p=thirdparty%2Fbinutils-gdb.git ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC Consistently call `_bfd_elf_link_renumber_dynsyms' only if linking a dynamic binary, complementing code in `bfd_elf_size_dynsym_hash_dynstr' and commit ccabcbe51e85 ("New attempt at fixing MIPS --gc-sections et al."), . bfd/ * elflink.c (elf_gc_sweep): Only call `_bfd_elf_link_renumber_dynsyms' if dynamic sections have been created. (backported from commit c46cec3a8cfe02fbe0f6c67ba53abc5369c5c659) --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 00875637e9e..5bcd30b330f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-04-26 Maciej W. Rozycki + + * elflink.c (elf_gc_sweep): Only call + `_bfd_elf_link_renumber_dynsyms' if dynamic sections have been + created. + 2017-04-24 H.J. Lu PR ld/21425 diff --git a/bfd/elflink.c b/bfd/elflink.c index 46d57e59396..1c3e1b0ca54 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12983,7 +12983,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, &sweep_info); - _bfd_elf_link_renumber_dynsyms (abfd, info, §ion_sym_count); + if (elf_hash_table (info)->dynamic_sections_created) + _bfd_elf_link_renumber_dynsyms (abfd, info, §ion_sym_count); return TRUE; }