[PATCH] D99534: [dsymutil] Relocate DW_TAG_label
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 15:53:42 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe0577b3130a6: [dsymutil] Relocate DW_TAG_label (authored by JDevlieghere).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99534/new/
https://reviews.llvm.org/D99534
Files:
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.o
llvm/test/tools/dsymutil/Inputs/private/tmp/label/label.out
llvm/test/tools/dsymutil/X86/label2.test
Index: llvm/test/tools/dsymutil/X86/label2.test
===================================================================
--- /dev/null
+++ llvm/test/tools/dsymutil/X86/label2.test
@@ -0,0 +1,21 @@
+$ cat label.c
+int main(int argc, char **argv) {
+ if (argc) {
+ goto foobar;
+ }
+ return 1;
+foobar:
+ return 0;
+}
+
+$ clang -g label.c -c -o label.o
+$ clang label.o -o label.out
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/label/label.out -o %t.dSYM
+RUN: dwarfdump %t.dSYM | FileCheck %s
+
+CHECK: DW_TAG_label
+CHECK-NEXT: DW_AT_name ("foobar")
+CHECK-NEXT: DW_AT_decl_file ("/tmp/label/label.c")
+CHECK-NEXT: DW_AT_decl_line (6)
+CHECK-NEXT: DW_AT_low_pc (0x0000000100003f9d)
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1088,7 +1088,8 @@
if (AttrSpec.Attr == dwarf::DW_AT_low_pc) {
if (Die.getTag() == dwarf::DW_TAG_inlined_subroutine ||
- Die.getTag() == dwarf::DW_TAG_lexical_block)
+ Die.getTag() == dwarf::DW_TAG_lexical_block ||
+ Die.getTag() == dwarf::DW_TAG_label) {
// The low_pc of a block or inline subroutine might get
// relocated because it happens to match the low_pc of the
// enclosing subprogram. To prevent issues with that, always use
@@ -1097,7 +1098,7 @@
? Info.OrigLowPc
: Addr) +
Info.PCOffset;
- else if (Die.getTag() == dwarf::DW_TAG_compile_unit) {
+ } else if (Die.getTag() == dwarf::DW_TAG_compile_unit) {
Addr = Unit.getLowPc();
if (Addr == std::numeric_limits<uint64_t>::max())
return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99534.334008.patch
Type: text/x-patch
Size: 1784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/b8e306af/attachment.bin>
More information about the llvm-commits
mailing list