[binutils-gdb] PR25236, common sym versioning
Alan Modra
amodra@sourceware.org
Sat Dec 7 05:51:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5fa370e437f39bf73a133cc84c4e6329943522bf
commit 5fa370e437f39bf73a133cc84c4e6329943522bf
Author: Alan Modra <amodra@gmail.com>
Date: Fri Dec 6 11:21:45 2019 +1030
PR25236, common sym versioning
In cases where a relocatable object file has a common symbol, no other
file has a definition, and there is a matching common symbol found in
a shared library then ld will output a definition using the largest of
size and alignment for the commons. This patch fixes a bug in ld that
ignored common symbols when assigning versions, resulting in such
symbols being given VER_NDX_LOCAL versions.
PR 25236
* elflink.c (_bfd_elf_link_assign_sym_version): Assign versions
for ELF_COMMON_DEF_P symbols.
(elf_link_output_extsym, _bfd_elf_add_default_symbol): Adjust to
suit.
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/elflink.c | 6 +++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c1bba0c..50c878b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-07 Alan Modra <amodra@gmail.com>
+
+ PR 25236
+ * elflink.c (_bfd_elf_link_assign_sym_version): Assign versions
+ for ELF_COMMON_DEF_P symbols.
+ (elf_link_output_extsym, _bfd_elf_add_default_symbol): Adjust to
+ suit.
+
2019-12-05 Sandra Loosemore <sandra@codesourcery.com>
Only give FDE encoding warnings if --eh-frame-hdr was specified.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 5549361..7078a2f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1904,7 +1904,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (skip)
goto nondefault;
- if (hi->def_regular)
+ if (hi->def_regular || ELF_COMMON_DEF_P (hi))
{
/* If the undecorated symbol will have a version added by a
script different to H, then don't indirect to/from the
@@ -2367,7 +2367,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
/* We only need version numbers for symbols defined in regular
objects. */
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
{
/* Hide symbols defined in discarded input sections. */
if ((h->root.type == bfd_link_hash_defined
@@ -10246,7 +10246,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
Elf_Internal_Versym iversym;
Elf_External_Versym *eversym;
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
{
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
More information about the Binutils-cvs
mailing list