aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-20 10:22:37 +1030
committerAlan Modra <amodra@gmail.com>2021-03-20 10:35:18 +1030
commit15407e7e0d42a46de5534df22eec933fc45178a3 (patch)
tree82ce351900575c29f868e779a046e98d803ac73c /ld
parent6536577167960d0d98ee5d0ccbb3ba70c2db2f9a (diff)
downloadgdb-15407e7e0d42a46de5534df22eec933fc45178a3.zip
gdb-15407e7e0d42a46de5534df22eec933fc45178a3.tar.gz
gdb-15407e7e0d42a46de5534df22eec933fc45178a3.tar.bz2
DWARF LTO debug sections vs. .stabstr
The exception for debug sections in clearing SEC_EXCLUDE when relocatable was really for one specific debug section, so let's make it do just that. bfd/ PR 27590 * elf.c (_bfd_elf_make_section_from_shdr): Remove SHF_EXCLUDE test for .gnu.debuglto*. ld/ PR 27590 * ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable for all sections except .stabstr.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8489a9d..0be65fc 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2021-03-20 Alan Modra <amodra@gmail.com>
+
+ PR 27590
+ * ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable
+ for all sections except .stabstr.
+
2021-03-19 Alan Modra <amodra@gmail.com>
PR 27590
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 684e1d2..df8a5d1 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7565,7 +7565,7 @@ lang_gc_sections (void)
lang_gc_sections_1 (statement_list.head);
/* SEC_EXCLUDE is ignored when doing a relocatable link, except in
- the special case of debug info. (See bfd/stabs.c)
+ the special case of .stabstr debug info. (See bfd/stabs.c)
Twiddle the flag here, to simplify later linker code. */
if (bfd_link_relocatable (&link_info))
{
@@ -7577,7 +7577,8 @@ lang_gc_sections (void)
continue;
#endif
for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
- if ((sec->flags & SEC_DEBUGGING) == 0)
+ if ((sec->flags & SEC_DEBUGGING) == 0
+ || strcmp (sec->name, ".stabstr") != 0)
sec->flags &= ~SEC_EXCLUDE;
}
}