Page MenuHomePhabricator

DWARF v5: emit DW_AT_addr_base if DW_AT_low_pc references .debug_addr
ClosedPublic

Authored by MaskRay on May 14 2019, 6:01 AM.

Details

Summary

The condition !AddrPool.empty() is tested before attachRangesOrLowHighPC(), which may add an entry to AddrPool. We emit DW_AT_low_pc (DW_FORM_addrx) but may incorrectly omit DW_AT_addr_base for LineTablesOnly. This can be easily reproduced:

clang -gdwarf-5 -gmlt -c a.cc

Fix this by moving !AddrPool.empty() below.

This was discovered while investigating an lld crash (fixed by D61889) on such object files: ld.lld --gdb-index a.o

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.May 14 2019, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2019, 6:01 AM
MaskRay retitled this revision from DWARF v5: emit DW_AT_addr_base for LineTablesOnly to DWARF v5: emit DW_AT_addr_base if DW_AT_low_pc references .debug_addr.May 14 2019, 6:04 AM
MaskRay edited the summary of this revision. (Show Details)
MaskRay updated this revision to Diff 199431.May 14 2019, 6:51 AM
MaskRay edited the summary of this revision. (Show Details)

Mention this can be easily reproduced by clang -gdwarf-5 -gmlt

probinson accepted this revision.May 14 2019, 7:03 AM
probinson added a subscriber: probinson.

LGTM once you rephrase the comment in the test.

test/DebugInfo/Generic/line-table-addrx.ll
3 ↗(On Diff #199431)

Comments should describe things as they exist with the patch, not how things used to be.

This revision is now accepted and ready to land.May 14 2019, 7:03 AM
MaskRay updated this revision to Diff 199439.May 14 2019, 7:33 AM

incorporate probinson's suggestion

This revision was automatically updated to reflect the committed changes.
ormris removed a subscriber: ormris.May 14 2019, 9:09 AM