[PATCH] D18661: lld: accept and ignore _fbsd suffix in emulation name

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 12:12:23 PDT 2016


emaste retitled this revision from "lld: accept elf_i386_fbsd as an alias for elf_i386" to "lld: accept and ignore _fbsd suffix in emulation name".
emaste updated this revision to Diff 52255.
emaste added a comment.

just ignore _fbsd suffix as suggested by @ruiu


http://reviews.llvm.org/D18661

Files:
  ELF/Driver.cpp
  test/ELF/emulation.s

Index: test/ELF/emulation.s
===================================================================
--- test/ELF/emulation.s
+++ test/ELF/emulation.s
@@ -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
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -46,13 +46,15 @@
 }
 
 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};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18661.52255.patch
Type: text/x-patch
Size: 2366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/d2a0ac80/attachment.bin>


More information about the llvm-commits mailing list