• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Show that the --output-format correctly configures both the main output file
2# and DWO output.
3# Note that we don't actually need any DWARF to produce the DWO file.
4
5# RUN: yaml2obj %s -o %t.o
6
7# Without --output-format, the format should match the input.
8# RUN: llvm-objcopy %t.o %t.default.o --split-dwo=%t.default.dwo
9# RUN: llvm-readobj --file-headers %t.default.o | FileCheck %s --check-prefixes=CHECK,LE,DEFAULT,32
10# RUN: llvm-readobj --file-headers %t.default.dwo | FileCheck %s --check-prefixes=CHECK,LE,DEFAULT,32
11
12# RUN: llvm-objcopy %t.o -O elf32-i386 %t.elf32_i386.o --split-dwo=%t.elf32_i386.dwo
13# RUN: llvm-readobj --file-headers %t.elf32_i386.o | FileCheck %s --check-prefixes=CHECK,LE,I386,32,SYSV
14# RUN: llvm-readobj --file-headers %t.elf32_i386.dwo | FileCheck %s --check-prefixes=CHECK,LE,I386,32,SYSV
15
16# RUN: llvm-objcopy %t.o -O elf32-i386-freebsd %t.elf32_i386_freebsd.o --split-dwo=%t.elf32_i386_freebsd.dwo
17# RUN: llvm-readobj --file-headers %t.elf32_i386_freebsd.o | FileCheck %s --check-prefixes=CHECK,LE,I386,32,FREEBSD
18# RUN: llvm-readobj --file-headers %t.elf32_i386_freebsd.dwo | FileCheck %s --check-prefixes=CHECK,LE,I386,32,FREEBSD
19
20# RUN: llvm-objcopy %t.o -O elf32-iamcu %t.elf32_iamcu.o --split-dwo=%t.elf32_iamcu.dwo
21# RUN: llvm-readobj --file-headers %t.elf32_iamcu.o | FileCheck %s --check-prefixes=CHECK,LE,IAMCU,32,SYSV
22# RUN: llvm-readobj --file-headers %t.elf32_iamcu.dwo | FileCheck %s --check-prefixes=CHECK,LE,IAMCU,32,SYSV
23
24# RUN: llvm-objcopy %t.o -O elf32-littlearm %t.elf32_littlearm.o --split-dwo=%t.elf32_littlearm.dwo
25# RUN: llvm-readobj --file-headers %t.elf32_littlearm.o | FileCheck %s --check-prefixes=CHECK,LE,ARM,32,SYSV
26# RUN: llvm-readobj --file-headers %t.elf32_littlearm.dwo | FileCheck %s --check-prefixes=CHECK,LE,ARM,32,SYSV
27
28# RUN: llvm-objcopy %t.o -O elf64-aarch64 %t.elf64_aarch64.o --split-dwo=%t.elf64_aarch64.dwo
29# RUN: llvm-readobj --file-headers %t.elf64_aarch64.o | FileCheck %s --check-prefixes=CHECK,LE,AARCH,64,SYSV
30# RUN: llvm-readobj --file-headers %t.elf64_aarch64.dwo | FileCheck %s --check-prefixes=CHECK,LE,AARCH,64,SYSV
31
32# RUN: llvm-objcopy %t.o -O elf64-littleaarch64 %t.elf64_littleaarch64.o --split-dwo=%t.elf64_littleaarch64.dwo
33# RUN: llvm-readobj --file-headers %t.elf64_littleaarch64.o | FileCheck %s --check-prefixes=CHECK,LE,AARCH,64,SYSV
34# RUN: llvm-readobj --file-headers %t.elf64_littleaarch64.dwo | FileCheck %s --check-prefixes=CHECK,LE,AARCH,64,SYSV
35
36# RUN: llvm-objcopy %t.o -O elf32-powerpc %t.elf32_powerpc.o --split-dwo=%t.elf32_powerpc.dwo
37# RUN: llvm-readobj --file-headers %t.elf32_powerpc.o | FileCheck %s --check-prefixes=CHECK,BE,PPC,32,SYSV
38# RUN: llvm-readobj --file-headers %t.elf32_powerpc.dwo | FileCheck %s --check-prefixes=CHECK,BE,PPC,32,SYSV
39
40# RUN: llvm-objcopy %t.o -O elf64-powerpc %t.elf64_powerpc.o --split-dwo=%t.elf64_powerpc.dwo
41# RUN: llvm-readobj --file-headers %t.elf64_powerpc.o | FileCheck %s --check-prefixes=CHECK,BE,PPC64BE,64,SYSV
42# RUN: llvm-readobj --file-headers %t.elf64_powerpc.dwo | FileCheck %s --check-prefixes=CHECK,BE,PPC64BE,64,SYSV
43
44# RUN: llvm-objcopy %t.o -O elf32-powerpcle %t.elf32_ppcle.o --split-dwo=%t.elf32_ppcle.dwo
45# RUN: llvm-readobj --file-headers %t.elf32_ppcle.o | FileCheck %s --check-prefixes=CHECK,LE,PPC,32,SYSV
46# RUN: llvm-readobj --file-headers %t.elf32_ppcle.dwo | FileCheck %s --check-prefixes=CHECK,LE,PPC,32,SYSV
47
48# RUN: llvm-objcopy %t.o -O elf32-x86-64 %t.elf32_x86_64.o --split-dwo=%t.elf32_x86_64.dwo
49# RUN: llvm-readobj --file-headers %t.elf32_x86_64.o | FileCheck %s --check-prefixes=CHECK,LE,X86-64,32,SYSV
50# RUN: llvm-readobj --file-headers %t.elf32_x86_64.dwo | FileCheck %s --check-prefixes=CHECK,LE,X86-64,32,SYSV
51
52# RUN: llvm-objcopy %t.o -O elf64-powerpcle %t.elf64_ppcle.o --split-dwo=%t.elf64_ppcle.dwo
53# RUN: llvm-readobj --file-headers %t.elf64_ppcle.o | FileCheck %s --check-prefixes=CHECK,LE,PPC64LE,64,SYSV
54# RUN: llvm-readobj --file-headers %t.elf64_ppcle.dwo | FileCheck %s --check-prefixes=CHECK,LE,PPC64LE,64,SYSV
55
56# RUN: llvm-objcopy %t.o -O elf32-littleriscv %t.elf32_littleriscv.o --split-dwo=%t.elf32_littleriscv.dwo
57# RUN: llvm-readobj --file-headers %t.elf32_littleriscv.o | FileCheck %s --check-prefixes=CHECK,LE,RISCV32,32,SYSV
58# RUN: llvm-readobj --file-headers %t.elf32_littleriscv.dwo | FileCheck %s --check-prefixes=CHECK,LE,RISCV32,32,SYSV
59
60# RUN: llvm-objcopy %t.o -O elf64-littleriscv %t.elf64_littleriscv.o --split-dwo=%t.elf64_littleriscv.dwo
61# RUN: llvm-readobj --file-headers %t.elf64_littleriscv.o | FileCheck %s --check-prefixes=CHECK,LE,RISCV64,64,SYSV
62# RUN: llvm-readobj --file-headers %t.elf64_littleriscv.dwo | FileCheck %s --check-prefixes=CHECK,LE,RISCV64,64,SYSV
63
64# RUN: llvm-objcopy %t.o -O elf64-x86-64 %t.elf64_x86_64.o --split-dwo=%t.elf64_x86_64.dwo
65# RUN: llvm-readobj --file-headers %t.elf64_x86_64.o | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64,SYSV
66# RUN: llvm-readobj --file-headers %t.elf64_x86_64.dwo | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64,SYSV
67
68# RUN: llvm-objcopy %t.o -O elf64-x86-64-freebsd %t.elf64_x86_64_freebsd.o --split-dwo=%t.elf64_x86_64_freebsd.dwo
69# RUN: llvm-readobj --file-headers %t.elf64_x86_64_freebsd.o | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64,FREEBSD
70# RUN: llvm-readobj --file-headers %t.elf64_x86_64_freebsd.dwo | FileCheck %s --check-prefixes=CHECK,LE,X86-64,64,FREEBSD
71
72# RUN: llvm-objcopy %t.o -O elf32-tradbigmips %t.elf32_tradbigmips.o --split-dwo=%t.elf32_tradbigmips.dwo
73# RUN: llvm-readobj --file-headers %t.elf32_tradbigmips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
74# RUN: llvm-readobj --file-headers %t.elf32_tradbigmips.dwo | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
75
76# RUN: llvm-objcopy %t.o -O elf32-bigmips %t.elf32_bigmips.o --split-dwo=%t.elf32_bigmips.dwo
77# RUN: llvm-readobj --file-headers %t.elf32_bigmips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
78# RUN: llvm-readobj --file-headers %t.elf32_bigmips.dwo | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
79
80# RUN: llvm-objcopy %t.o -O elf32-ntradbigmips %t.elf32_ntradbigmips.o --split-dwo=%t.elf32_ntradbigmips.dwo
81# RUN: llvm-readobj --file-headers %t.elf32_ntradbigmips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
82# RUN: llvm-readobj --file-headers %t.elf32_ntradbigmips.dwo | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPSBE,32,SYSV
83
84# RUN: llvm-objcopy %t.o -O elf32-tradlittlemips %t.elf32_tradlittlemips.o --split-dwo=%t.elf32_tradlittlemips.dwo
85# RUN: llvm-readobj --file-headers %t.elf32_tradlittlemips.o | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPSLE,32,SYSV
86# RUN: llvm-readobj --file-headers %t.elf32_tradlittlemips.dwo | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPSLE,32,SYSV
87
88# RUN: llvm-objcopy %t.o -O elf32-ntradlittlemips %t.elf32_ntradlittlemips.o --split-dwo=%t.elf32_ntradlittlemips.dwo
89# RUN: llvm-readobj --file-headers %t.elf32_ntradlittlemips.o | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPSLE,32,SYSV
90# RUN: llvm-readobj --file-headers %t.elf32_ntradlittlemips.dwo | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPSLE,32,SYSV
91
92# RUN: llvm-objcopy %t.o -O elf64-tradbigmips %t.elf64_tradbigmips.o --split-dwo=%t.elf64_tradbigmips.dwo
93# RUN: llvm-readobj --file-headers %t.elf64_tradbigmips.o | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPS64BE,64,SYSV
94# RUN: llvm-readobj --file-headers %t.elf64_tradbigmips.dwo | FileCheck %s --check-prefixes=CHECK,BE,MIPS,MIPS64BE,64,SYSV
95
96# RUN: llvm-objcopy %t.o -O elf64-tradlittlemips %t.elf64_tradlittlemips.o --split-dwo=%t.elf64_tradlittlemips.dwo
97# RUN: llvm-readobj --file-headers %t.elf64_tradlittlemips.o | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPS64LE,64,SYSV
98# RUN: llvm-readobj --file-headers %t.elf64_tradlittlemips.dwo | FileCheck %s --check-prefixes=CHECK,LE,MIPS,MIPS64LE,64,SYSV
99
100# RUN: llvm-objcopy %t.o -O elf32-sparc %t.elf32_sparc.o --split-dwo=%t.elf32_sparc.dwo
101# RUN: llvm-readobj --file-headers %t.elf32_sparc.o | FileCheck %s --check-prefixes=CHECK,BE,SPARC,32,SYSV
102# RUN: llvm-readobj --file-headers %t.elf32_sparc.dwo | FileCheck %s --check-prefixes=CHECK,BE,SPARC,32,SYSV
103
104# RUN: llvm-objcopy %t.o -O elf32-sparcel %t.elf32_sparcel.o --split-dwo=%t.elf32_sparcel.dwo
105# RUN: llvm-readobj --file-headers %t.elf32_sparcel.o | FileCheck %s --check-prefixes=CHECK,LE,SPARCEL,32,SYSV
106# RUN: llvm-readobj --file-headers %t.elf32_sparcel.dwo | FileCheck %s --check-prefixes=CHECK,LE,SPARCEL,32,SYSV
107
108# RUN: llvm-objcopy %t.o -O elf32-hexagon %t.elf32_hexagon.o --split-dwo=%t.elf32_hexagon.dwo
109# RUN: llvm-readobj --file-headers %t.elf32_hexagon.o | FileCheck %s --check-prefixes=CHECK,LE,HEXAGON,32,SYSV
110# RUN: llvm-readobj --file-headers %t.elf32_hexagon.dwo | FileCheck %s --check-prefixes=CHECK,LE,HEXAGON,32,SYSV
111
112!ELF
113FileHeader:
114  Class:           ELFCLASS32
115  Data:            ELFDATA2LSB
116  Type:            ET_EXEC
117  # Arbitrary values that do not match any value we convert to via --output-format.
118  Machine:         EM_NONE
119  OSABI:           ELFOSABI_STANDALONE
120Sections:
121  - Name:            .text
122    Type:            SHT_PROGBITS
123    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
124  - Name:            .data
125    Type:            SHT_PROGBITS
126    Flags:           [ SHF_ALLOC ]
127Symbols:
128  - Name:     foo
129    Type:     STT_FUNC
130    Section:  .text
131    Value:    0x1234
132    Binding:  STB_GLOBAL
133  - Name:     bar
134    Type:     STT_OBJECT
135    Section:  .data
136    Value:    0xabcd
137    Binding:  STB_GLOBAL
138
139# CHECK: Format:
140# 32-SAME:      elf32-
141# 64-SAME:      elf64-
142# I386-SAME:    i386
143# IAMCU-SAME:   iamcu
144# AARCH-SAME:   aarch64
145# ARM-SAME:     littlearm
146# HEXAGON-SAME: hexagon
147# MIPS-SAME:    mips
148# PPC-SAME:     powerpc{{$}}
149# PPC64BE-SAME: powerpc{{$}}
150# PPC64LE-SAME: powerpcle{{$}}
151# RISCV32-SAME: riscv{{$}}
152# RISCV64-SAME: riscv{{$}}
153# SPARC-SAME:   sparc
154# X86-64-SAME:  x86-64
155# DEFAULT-SAME: unknown
156
157# I386-NEXT:     Arch: i386
158# IAMCU-NEXT:    Arch: i386
159# AARCH-NEXT:    Arch: aarch64
160# ARM-NEXT:      Arch: arm
161# HEXAGON-NEXT:  Arch: hexagon
162# MIPSBE-NEXT:   Arch: mips{{$}}
163# MIPSLE-NEXT:   Arch: mipsel{{$}}
164# MIPS64BE-NEXT: Arch: mips64{{$}}
165# MIPS64LE-NEXT: Arch: mips64el{{$}}
166# PPC-NEXT:      Arch: powerpc{{$}}
167# PPC64BE-NEXT:  Arch: powerpc64{{$}}
168# PPC64LE-NEXT:  Arch: powerpc64le
169# RISCV32-NEXT:  Arch: riscv32
170# RISCV64-NEXT:  Arch: riscv64
171# SPARC-NEXT:    Arch: sparc{{$}}
172# SPARCEL-NEXT:  Arch: sparcel
173# X86-64-NEXT:   Arch: x86_64
174# DEFAULT-NEXT:  Arch: unknown
175
176# 32-NEXT:      AddressSize: 32bit
177# 64-NEXT:      AddressSize: 64bit
178
179# 32: Class: 32-bit
180# 64: Class: 64-bit
181# LE: DataEncoding: LittleEndian
182# BE: DataEncoding: BigEndian
183
184# SYSV:    OS/ABI: SystemV (0x0)
185# FREEBSD: OS/ABI: FreeBSD (0x9)
186# DEFAULT: OS/ABI: Standalone (0xFF)
187
188# AARCH:   Machine: EM_AARCH64 (0xB7)
189# ARM:     Machine: EM_ARM (0x28)
190# HEXAGON: Machine: EM_HEXAGON (0xA4)
191# I386:    Machine: EM_386 (0x3)
192# IAMCU:   Machine: EM_IAMCU (0x6)
193# MIPS:    Machine: EM_MIPS (0x8)
194# PPC:     Machine: EM_PPC (0x14)
195# PPC64:   Machine: EM_PPC64 (0x15)
196# RISCV32: Machine: EM_RISCV (0xF3)
197# RISCV64: Machine: EM_RISCV (0xF3)
198# SPARC:   Machine: EM_SPARC (0x2)
199# X86-64:  Machine: EM_X86_64 (0x3E)
200
201# 32: HeaderSize: 52
202# 64: HeaderSize: 64
203
204# 32: SectionHeaderEntrySize: 40
205# 64: SectionHeaderEntrySize: 64
206