diff options
author | Frank Ch. Eigler <fche@redhat.com> | 2021-04-15 04:49:59 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@redhat.com> | 2021-04-15 07:21:24 -0400 |
commit | 2a849629a03ff45422649ebbdb6e5cfcf3061bf6 (patch) | |
tree | af8c05ed2fa71d590a29cd75ad144fe1b4d44a5c /debuginfod/debuginfod.cxx | |
parent | 879513aba0b765c5552fc371c7fc55df4135661e (diff) | |
download | elfutils-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>
Diffstat (limited to 'debuginfod/debuginfod.cxx')
-rw-r--r-- | debuginfod/debuginfod.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
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) { |