summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2021-04-15 04:49:59 -0400
committerFrank Ch. Eigler <fche@redhat.com>2021-04-15 07:21:24 -0400
commit2a849629a03ff45422649ebbdb6e5cfcf3061bf6 (patch)
treeaf8c05ed2fa71d590a29cd75ad144fe1b4d44a5c
parent879513aba0b765c5552fc371c7fc55df4135661e (diff)
downloadelfutils-2a849629a03ff45422649ebbdb6e5cfcf3061bf6.tar.gz
debuginfod: Recognize .debug_*-less symtab-laden files as debuginfo
Borrow logic from elfclassify for is_debug_only() for our own debuginfo identification. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod.cxx19
2 files changed, 24 insertions, 0 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index c98a8374..3bd2ff60 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-15 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod.cxx (elf_classify): Recognize symtab-only stripped files
+ like fedora's libicudata as debuginfo files.
+
2021-03-30 Frank Ch. Eigler <fche@redhat.com>
* debuginfod.cxx (main): Set child thread names.
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 473511ea..2d73a136 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -2255,6 +2255,8 @@ elf_classify (int fd, bool &executable_p, bool &debuginfo_p, string &buildid, se
throw elfutils_exception(rc, "getshdrstrndx");
Elf_Scn *scn = NULL;
+ bool symtab_p = false;
+ bool bits_alloc_p = false;
while (true)
{
scn = elf_nextscn (elf, scn);
@@ -2280,7 +2282,24 @@ elf_classify (int fd, bool &executable_p, bool &debuginfo_p, string &buildid, se
debuginfo_p = true;
// NB: don't break; need to parse .debug_line for sources
}
+ else if (shdr->sh_type == SHT_SYMTAB)
+ {
+ symtab_p = true;
+ }
+ else if (shdr->sh_type != SHT_NOBITS
+ && shdr->sh_type != SHT_NOTE
+ && (shdr->sh_flags & SHF_ALLOC) != 0)
+ {
+ bits_alloc_p = true;
+ }
}
+
+ // For more expansive elf/split-debuginfo classification, we
+ // want to identify as debuginfo "strip -s"-produced files
+ // without .debug_info* (like libicudata), but we don't want to
+ // identify "strip -g" executables (with .symtab left there).
+ if (symtab_p && !bits_alloc_p)
+ debuginfo_p = true;
}
catch (const reportable_exception& e)
{