diff options
author | Mark Wielaard <mark@klomp.org> | 2020-04-17 11:31:40 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-04-22 00:02:20 +0200 |
commit | d6185d33fb2a65b4c3cbc73c5529937debdd2568 (patch) | |
tree | 28d5992daab9f7a6d631620ee542c39d090bbfe5 /src | |
parent | e2fc0b737c1d55becda1f13dceec315a5589820a (diff) | |
download | elfutils-d6185d33fb2a65b4c3cbc73c5529937debdd2568.tar.gz |
libdw, readelf: Handle GCC LTO .gnu.debuglto_ prefix.
GCC puts (partial) DWARF debuginfo into sections prefixed with
.gnu.debuglto_. Handle those sections as if they are normal .debug
sections (which they are). This allows showing the DWARF that gcc
puts into ET_REL files compiled with -flto.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/readelf.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dc345a04..83d58607 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2020-04-17 Mark Wielaard <mark@klomp.org> + + * readelf.c (print_debug): Check .gnu.debuglto_ prefix. + 2020-04-16 Mark Wielaard <mark@klomp.org> * elflint.c (check_sections): Mask out SHF_EXCLUDE from processor diff --git a/src/readelf.c b/src/readelf.c index cbb519d1..685d0b17 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -11253,7 +11253,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) if (strcmp (name, ".debug_info") == 0 || strcmp (name, ".debug_info.dwo") == 0 || strcmp (name, ".zdebug_info") == 0 - || strcmp (name, ".zdebug_info.dwo") == 0) + || strcmp (name, ".zdebug_info.dwo") == 0 + || strcmp (name, ".gnu.debuglto_.debug_info") == 0) { print_debug_info_section (dwflmod, ebl, ehdr, scn, shdr, dbg); @@ -11339,7 +11340,11 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) dbglen - 1) == 0 && (scnlen == dbglen + 1 || (scnlen == dbglen + 5 - && strstr (name, ".dwo") == name + dbglen + 1)))) + && strstr (name, ".dwo") == name + dbglen + 1))) + || (scnlen > 14 /* .gnu.debuglto_ prefix. */ + && strncmp (name, ".gnu.debuglto_", 14) == 0 + && strcmp (&name[14], debug_sections[n].name) == 0) +) { if ((print_debug_sections | implicit_debug_sections) & debug_sections[n].bitmask) |