ELF: accept -m elf_amd64 as an alias for -m elf_x86_64
authorEd Maste <emaste@freebsd.org>
Thu, 8 Sep 2016 19:30:47 +0000 (19:30 +0000)
committerEd Maste <emaste@freebsd.org>
Thu, 8 Sep 2016 19:30:47 +0000 (19:30 +0000)
In the FreeBSD world x86_64 still has its original name, amd64. Accept
it as an alias.

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

llvm-svn: 280982

lld/ELF/Driver.cpp
lld/test/ELF/emulation.s

index 9e5d77a..d238f37 100644 (file)
@@ -70,6 +70,7 @@ static std::pair<ELFKind, uint16_t> parseEmulation(StringRef S) {
           .Case("elf64btsmip", {ELF64BEKind, EM_MIPS})
           .Case("elf64ltsmip", {ELF64LEKind, EM_MIPS})
           .Case("elf64ppc", {ELF64BEKind, EM_PPC64})
+          .Case("elf_amd64", {ELF64LEKind, EM_X86_64})
           .Case("elf_i386", {ELF32LEKind, EM_386})
           .Case("elf_iamcu", {ELF32LEKind, EM_IAMCU})
           .Case("elf_x86_64", {ELF64LEKind, EM_X86_64})
index 3ef0b87..de96050 100644 (file)
@@ -1,3 +1,34 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %tx64
+# RUN: ld.lld -m elf_amd64_fbsd %tx64 -o %t2x64
+# RUN: llvm-readobj -file-headers %t2x64 | FileCheck --check-prefix=AMD64 %s
+# RUN: ld.lld %tx64 -o %t3x64
+# RUN: llvm-readobj -file-headers %t3x64 | FileCheck --check-prefix=AMD64 %s
+# AMD64:      ElfHeader {
+# AMD64-NEXT:   Ident {
+# AMD64-NEXT:     Magic: (7F 45 4C 46)
+# AMD64-NEXT:     Class: 64-bit (0x2)
+# AMD64-NEXT:     DataEncoding: LittleEndian (0x1)
+# AMD64-NEXT:     FileVersion: 1
+# AMD64-NEXT:     OS/ABI: FreeBSD (0x9)
+# AMD64-NEXT:     ABIVersion: 0
+# AMD64-NEXT:     Unused: (00 00 00 00 00 00 00)
+# AMD64-NEXT:   }
+# AMD64-NEXT:   Type: Executable (0x2)
+# AMD64-NEXT:   Machine: EM_X86_64 (0x3E)
+# AMD64-NEXT:   Version: 1
+# AMD64-NEXT:   Entry:
+# AMD64-NEXT:   ProgramHeaderOffset: 0x40
+# AMD64-NEXT:   SectionHeaderOffset:
+# AMD64-NEXT:   Flags [ (0x0)
+# AMD64-NEXT:   ]
+# AMD64-NEXT:   HeaderSize: 64
+# AMD64-NEXT:   ProgramHeaderEntrySize: 56
+# AMD64-NEXT:   ProgramHeaderCount:
+# AMD64-NEXT:   SectionHeaderEntrySize: 64
+# AMD64-NEXT:   SectionHeaderCount:
+# AMD64-NEXT:   StringTableSectionIndex:
+# AMD64-NEXT: }
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tx64
 # RUN: ld.lld -m elf_x86_64 %tx64 -o %t2x64
 # RUN: llvm-readobj -file-headers %t2x64 | FileCheck --check-prefix=X86-64 %s