[PATCH] D79536: [dsymutil] Avoid relocating DW_AT_call_pc twice
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 18:12:32 PDT 2020
vsk created this revision.
vsk added reviewers: friss, JDevlieghere.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Avoid relocating DW_AT_call_pc, e.g. when a call PC is equal to the
function's low_pc as is the case in the test:
__Z5func1v:
0000000100007f94 b __Z5func2v
rdar://62952440
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79536
Files:
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/test/tools/dsymutil/ARM/call-pc-reloc.test
llvm/test/tools/dsymutil/Inputs/private/tmp/call_pc/main.arm64
llvm/test/tools/dsymutil/Inputs/private/tmp/call_pc/main.arm64.o
Index: llvm/test/tools/dsymutil/ARM/call-pc-reloc.test
===================================================================
--- /dev/null
+++ llvm/test/tools/dsymutil/ARM/call-pc-reloc.test
@@ -0,0 +1,20 @@
+Instructions to reproduce
+-------------------------
+
+$ cat main.cpp
+void __attribute__((optnone)) func2() {}
+void __attribute__((noinline)) func1() { func2(); /* tail */ }
+int __attribute__((disable_tail_calls)) main() {
+ func1(); /* regular */
+ return 0;
+}
+
+# Adding `-isysroot $(xcrun -sdk iphoneos.internal -show-sdk-path)` can fix
+# linker warnings when building on macOS.
+$ clang -arch arm64 main.cpp -o main.arm64.o -c -g -O2
+$ clang -arch arm64 main.arm64.o -o main.arm64 -g
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/call_pc/main.arm64 -o %t.dSYM
+RUN: llvm-dwarfdump %t.dSYM | FileCheck %s -implicit-check-not=DW_AT_call_pc
+
+CHECK: DW_AT_call_pc (0x0000000100007f94)
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1327,6 +1327,8 @@
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);
}
// Reset the Offset to 0 as we will be working on the local copy of
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79536.262515.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200507/028ccbf9/attachment.bin>
More information about the llvm-commits
mailing list