Files
clang-p2996/llvm/test/tools/llvm-objcopy/ELF/binary-input-with-arch.test
James Henderson c040d5de25 [llvm-objcopy]Add support for *-freebsd output formats
GNU objcopy can support output formats like elf32-i386-freebsd and
elf64-x86-64-freebsd. The only difference from their regular non-freebsd
counterparts that I have observed is that the freebsd versions set the
OS/ABI field to ELFOSABI_FREEBSD. This patch sets the OS/ABI field
according based on the format whenever --output-format is specified.

Reviewed by: rupprecht, grimar

Differential Revision: https://reviews.llvm.org/D59645

llvm-svn: 356737
2019-03-22 10:21:09 +00:00

27 lines
1000 B
Plaintext

# RUN: echo -n abcd > %t.x-txt
# Preserve input to verify it is not modified.
# RUN: cp %t.x-txt %t-copy.txt
# RUN: llvm-objcopy -I binary -B i386 -O elf64-x86-64 %t.x-txt %t.o
# RUN: llvm-readobj --file-headers %t.o | FileCheck %s --check-prefixes=CHECK,SYSV
# RUN: cmp %t.x-txt %t-copy.txt
# Many uses of objcopy use no spaces in the flags, make sure that also works.
# RUN: llvm-objcopy -Ibinary -Bi386 -Oelf64-x86-64 %t.x-txt %t-no-spaces.o
# RUN: cmp %t.o %t-no-spaces.o
# elf64-x86-64-freebsd sets the OS/ABI field.
# RUN: llvm-objcopy -I binary -B i386 -O elf64-x86-64-freebsd %t.x-txt %t.freebsd.o
# RUN: llvm-readobj --file-headers %t.freebsd.o | FileCheck %s --check-prefixes=CHECK,FREEBSD
# CHECK: Format: ELF64-x86-64
# CHECK-NEXT: Arch: x86_64
# CHECK-NEXT: AddressSize: 64bit
# CHECK: Class: 64-bit
# CHECK: DataEncoding: LittleEndian
# SYSV: OS/ABI: SystemV
# FREEBSD: OS/ABI: FreeBSD
# CHECK: Machine: EM_X86_64
# CHECK: HeaderSize: 64
# CHECK: SectionHeaderEntrySize: 64