lld: accept and ignore _fbsd suffix in emulation name

Differential Revision:	http://reviews.llvm.org/D18661

llvm-svn: 265044
This commit is contained in:
Ed Maste 2016-03-31 20:26:30 +00:00
parent a614ab7b71
commit e2b7677c9e
2 changed files with 35 additions and 2 deletions

View File

@ -46,13 +46,15 @@ bool elf::link(ArrayRef<const char *> Args, raw_ostream &Error) {
}
static std::pair<ELFKind, uint16_t> parseEmulation(StringRef S) {
if (S.endswith("_fbsd"))
S = S.drop_back(5);
if (S == "elf32btsmip")
return {ELF32BEKind, EM_MIPS};
if (S == "elf32ltsmip")
return {ELF32LEKind, EM_MIPS};
if (S == "elf32ppc" || S == "elf32ppc_fbsd")
if (S == "elf32ppc")
return {ELF32BEKind, EM_PPC};
if (S == "elf64ppc" || S == "elf64ppc_fbsd")
if (S == "elf64ppc")
return {ELF64BEKind, EM_PPC64};
if (S == "elf_i386")
return {ELF32LEKind, EM_386};

View File

@ -60,6 +60,37 @@
# X86-NEXT: StringTableSectionIndex:
# X86-NEXT: }
# RUN: llvm-mc -filetype=obj -triple=i686-unknown-freebsd %s -o %tx86fbsd
# RUN: ld.lld -m elf_i386_fbsd %tx86fbsd -o %t2x86_fbsd
# RUN: llvm-readobj -file-headers %t2x86_fbsd | FileCheck --check-prefix=X86FBSD %s
# RUN: ld.lld %tx86fbsd -o %t3x86fbsd
# RUN: llvm-readobj -file-headers %t3x86fbsd | FileCheck --check-prefix=X86FBSD %s
# X86FBSD: ElfHeader {
# X86FBSD-NEXT: Ident {
# X86FBSD-NEXT: Magic: (7F 45 4C 46)
# X86FBSD-NEXT: Class: 32-bit (0x1)
# X86FBSD-NEXT: DataEncoding: LittleEndian (0x1)
# X86FBSD-NEXT: FileVersion: 1
# X86FBSD-NEXT: OS/ABI: FreeBSD (0x9)
# X86FBSD-NEXT: ABIVersion: 0
# X86FBSD-NEXT: Unused: (00 00 00 00 00 00 00)
# X86FBSD-NEXT: }
# X86FBSD-NEXT: Type: Executable (0x2)
# X86FBSD-NEXT: Machine: EM_386 (0x3)
# X86FBSD-NEXT: Version: 1
# X86FBSD-NEXT: Entry:
# X86FBSD-NEXT: ProgramHeaderOffset: 0x34
# X86FBSD-NEXT: SectionHeaderOffset:
# X86FBSD-NEXT: Flags [ (0x0)
# X86FBSD-NEXT: ]
# X86FBSD-NEXT: HeaderSize: 52
# X86FBSD-NEXT: ProgramHeaderEntrySize: 32
# X86FBSD-NEXT: ProgramHeaderCount:
# X86FBSD-NEXT: SectionHeaderEntrySize: 40
# X86FBSD-NEXT: SectionHeaderCount:
# X86FBSD-NEXT: StringTableSectionIndex:
# X86FBSD-NEXT: }
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %tppc64
# RUN: ld.lld -m elf64ppc %tppc64 -o %t2ppc64
# RUN: llvm-readobj -file-headers %t2ppc64 | FileCheck --check-prefix=PPC64 %s