summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-03-18 20:46:28 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-03-18 20:57:02 -0700
commit3818d4ab066ee40b976513b247b5da5f20379b66 (patch)
treeebb68ff9dea8c35f68178204ce3de18989126655 /bfd/elf.c
parent51f6e7a9f4210aed0f8156c1d2e348de6f96f37d (diff)
elf: Handle .gnu.debuglto_.debug_* sections
commit 994b25132814f4c2be93ce53a616a74139c4cf3c Author: H.J. Lu <hjl.tools@gmail.com> Date: Sun Jan 17 20:01:16 2021 -0800 ld/elf: Ignore section symbols when matching linkonce with comdat ignored section symbols when comparing symbols in 2 sections. Since all references to debugging sections are done with section symbols, symbols in debugging sections are ignored and we fail to match symbols in comdat debugging sections. Also .gnu.debuglto_.debug_* sections aren't treated as debugging sections. 1. Treate .gnu.debuglto_.debug_ section as debugging section unless it is marked with SHF_EXCLUDE. 2. Revert commit 994b2513281 in elf_create_symbuf. 3. Ignore section symbols only when matching non-debugging sections or linkonce section with comdat section. bfd/ PR ld/27590 * elf.c (_bfd_elf_make_section_from_shdr): Treate .gnu.debuglto_.debug_ section as debugging section unless it is marked with SHF_EXCLUDE. * elflink.c (elf_create_symbuf): Revert commit 994b2513281. (bfd_elf_match_symbols_in_sections): Ignore section symbols when matching non-debugging sections or linkonce section with comdat section. ld/ PR ld/27590 * testsuite/ld-elf/pr27590.s: New file. * testsuite/ld-elf/pr27590a.d: Likewise. * testsuite/ld-elf/pr27590b.d: Likewise. * testsuite/ld-i386/i386.exp: Also run ld/27193 test with --reduce-memory-overheads.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 35c31cf40b..7bd12dfbf3 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1085,6 +1085,10 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
if (name [0] == '.')
{
if (strncmp (name, ".debug", 6) == 0
+ /* NB: Treate .gnu.debuglto_.debug_ section as debugging
+ section unless it is marked with SHF_EXCLUDE. */
+ || ((flags & SEC_EXCLUDE) == 0
+ && strncmp (name, ".gnu.debuglto_.debug_", 21) == 0)
|| strncmp (name, ".gnu.linkonce.wi.", 17) == 0
|| strncmp (name, ".zdebug", 7) == 0)
flags |= SEC_DEBUGGING | SEC_ELF_OCTETS;