[PATCH] D81014: Add legacy GNU entry value support to dsymutil
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 2 09:52:48 PDT 2020
aprantl created this revision.
aprantl added reviewers: vsk, labath.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a reviewer: JDevlieghere.
Herald added a project: LLVM.
Here is a blind attempt to make the legacy GNU attributes work in dsymutil — however it doesn't actually work yet. Since it's not perfectly clear to me how the GNU attributes map to the standardized version, help is appreciated!
https://reviews.llvm.org/D81014
Files:
llvm/lib/DWARFLinker/DWARFLinker.cpp
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1070,15 +1070,19 @@
// it. Otherwise (when no relocations where applied) just use the
// one we just decoded.
Addr = (Info.OrigHighPc ? Info.OrigHighPc : Addr) + Info.PCOffset;
- } else if (AttrSpec.Attr == dwarf::DW_AT_call_return_pc) {
+ } else if ((AttrSpec.Attr == dwarf::DW_AT_call_return_pc &&
+ Die.getTag() == dwarf::DW_TAG_call_site) ||
+ (AttrSpec.Attr == dwarf::DW_AT_low_pc &&
+ Die.getTag() == dwarf::DW_TAG_GNU_call_site)) {
// Relocate a return PC address within a call site entry.
- if (Die.getTag() == dwarf::DW_TAG_call_site)
- Addr = (Info.OrigCallReturnPc ? Info.OrigCallReturnPc : Addr) +
- Info.PCOffset;
- } else if (AttrSpec.Attr == dwarf::DW_AT_call_pc) {
+ Addr =
+ (Info.OrigCallReturnPc ? Info.OrigCallReturnPc : Addr) + Info.PCOffset;
+ } else if ((AttrSpec.Attr == dwarf::DW_AT_call_pc &&
+ Die.getTag() == dwarf::DW_TAG_call_site) ||
+ (AttrSpec.Attr == dwarf::DW_AT_low_pc &&
+ Die.getTag() == dwarf::DW_TAG_GNU_call_site)) {
// Relocate the address of a branch instruction within a call site entry.
- if (Die.getTag() == dwarf::DW_TAG_call_site)
- Addr = (Info.OrigCallPc ? Info.OrigCallPc : Addr) + Info.PCOffset;
+ Addr = (Info.OrigCallPc ? Info.OrigCallPc : Addr) + Info.PCOffset;
}
Die.addValue(DIEAlloc, static_cast<dwarf::Attribute>(AttrSpec.Attr),
@@ -1343,10 +1347,10 @@
// inlining function.
AttrInfo.OrigLowPc = dwarf::toAddress(InputDIE.find(dwarf::DW_AT_low_pc),
std::numeric_limits<uint64_t>::max());
- AttrInfo.OrigCallReturnPc =
- dwarf::toAddress(InputDIE.find(dwarf::DW_AT_call_return_pc), 0);
- AttrInfo.OrigCallPc =
- dwarf::toAddress(InputDIE.find(dwarf::DW_AT_call_pc), 0);
+ AttrInfo.OrigCallReturnPc = dwarf::toAddress(
+ InputDIE.find({dwarf::DW_AT_call_return_pc, dwarf::DW_AT_low_pc}), 0);
+ AttrInfo.OrigCallPc = dwarf::toAddress(
+ InputDIE.find({dwarf::DW_AT_call_pc, dwarf::DW_AT_low_pc}), 0);
}
// Reset the Offset to 0 as we will be working on the local copy of
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81014.267911.patch
Type: text/x-patch
Size: 2386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200602/9d85c04e/attachment.bin>
More information about the llvm-commits
mailing list