llvm.org GIT mirror llvm / fcf59db
llvm-dwarfdump: Support alternative architecture names in the -arch filter <rdar://problem/47918606> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357706 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 6 months ago
3 changed file(s) with 30 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llc -O0 %s -filetype=obj -o %t.o
1 ; RUN: llvm-dwarfdump -arch arm64 %t.o | FileCheck %s
2 ; RUN: llvm-dwarfdump -arch aarch64 %t.o | FileCheck %s
3 ; RUN: llvm-dwarfdump -arch 0x0100000c %t.o | FileCheck %s
4 ; CHECK: file format Mach-O arm64
5 ;
6 ; RUN: llvm-dwarfdump -arch i386 %t.o \
7 ; RUN: | FileCheck %s --allow-empty --check-prefix=NEGATIVE
8 ; RUN: llvm-dwarfdump -arch 0 %t.o \
9 ; RUN: | FileCheck %s --allow-empty --check-prefix=NEGATIVE
10 ; NEGATIVE-NOT: file format
11 source_filename = "/tmp/empty.c"
12 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
13 target triple = "arm64-apple-ios"
14
15 !llvm.module.flags = !{!1, !2, !3, !4}
16 !llvm.dbg.cu = !{!5}
17
18 !1 = !{i32 2, !"Dwarf Version", i32 4}
19 !2 = !{i32 2, !"Debug Info Version", i32 3}
20 !3 = !{i32 1, !"wchar_size", i32 4}
21 !4 = !{i32 7, !"PIC Level", i32 2}
22 !5 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, producer: "Apple clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
23 !6 = !DIFile(filename: "/tmp/empty.c", directory: "/Volumes/Data/llvm-project")
0 if not 'AArch64' in config.root.targets:
1 config.unsupported = True
257257 return true;
258258
259259 if (auto *MachO = dyn_cast(&Obj)) {
260 std::string ObjArch =
261 Triple::getArchTypeName(MachO->getArchTriple().getArch());
262
263260 for (auto Arch : ArchFilters) {
264 // Match name.
265 if (Arch == ObjArch)
266 return true;
267
268261 // Match architecture number.
269262 unsigned Value;
270263 if (!StringRef(Arch).getAsInteger(0, Value))
271264 if (Value == getCPUType(*MachO))
272265 return true;
266
267 // Match as name.
268 if (MachO->getArchTriple().getArch() == Triple(Arch).getArch())
269 return true;
273270 }
274271 }
275272 return false;