This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH v2 1/2] ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: James Cowgill <James dot Cowgill at imgtec dot com>, <binutils at sourceware dot org>
- Date: Mon, 24 Apr 2017 20:13:28 +0100
- Subject: [PATCH v2 1/2] ELF/BFD: Limit `_bfd_elf_link_renumber_dynsyms' call in section GC
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.00.1704241805070.25796@tp.orcam.me.uk>
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."), <https://sourceware.org/ml/binutils/2005-08/msg00258.html>.
bfd/
* elflink.c (bfd_elf_size_dynamic_sections): Only call
`_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
sections have been created.
---
No regressions across the usual targets. OK for master and 2.28?
Maciej
binutils-bfd-elf-gc-dynsym-renumber.diff
Index: binutils/bfd/elflink.c
===================================================================
--- binutils.orig/bfd/elflink.c 2017-04-22 03:35:18.929206015 +0100
+++ binutils/bfd/elflink.c 2017-04-22 03:36:05.768357914 +0100
@@ -6460,7 +6460,8 @@ bfd_elf_size_dynamic_sections (bfd *outp
elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
&sweep_info);
- _bfd_elf_link_renumber_dynsyms (output_bfd, info, §ion_sym_count);
+ if (elf_hash_table (info)->dynamic_sections_created)
+ _bfd_elf_link_renumber_dynsyms (output_bfd, info, §ion_sym_count);
}
/* Any syms created from now on start with -1 in