[PATCH] D60240: llvm-dwarfdump: Support alternative architecture names in the -arch filter
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 17:15:23 PDT 2019
aprantl created this revision.
aprantl added reviewers: JDevlieghere, jasonmolenda.
Herald added a subscriber: javed.absar.
Herald added a project: LLVM.
rdar://problem/47918606
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60240
Files:
llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
llvm/test/tools/llvm-dwarfdump/AArch64/lit.local.cfg
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -258,19 +258,16 @@
return true;
if (auto *MachO = dyn_cast<MachOObjectFile>(&Obj)) {
- std::string ObjArch =
- Triple::getArchTypeName(MachO->getArchTriple().getArch());
-
for (auto Arch : ArchFilters) {
- // Match name.
- if (Arch == ObjArch)
- return true;
-
// Match architecture number.
unsigned Value;
if (!StringRef(Arch).getAsInteger(0, Value))
if (Value == getCPUType(*MachO))
return true;
+
+ // Match as name.
+ if (MachO->getArchTriple().getArch() == Triple(Arch).getArch())
+ return true;
}
}
return false;
Index: llvm/test/tools/llvm-dwarfdump/AArch64/lit.local.cfg
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwarfdump/AArch64/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'AArch64' in config.root.targets:
+ config.unsupported = True
Index: llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
@@ -0,0 +1,24 @@
+; RUN: llc -O0 %s -filetype=obj -o %t.o
+; RUN: llvm-dwarfdump -arch arm64 %t.o | FileCheck %s
+; RUN: llvm-dwarfdump -arch aarch64 %t.o | FileCheck %s
+; RUN: llvm-dwarfdump -arch 0x0100000c %t.o | FileCheck %s
+; CHECK: file format Mach-O arm64
+;
+; RUN: llvm-dwarfdump -arch i386 %t.o \
+; RUN: | FileCheck %s --allow-empty --check-prefix=NEGATIVE
+; RUN: llvm-dwarfdump -arch 0 %t.o \
+; RUN: | FileCheck %s --allow-empty --check-prefix=NEGATIVE
+; NEGATIVE-NOT: file format
+source_filename = "/tmp/empty.c"
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "arm64-apple-ios"
+
+!llvm.module.flags = !{!1, !2, !3, !4}
+!llvm.dbg.cu = !{!5}
+
+!1 = !{i32 2, !"Dwarf Version", i32 4}
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = !{i32 1, !"wchar_size", i32 4}
+!4 = !{i32 7, !"PIC Level", i32 2}
+!5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "Apple clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
+!6 = !DIFile(filename: "/tmp/empty.c", directory: "/Volumes/Data/llvm-project")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60240.193631.patch
Type: text/x-patch
Size: 2415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190404/8a073cde/attachment.bin>
More information about the llvm-commits
mailing list