Skip to content

Commit 7bdf787

Browse files
committed
[llvm/dwarfdump] Use the architecture string to filter.
Currently dwarfdump uses the ArchType to filter out architectures, which is problematic for architectures like arm64e and x86_64h that map back to arm64 and x86_64 respectively. The result is that the filter doesn't work for these architectures because it matches all the variants. This is especially bad because usually these architectures are the reason to use the filter in the first place. Instead, we should match the architecture based on the string name. This means the filter works for the values printed by dwarfdump. It has the unfortunate side effect of not working for aliases, like AArch64, but I think that's worth the trade-off. rdar://53653014 Differential revision: https://reviews.llvm.org/D71230 (cherry picked from commit d946665)
1 parent 497562d commit 7bdf787

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; RUN: llc -O0 %s -filetype=obj -o %t.o
22
; RUN: llvm-dwarfdump -arch arm64 %t.o | FileCheck %s
3-
; RUN: llvm-dwarfdump -arch aarch64 %t.o | FileCheck %s
43
; RUN: llvm-dwarfdump -arch 0x0100000c %t.o | FileCheck %s
54
; CHECK: file format Mach-O arm64
65
;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Make sure that passing --arch armv7s only shows the armv7s slice and not the armv7 slice.
2+
3+
RUN: llvm-dwarfdump -arch armv7s %S/../dsymutil/Inputs/fat-test.arm.dylib | FileCheck %s
4+
CHECK-NOT: (armv7)

llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static bool filterArch(ObjectFile &Obj) {
271271
return true;
272272

273273
// Match as name.
274-
if (MachO->getArchTriple().getArch() == Triple(Arch).getArch())
274+
if (MachO->getArchTriple().getArchName() == Triple(Arch).getArchName())
275275
return true;
276276
}
277277
}

0 commit comments

Comments
 (0)