[PATCH] D43439: [dsymutil] Skip DW_AT_sibling attributes.
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 07:39:33 PST 2018
JDevlieghere updated this revision to Diff 136079.
JDevlieghere added a comment.
Herald added a subscriber: nemanjai.
Forget what I said before, I had misread part of the code and the other test only succeeded accidentally.
Added proper test (indeed, it fails without this change)
Thanks Adrian for compiling this!
https://reviews.llvm.org/D43439
Files:
llvm/test/tools/dsymutil/Inputs/sibling.o
llvm/test/tools/dsymutil/PowerPC/sibling.test
llvm/tools/dsymutil/DwarfLinker.cpp
Index: llvm/tools/dsymutil/DwarfLinker.cpp
===================================================================
--- llvm/tools/dsymutil/DwarfLinker.cpp
+++ llvm/tools/dsymutil/DwarfLinker.cpp
@@ -2591,7 +2591,8 @@
for (const auto &AttrSpec : Abbrev->attributes()) {
DWARFFormValue Val(AttrSpec.Form);
- if (!Val.isFormClass(DWARFFormValue::FC_Reference)) {
+ if (!Val.isFormClass(DWARFFormValue::FC_Reference) ||
+ AttrSpec.Attr == dwarf::DW_AT_sibling) {
DWARFFormValue::skipValue(AttrSpec.Form, Data, &Offset,
Unit.getFormParams());
continue;
@@ -2767,7 +2768,7 @@
resolveDIEReference(Linker, CompileUnits, Val, U, InputDIE, RefUnit);
// If the referenced DIE is not found, drop the attribute.
- if (!RefDie)
+ if (!RefDie || AttrSpec.Attr == dwarf::DW_AT_sibling)
return 0;
unsigned Idx = RefUnit->getOrigUnit().getDIEIndex(RefDie);
Index: llvm/test/tools/dsymutil/PowerPC/sibling.test
===================================================================
--- llvm/test/tools/dsymutil/PowerPC/sibling.test
+++ llvm/test/tools/dsymutil/PowerPC/sibling.test
@@ -1,20 +1,30 @@
# Verify that we don't follow DW_AT_sibling references.
#
# Source:
-# struct A { int a; } a;
-# struct B { int b; } b;
+# struct A { };
+# struct B { };
+#
+# struct C {
+# A a;
+# };
+#
+# B b;
+# C c;
# RUN: llvm-dsymutil -arch ppc -f -oso-prepend-path=%p/../Inputs/ -y %s -o - | llvm-dwarfdump -debug-info - | FileCheck %s
-# CHECK: DW_TAG_variable
-# CHECK-NEXT: DW_AT_name ("a")
-# CHECK-NOT: DW_AT_name ("b")
+# CHECK: DW_TAG_structure_type
+# CHECK-NEXT: DW_AT_name ("A")
+# CHECK: DW_TAG_structure_type
+# CHECK-NEXT: DW_AT_name ("C")
+
+# CHECK-NOT: DW_AT_name ("B")
---
triple: 'ppc-apple-darwin'
objects:
- filename: sibling.o
timestamp: 1518197670
symbols:
- - { sym: _a, objAddr: 0x00000000000000cb, binAddr: 0x0000000100000FA0, size: 0x00000010 }
+ - { sym: _c, objAddr: 0x000000000000017e, binAddr: 0x0000000100000FA0, size: 0x00000010 }
...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43439.136079.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180227/c58174a1/attachment.bin>
More information about the llvm-commits
mailing list