Skip to content

Commit c069d9f

Browse files
committedMar 22, 2019
[llvm-objcopy]Add coverage for --split-dwo and --output-format
Also fix up a couple of minor issues in the test being updated, where FileCheck could match on incorrect output and fix the test case order to match the struct order. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D59691 llvm-svn: 356746
1 parent d822018 commit c069d9f

File tree

1 file changed

+37
-17
lines changed

1 file changed

+37
-17
lines changed
 

‎llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test

+37-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
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+
15
# RUN: yaml2obj %s > %t.o
26

3-
# RUN: llvm-objcopy %t.o -O elf32-i386 %t.elf32_i386.o
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,DEFAULT,32
10+
# RUN: llvm-readobj --file-headers %t.default.dwo | FileCheck %s --check-prefixes=CHECK,DEFAULT,32
11+
12+
# RUN: llvm-objcopy %t.o -O elf32-i386 %t.elf32_i386.o --split-dwo=%t.elf32_i386.dwo
413
# RUN: llvm-readobj --file-headers %t.elf32_i386.o | FileCheck %s --check-prefixes=CHECK,I386,32,SYSV
14+
# RUN: llvm-readobj --file-headers %t.elf32_i386.dwo | FileCheck %s --check-prefixes=CHECK,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,I386,32,FREEBSD
18+
# RUN: llvm-readobj --file-headers %t.elf32_i386_freebsd.dwo | FileCheck %s --check-prefixes=CHECK,I386,32,FREEBSD
519

6-
# RUN: llvm-objcopy %t.o -O elf32-powerpcle %t.elf32_ppcle.o
20+
# RUN: llvm-objcopy %t.o -O elf32-powerpcle %t.elf32_ppcle.o --split-dwo=%t.elf32_ppcle.dwo
721
# RUN: llvm-readobj --file-headers %t.elf32_ppcle.o | FileCheck %s --check-prefixes=CHECK,PPC,32,SYSV
22+
# RUN: llvm-readobj --file-headers %t.elf32_ppcle.dwo | FileCheck %s --check-prefixes=CHECK,PPC,32,SYSV
823

9-
# RUN: llvm-objcopy %t.o -O elf32-x86-64 %t.elf32_x86_64.o
24+
# RUN: llvm-objcopy %t.o -O elf32-x86-64 %t.elf32_x86_64.o --split-dwo=%t.elf32_x86_64.dwo
1025
# RUN: llvm-readobj --file-headers %t.elf32_x86_64.o | FileCheck %s --check-prefixes=CHECK,X86-64,32,SYSV
26+
# RUN: llvm-readobj --file-headers %t.elf32_x86_64.dwo | FileCheck %s --check-prefixes=CHECK,X86-64,32,SYSV
1127

12-
# RUN: llvm-objcopy %t.o -O elf64-powerpcle %t.elf64_ppcle.o
28+
# RUN: llvm-objcopy %t.o -O elf64-powerpcle %t.elf64_ppcle.o --split-dwo=%t.elf64_ppcle.dwo
1329
# RUN: llvm-readobj --file-headers %t.elf64_ppcle.o | FileCheck %s --check-prefixes=CHECK,PPC64,64,SYSV
30+
# RUN: llvm-readobj --file-headers %t.elf64_ppcle.dwo | FileCheck %s --check-prefixes=CHECK,PPC64,64,SYSV
1431

15-
# RUN: llvm-objcopy %t.o -O elf64-x86-64 %t.elf64_x86_64.o
32+
# RUN: llvm-objcopy %t.o -O elf64-x86-64 %t.elf64_x86_64.o --split-dwo=%t.elf64_x86_64.dwo
1633
# RUN: llvm-readobj --file-headers %t.elf64_x86_64.o | FileCheck %s --check-prefixes=CHECK,X86-64,64,SYSV
34+
# RUN: llvm-readobj --file-headers %t.elf64_x86_64.dwo | FileCheck %s --check-prefixes=CHECK,X86-64,64,SYSV
1735

18-
# RUN: llvm-objcopy %t.o -O elf64-x86-64-freebsd %t.elf64_x86_64_freebsd.o
36+
# RUN: llvm-objcopy %t.o -O elf64-x86-64-freebsd %t.elf64_x86_64_freebsd.o --split-dwo=%t.elf64_x86_64_freebsd.dwo
1937
# RUN: llvm-readobj --file-headers %t.elf64_x86_64_freebsd.o | FileCheck %s --check-prefixes=CHECK,X86-64,64,FREEBSD
20-
21-
# RUN: llvm-objcopy %t.o -O elf32-i386-freebsd %t.elf32_i386_freebsd.o
22-
# RUN: llvm-readobj --file-headers %t.elf32_i386_freebsd.o | FileCheck %s --check-prefixes=CHECK,I386,32,FREEBSD
38+
# RUN: llvm-readobj --file-headers %t.elf64_x86_64_freebsd.dwo | FileCheck %s --check-prefixes=CHECK,X86-64,64,FREEBSD
2339

2440
!ELF
2541
FileHeader:
2642
Class: ELFCLASS32
2743
Data: ELFDATA2LSB
2844
Type: ET_EXEC
29-
Machine: EM_386
30-
OSABI: ELFOSABI_STANDALONE # Arbitrary non-zero value.
45+
# Arbitrary values that do not match any value we convert to via --output-format.
46+
Machine: EM_NONE
47+
OSABI: ELFOSABI_STANDALONE
3148
Sections:
3249
- Name: .text
3350
Type: SHT_PROGBITS
@@ -50,14 +67,16 @@ Symbols:
5067
# 32-SAME: ELF32-
5168
# 64-SAME: ELF64-
5269
# I386-SAME: i386
53-
# PPC-SAME: ppc
70+
# PPC-SAME: ppc{{$}}
5471
# PPC64-SAME: ppc64
5572
# X86-64-SAME: x86-64
73+
# DEFAULT-SAME: unknown
5674

5775
# I386-NEXT: Arch: i386
58-
# PPC-NEXT: Arch: powerpc
76+
# PPC-NEXT: Arch: powerpc{{$}}
5977
# PPC64-NEXT: Arch: powerpc64le
6078
# X86-64-NEXT: Arch: x86_64
79+
# DEFAULT-NEXT: Arch: unknown
6180

6281
# 32-NEXT: AddressSize: 32bit
6382
# 64-NEXT: AddressSize: 64bit
@@ -68,11 +87,12 @@ Symbols:
6887

6988
# SYSV: OS/ABI: SystemV (0x0)
7089
# FREEBSD: OS/ABI: FreeBSD (0x9)
90+
# DEFAULT: OS/ABI: Standalone (0xFF)
7191

72-
# I386: Machine: EM_386
73-
# PPC: Machine: EM_PPC
74-
# PPC64: Machine: EM_PPC64
75-
# X86-64: Machine: EM_X86_64
92+
# I386: Machine: EM_386 (0x3)
93+
# PPC: Machine: EM_PPC (0x14)
94+
# PPC64: Machine: EM_PPC64 (0x15)
95+
# X86-64: Machine: EM_X86_64 (0x3E)
7696

7797
# 32: HeaderSize: 52
7898
# 64: HeaderSize: 64

0 commit comments

Comments
 (0)
Please sign in to comment.