xref: /llvm-project/llvm/test/tools/llvm-readobj/MachO/file-headers.test (revision dbf520f617440d62ca46f64cdc41159945911902)
1*dbf520f6SGeorgii Rymar# RUN: yaml2obj %s --docnum=1 -o %t.i386
2*dbf520f6SGeorgii Rymar# RUN: llvm-readobj -h %t.i386 \
3*dbf520f6SGeorgii Rymar# RUN:  | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386
4*dbf520f6SGeorgii Rymar
5*dbf520f6SGeorgii Rymar#      I386:File: [[FILE]]
6*dbf520f6SGeorgii Rymar# I386-NEXT:Format: Mach-O 32-bit i386
7*dbf520f6SGeorgii Rymar# I386-NEXT:Arch: i386
8*dbf520f6SGeorgii Rymar# I386-NEXT:AddressSize: 32bit
9*dbf520f6SGeorgii Rymar# I386-NEXT:MachHeader {
10*dbf520f6SGeorgii Rymar# I386-NEXT:  Magic: Magic (0xFEEDFACE)
11*dbf520f6SGeorgii Rymar# I386-NEXT:  CpuType: X86 (0x7)
12*dbf520f6SGeorgii Rymar# I386-NEXT:  CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
13*dbf520f6SGeorgii Rymar# I386-NEXT:  FileType: Relocatable (0x1)
14*dbf520f6SGeorgii Rymar# I386-NEXT:  NumOfLoadCommands: 0
15*dbf520f6SGeorgii Rymar# I386-NEXT:  SizeOfLoadCommands: 0
16*dbf520f6SGeorgii Rymar# I386-NEXT:  Flags [ (0x2000)
17*dbf520f6SGeorgii Rymar# I386-NEXT:    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
18*dbf520f6SGeorgii Rymar# I386-NEXT:  ]
19*dbf520f6SGeorgii Rymar# I386-NEXT:}
20*dbf520f6SGeorgii Rymar# I386-NOT:{{.}}
21*dbf520f6SGeorgii Rymar
22*dbf520f6SGeorgii Rymar--- !mach-o
23*dbf520f6SGeorgii RymarFileHeader:
24*dbf520f6SGeorgii Rymar  magic:      0xFEEDFACE
25*dbf520f6SGeorgii Rymar  cputype:    0x00000007
26*dbf520f6SGeorgii Rymar  cpusubtype: 0x00000003
27*dbf520f6SGeorgii Rymar  filetype:   0x00000001
28*dbf520f6SGeorgii Rymar  ncmds:      0
29*dbf520f6SGeorgii Rymar  sizeofcmds: 0
30*dbf520f6SGeorgii Rymar  flags:      0x00002000
31*dbf520f6SGeorgii Rymar
32*dbf520f6SGeorgii Rymar# RUN: yaml2obj %s --docnum=2 -o %t.x86-64
33*dbf520f6SGeorgii Rymar# RUN: llvm-readobj -h %t.x86-64 \
34*dbf520f6SGeorgii Rymar# RUN:  | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.x86-64 --check-prefix X86-64
35*dbf520f6SGeorgii Rymar
36*dbf520f6SGeorgii Rymar#      X86-64:File: [[FILE]]
37*dbf520f6SGeorgii Rymar# X86-64-NEXT:Format: Mach-O 64-bit x86-64
38*dbf520f6SGeorgii Rymar# X86-64-NEXT:Arch: x86_64
39*dbf520f6SGeorgii Rymar# X86-64-NEXT:AddressSize: 64bit
40*dbf520f6SGeorgii Rymar# X86-64-NEXT:MachHeader {
41*dbf520f6SGeorgii Rymar# X86-64-NEXT:  Magic: Magic64 (0xFEEDFACF)
42*dbf520f6SGeorgii Rymar# X86-64-NEXT:  CpuType: X86-64 (0x1000007)
43*dbf520f6SGeorgii Rymar# X86-64-NEXT:  CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
44*dbf520f6SGeorgii Rymar# X86-64-NEXT:  FileType: Relocatable (0x1)
45*dbf520f6SGeorgii Rymar# X86-64-NEXT:  NumOfLoadCommands: 0
46*dbf520f6SGeorgii Rymar# X86-64-NEXT:  SizeOfLoadCommands: 0
47*dbf520f6SGeorgii Rymar# X86-64-NEXT:  Flags [ (0x2000)
48*dbf520f6SGeorgii Rymar# X86-64-NEXT:    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
49*dbf520f6SGeorgii Rymar# X86-64-NEXT:  ]
50*dbf520f6SGeorgii Rymar# X86-64-NEXT:  Reserved: 0x0
51*dbf520f6SGeorgii Rymar# X86-64-NEXT:}
52*dbf520f6SGeorgii Rymar# X86-64-NOT:{{.}}
53*dbf520f6SGeorgii Rymar
54*dbf520f6SGeorgii Rymar--- !mach-o
55*dbf520f6SGeorgii RymarFileHeader:
56*dbf520f6SGeorgii Rymar  magic:      0xFEEDFACF
57*dbf520f6SGeorgii Rymar  cputype:    0x01000007
58*dbf520f6SGeorgii Rymar  cpusubtype: 0x00000003
59*dbf520f6SGeorgii Rymar  filetype:   0x00000001
60*dbf520f6SGeorgii Rymar  ncmds:      0
61*dbf520f6SGeorgii Rymar  sizeofcmds: 0
62*dbf520f6SGeorgii Rymar  flags:      0x00002000
63*dbf520f6SGeorgii Rymar  reserved:   0x00000000
64*dbf520f6SGeorgii Rymar
65*dbf520f6SGeorgii Rymar# RUN: yaml2obj %s --docnum=3 -o %t.ppc
66*dbf520f6SGeorgii Rymar# RUN: llvm-readobj -h %t.ppc \
67*dbf520f6SGeorgii Rymar# RUN:  | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.ppc --check-prefix PPC
68*dbf520f6SGeorgii Rymar
69*dbf520f6SGeorgii Rymar#      PPC:File: [[FILE]]
70*dbf520f6SGeorgii Rymar# PPC-NEXT:Format: Mach-O 32-bit ppc
71*dbf520f6SGeorgii Rymar# PPC-NEXT:Arch: powerpc
72*dbf520f6SGeorgii Rymar# PPC-NEXT:AddressSize: 32bit
73*dbf520f6SGeorgii Rymar# PPC-NEXT:MachHeader {
74*dbf520f6SGeorgii Rymar# PPC-NEXT:  Magic: Magic (0xFEEDFACE)
75*dbf520f6SGeorgii Rymar# PPC-NEXT:  CpuType: PowerPC (0x12)
76*dbf520f6SGeorgii Rymar# PPC-NEXT:  CpuSubType: CPU_SUBTYPE_POWERPC_ALL (0x0)
77*dbf520f6SGeorgii Rymar# PPC-NEXT:  FileType: Relocatable (0x1)
78*dbf520f6SGeorgii Rymar# PPC-NEXT:  NumOfLoadCommands: 0
79*dbf520f6SGeorgii Rymar# PPC-NEXT:  SizeOfLoadCommands: 0
80*dbf520f6SGeorgii Rymar# PPC-NEXT:  Flags [ (0x2000)
81*dbf520f6SGeorgii Rymar# PPC-NEXT:    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
82*dbf520f6SGeorgii Rymar# PPC-NEXT:  ]
83*dbf520f6SGeorgii Rymar# PPC-NEXT:}
84*dbf520f6SGeorgii Rymar# PPC-NOT:{{.}}
85*dbf520f6SGeorgii Rymar
86*dbf520f6SGeorgii Rymar--- !mach-o
87*dbf520f6SGeorgii RymarIsLittleEndian: false
88*dbf520f6SGeorgii RymarFileHeader:
89*dbf520f6SGeorgii Rymar  magic:      0xFEEDFACE
90*dbf520f6SGeorgii Rymar  cputype:    0x00000012
91*dbf520f6SGeorgii Rymar  cpusubtype: 0x00000000
92*dbf520f6SGeorgii Rymar  filetype:   0x00000001
93*dbf520f6SGeorgii Rymar  ncmds:      0
94*dbf520f6SGeorgii Rymar  sizeofcmds: 0
95*dbf520f6SGeorgii Rymar  flags:      0x00002000
96*dbf520f6SGeorgii Rymar
97*dbf520f6SGeorgii Rymar# RUN: yaml2obj %s --docnum=4 -o %t.ppc64
98*dbf520f6SGeorgii Rymar# RUN: llvm-readobj -h %t.ppc64 \
99*dbf520f6SGeorgii Rymar# RUN:  | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.ppc64 --check-prefix PPC64
100*dbf520f6SGeorgii Rymar
101*dbf520f6SGeorgii Rymar#      PPC64:File: [[FILE]]
102*dbf520f6SGeorgii Rymar# PPC64-NEXT:Format: Mach-O 64-bit ppc64
103*dbf520f6SGeorgii Rymar# PPC64-NEXT:Arch: powerpc64
104*dbf520f6SGeorgii Rymar# PPC64-NEXT:AddressSize: 64bit
105*dbf520f6SGeorgii Rymar# PPC64-NEXT:MachHeader {
106*dbf520f6SGeorgii Rymar# PPC64-NEXT:  Magic: Magic64 (0xFEEDFACF)
107*dbf520f6SGeorgii Rymar# PPC64-NEXT:  CpuType: PowerPC64 (0x1000012)
108*dbf520f6SGeorgii Rymar# PPC64-NEXT:  CpuSubtype: 0x0
109*dbf520f6SGeorgii Rymar# PPC64-NEXT:  FileType: Relocatable (0x1)
110*dbf520f6SGeorgii Rymar# PPC64-NEXT:  NumOfLoadCommands: 0
111*dbf520f6SGeorgii Rymar# PPC64-NEXT:  SizeOfLoadCommands: 0
112*dbf520f6SGeorgii Rymar# PPC64-NEXT:  Flags [ (0x2000)
113*dbf520f6SGeorgii Rymar# PPC64-NEXT:    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
114*dbf520f6SGeorgii Rymar# PPC64-NEXT:  ]
115*dbf520f6SGeorgii Rymar# PPC64-NEXT:  Reserved: 0x0
116*dbf520f6SGeorgii Rymar# PPC64-NEXT:}
117*dbf520f6SGeorgii Rymar# PPC64-NOT:{{.}}
118*dbf520f6SGeorgii Rymar
119*dbf520f6SGeorgii Rymar--- !mach-o
120*dbf520f6SGeorgii RymarIsLittleEndian: false
121*dbf520f6SGeorgii RymarFileHeader:
122*dbf520f6SGeorgii Rymar  magic:      0xFEEDFACF
123*dbf520f6SGeorgii Rymar  cputype:    0x01000012
124*dbf520f6SGeorgii Rymar  cpusubtype: 0x00000000
125*dbf520f6SGeorgii Rymar  filetype:   0x00000001
126*dbf520f6SGeorgii Rymar  ncmds:      0
127*dbf520f6SGeorgii Rymar  sizeofcmds: 0
128*dbf520f6SGeorgii Rymar  flags:      0x00002000
129*dbf520f6SGeorgii Rymar  reserved:   0x00000000
130*dbf520f6SGeorgii Rymar
131*dbf520f6SGeorgii Rymar# RUN: yaml2obj %s --docnum=5 -o %t.arm
132*dbf520f6SGeorgii Rymar# RUN: llvm-readobj -h %t.arm \
133*dbf520f6SGeorgii Rymar# RUN:  | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm --check-prefix ARM
134*dbf520f6SGeorgii Rymar
135*dbf520f6SGeorgii Rymar#      ARM:File: [[FILE]]
136*dbf520f6SGeorgii Rymar# ARM-NEXT:Format: Mach-O arm
137*dbf520f6SGeorgii Rymar# ARM-NEXT:Arch: arm
138*dbf520f6SGeorgii Rymar# ARM-NEXT:AddressSize: 32bit
139*dbf520f6SGeorgii Rymar# ARM-NEXT:MachHeader {
140*dbf520f6SGeorgii Rymar# ARM-NEXT:  Magic: Magic (0xFEEDFACE)
141*dbf520f6SGeorgii Rymar# ARM-NEXT:  CpuType: Arm (0xC)
142*dbf520f6SGeorgii Rymar# ARM-NEXT:  CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
143*dbf520f6SGeorgii Rymar# ARM-NEXT:  FileType: Relocatable (0x1)
144*dbf520f6SGeorgii Rymar# ARM-NEXT:  NumOfLoadCommands: 0
145*dbf520f6SGeorgii Rymar# ARM-NEXT:  SizeOfLoadCommands: 0
146*dbf520f6SGeorgii Rymar# ARM-NEXT:  Flags [ (0x2000)
147*dbf520f6SGeorgii Rymar# ARM-NEXT:    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
148*dbf520f6SGeorgii Rymar# ARM-NEXT:  ]
149*dbf520f6SGeorgii Rymar# ARM-NEXT:}
150*dbf520f6SGeorgii Rymar# ARM-NOT:{{.}}
151*dbf520f6SGeorgii Rymar
152*dbf520f6SGeorgii Rymar--- !mach-o
153*dbf520f6SGeorgii RymarFileHeader:
154*dbf520f6SGeorgii Rymar  magic:      0xFEEDFACE
155*dbf520f6SGeorgii Rymar  cputype:    0x0000000C
156*dbf520f6SGeorgii Rymar  cpusubtype: 0x00000009
157*dbf520f6SGeorgii Rymar  filetype:   0x00000001
158*dbf520f6SGeorgii Rymar  ncmds:      0
159*dbf520f6SGeorgii Rymar  sizeofcmds: 0
160*dbf520f6SGeorgii Rymar  flags:      0x00002000
161