This is an archive of the discontinued LLVM Phabricator instance.

DWARFDebugLoclists: Make it possible to read relocated addresses
ClosedPublic

Authored by labath on Oct 1 2019, 7:25 AM.

Details

Summary

Handling relocations was not needed when the loclists section was a
DWO-only thing. But since DWARF5, it is possible to use it in regular
objects too, and the standard permits embedding addresses into the
section directly. These addresses need to be relocated in unlinked
files.

Diff Detail

Event Timeline

labath created this revision.Oct 1 2019, 7:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2019, 7:26 AM
Herald added a subscriber: aprantl. · View Herald Transcript
dblaikie accepted this revision.Oct 1 2019, 7:50 AM

Looks good - thanks! Yeah, I had a few pieces somewhat like this in half-completed states along with the DWARFv4 loclist base address specifier change I committed recently (which I guess might've been related to your motivation here, or not)

This revision is now accepted and ready to land.Oct 1 2019, 7:50 AM
labath updated this revision to Diff 227276.Oct 31 2019, 6:32 AM

Rebase and make independent of D68270 (that is going to take a while).

dblaikie added inline comments.Oct 31 2019, 2:00 PM
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
124–127

Is this written with a lambda because DWARFDataExtractor isn't assignable? Perhaps it should/could be made assignable?

llvm/test/tools/llvm-dwarfdump/X86/debug_loclists.s
12–13

Could you include the source & commands used to build this assembly for reference?

SouraVX added a subscriber: SouraVX.Nov 3 2019, 8:40 AM
labath marked 2 inline comments as done.Nov 4 2019, 9:50 AM
labath added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
124–127

It's not default-constructible (which I normally consider to be a good thing) so I had to initialize it in a single statement. That said, I have no idea why I ended up with a lambda here -- a plain ternary operator would work just fine. Using ?: now.

llvm/test/tools/llvm-dwarfdump/X86/debug_loclists.s
12–13

There isn't a "source", really. I was just adding a bunch of interesting location list entries by hand. (TBE, I did use some source to produce the minimal debug_info blurb needed to be able to print out, but I don't know what it was, and it has been mangled/reduced beyond recognition anyway.)

labath updated this revision to Diff 227731.Nov 4 2019, 9:51 AM

Use ternary expression.

This revision was automatically updated to reflect the committed changes.