diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-06-10 05:31:19 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-06-10 05:31:31 -0700 |
commit | e1b5d517d1c293a64df311d2749bbbbfbe035a4c (patch) | |
tree | 8f608a55c2b8004b5a706d8dbee71d2eb7c80885 /bfd | |
parent | 25065fcd192d9958c03e107985aea41d651e4a16 (diff) | |
download | gdb-e1b5d517d1c293a64df311d2749bbbbfbe035a4c.zip gdb-e1b5d517d1c293a64df311d2749bbbbfbe035a4c.tar.gz gdb-e1b5d517d1c293a64df311d2749bbbbfbe035a4c.tar.bz2 |
ELF: Properly handle section symbols
When defining the section symbol, __start_FOO, for the section FOO:
1. Treat the common symbol, __start_FOO, in input object file as
definition.
2. Clear verinfo.verdef.
bfd/
PR ld/26094
* elflink.c (bfd_elf_define_start_stop): Handle common symbols.
Clear verinfo.verdef.
ld/
PR ld/26094
* testsuite/ld-elf/pr26094-1.ver: New fike.
* testsuite/ld-elf/pr26094-1a.c: Likewise.
* testsuite/ld-elf/pr26094-1a.rd: Likewise.
* testsuite/ld-elf/pr26094-1b.c: Likewise.
* testsuite/ld-elf/pr26094-1b.rd: Likewise.
* testsuite/ld-elf/pr26094-1c.c: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/26094 tests.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8f9e69c..928d4bd 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-06-10 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/26094 + * elflink.c (bfd_elf_define_start_stop): Handle common symbols. + Clear verinfo.verdef. + 2020-06-09 H.J. Lu <hongjiu.lu@intel.com> PR ld/18801 diff --git a/bfd/elflink.c b/bfd/elflink.c index 60a3c22..3e56a29 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14802,12 +14802,16 @@ bfd_elf_define_start_stop (struct bfd_link_info *info, h = elf_link_hash_lookup (elf_hash_table (info), symbol, FALSE, FALSE, TRUE); + /* NB: Common symbols will be turned into definition later. */ if (h != NULL && (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak - || ((h->ref_regular || h->def_dynamic) && !h->def_regular))) + || ((h->ref_regular || h->def_dynamic) + && !h->def_regular + && h->root.type != bfd_link_hash_common))) { bfd_boolean was_dynamic = h->ref_dynamic || h->def_dynamic; + h->verinfo.verdef = NULL; h->root.type = bfd_link_hash_defined; h->root.u.def.section = sec; h->root.u.def.value = 0; |