1 # RUN: echo abcd > %t.txt
3 # RUN: llvm-objcopy -I binary -B aarch64 %t.txt %t.aarch64.o
4 # RUN: llvm-readobj --file-headers %t.aarch64.o | FileCheck %s --check-prefixes=CHECK,LE,AARCH64,64
6 # RUN: llvm-objcopy -I binary -B arm %t.txt %t.arm.o
7 # RUN: llvm-readobj --file-headers %t.arm.o | FileCheck %s --check-prefixes=CHECK,LE,ARM,32
9 # RUN: llvm-objcopy -I binary -B i386 %t.txt %t.i386.o
10 # RUN: llvm-readobj --file-headers %t.i386.o | FileCheck %s --check-prefixes=CHECK,LE,I386,32
12 # RUN: llvm-objcopy -I binary -B i386:x86-64 %t.txt %t.i386_x86-64.o
13 # RUN: llvm-readobj --file-headers %t.i386_x86-64.o | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64
15 # RUN: llvm-objcopy -I binary -B mips %t.txt %t.mips.o
16 # RUN: llvm-readobj --file-headers %t.mips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,32
18 # RUN: llvm-objcopy -I binary -B powerpc:common64 %t.txt %t.powerpc_common64.o
19 # RUN: llvm-readobj --file-headers %t.powerpc_common64.o | FileCheck %s --check-prefixes=CHECK,LE,PPC,64
21 # RUN: llvm-objcopy -I binary -B riscv:rv32 %t.txt %t.rv32.o
22 # RUN: llvm-readobj --file-headers %t.rv32.o | FileCheck %s --check-prefixes=CHECK,LE,RISCV32,32
24 # RUN: llvm-objcopy -I binary -B riscv:rv64 %t.txt %t.rv64.o
25 # RUN: llvm-readobj --file-headers %t.rv64.o | FileCheck %s --check-prefixes=CHECK,LE,RISCV64,64
27 # RUN: llvm-objcopy -I binary -B sparc %t.txt %t.sparc.o
28 # RUN: llvm-readobj --file-headers %t.sparc.o | FileCheck %s --check-prefixes=CHECK,BE,SPARC,32
30 # RUN: llvm-objcopy -I binary -B sparcel %t.txt %t.sparcel.o
31 # RUN: llvm-readobj --file-headers %t.sparcel.o | FileCheck %s --check-prefixes=CHECK,LE,SPARCEL,32
33 # RUN: llvm-objcopy -I binary -B x86-64 %t.txt %t.x86-64.o
34 # RUN: llvm-readobj --file-headers %t.x86-64.o | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64
39 # AARCH64-SAME: aarch64-little
40 # ARM-SAME: arm-little
42 # MIPS-SAME: mips{{$}}
43 # RISCV32-SAME: riscv{{$}}
44 # RISCV64-SAME: riscv{{$}}
50 # AARCH64-NEXT: Arch: aarch64
52 # I386-NEXT: Arch: i386
53 # MIPS-NEXT: Arch: mips{{$$}}
54 # PPC-NEXT: Arch: powerpc64le
55 # RISCV32-NEXT: Arch: riscv32
56 # RISCV64-NEXT: Arch: riscv64
57 # SPARC-NEXT: Arch: sparc{{$}}
58 # SPARCEL-NEXT: Arch: sparcel
59 # X86-64-NEXT: Arch: x86_64
61 # 32-NEXT: AddressSize: 32bit
62 # 64-NEXT: AddressSize: 64bit
66 # CHECK-NEXT: Magic: (7F 45 4C 46)
67 # 32-NEXT: Class: 32-bit (0x1)
68 # 64-NEXT: Class: 64-bit (0x2)
69 # LE-NEXT: DataEncoding: LittleEndian (0x1)
70 # BE-NEXT: DataEncoding: BigEndian (0x2)
71 # CHECK-NEXT: FileVersion: 1
72 # CHECK-NEXT: OS/ABI: SystemV (0x0)
73 # CHECK-NEXT: ABIVersion: 0
74 # CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
76 # CHECK-NEXT: Type: Relocatable (0x1)
77 # AARCH64-NEXT: Machine: EM_AARCH64 (0xB7)
78 # ARM-NEXT: Machine: EM_ARM (0x28)
79 # I386-NEXT: Machine: EM_386 (0x3)
80 # MIPS-NEXT: Machine: EM_MIPS (0x8)
81 # PPC-NEXT: Machine: EM_PPC64 (0x15)
82 # RISCV32-NEXT: Machine: EM_RISCV (0xF3)
83 # RISCV64-NEXT: Machine: EM_RISCV (0xF3)
84 # SPARC-NEXT: Machine: EM_SPARC (0x2)
85 # SPARCEL-NEXT: Machine: EM_SPARC (0x2)
86 # X86-64-NEXT: Machine: EM_X86_64 (0x3E)
87 # CHECK-NEXT: Version: 1
88 # CHECK-NEXT: Entry: 0x0
89 # CHECK-NEXT: ProgramHeaderOffset:
90 # CHECK-NEXT: SectionHeaderOffset:
91 # CHECK-NEXT: Flags [ (0x0)
93 # 32-NEXT: HeaderSize: 52
94 # 64-NEXT: HeaderSize: 64
95 # 32-NEXT: ProgramHeaderEntrySize: 0
96 # 64-NEXT: ProgramHeaderEntrySize: 0
97 # CHECK-NEXT: ProgramHeaderCount: 0
98 # 32-NEXT: SectionHeaderEntrySize: 40
99 # 64-NEXT: SectionHeaderEntrySize: 64
100 # CHECK-NEXT: SectionHeaderCount: 4
101 # CHECK-NEXT: StringTableSectionIndex: