[PATCH] D86539: [Debuginfo][llvm-dwarfutil] llvm-dwarfutil dsymutil-like tool for ELF.
Greg Clayton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 15:13:36 PDT 2022
clayborg added a comment.
This patch currently relies on tombstone values for GC'ing debug info for functions and data, but I wanted to check if we can do this differently which might make it more reliable. Currently if we rely on tombstone values, then we might end up missing relocations that have a non-zero addend where the base address is the tombstone value. The way that llvm-gsymutil (GSYM symbol format that can convert DWARF into GSYM) does it is to check for all executable section ranges and only accept any DW_TAG_subprogram values form these ranges. The code is from llvm-gsymutil.cpp and looks like:
// We need to know where the valid sections are that contain instructions.
// See header documentation for DWARFTransformer::SetValidTextRanges() for
// defails.
AddressRanges TextRanges;
for (const object::SectionRef &Sect : Obj.sections()) {
if (!Sect.isText())
continue;
const uint64_t Size = Sect.getSize();
if (Size == 0)
continue;
const uint64_t StartAddr = Sect.getAddress();
TextRanges.insert(AddressRange(StartAddr, StartAddr + Size));
}
Anytime we run into a DW_TAG_subprogram, we make sure the address range is fully contained in these ranges. This then allows for relocations with non-zero addends and allows the DW_AT_low_pc, or ranges form DW_AT_ranges to not always match the tombstone values. We could also do something similar for global variables.
I am very excited about this patch and going to run some tests on my local ELF binaries to see how this does, but very excited to see this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86539/new/
https://reviews.llvm.org/D86539
More information about the llvm-commits
mailing list