When --gc-sections is enabled, unused compile units will be removed
from the output but their debug info will be kept, with their starting
addresses set to 0 to indicate they are garbages. This causes symbolizer
and addr2line to fail when a large garbage DWARF unit overlaps with the
actual code.
Details
Details
- Reviewers
phosek
Diff Detail
Diff Detail
Event Timeline
Comment Actions
More context is in https://fxbug.dev/112674. I've validated that the change fixed the behavior of llvm-symbolizer and llvm-addr2line.
I tried to create a test case for this but it's really awkward to write DWARF bytes to generate debug info. I could try again if it's considered necessary.
Comment Actions
Can you add a case to llvm/test/DebugInfo/X86/dwarfdump-debug-aranges.s perhaps? A functional change like this really does need a test.
Comment Actions
This patch actually breaks the existing test cases on symbolizer, because those test cases are based on object files rather than final binaries, and in object files ranges are started with 0.