[PATCH] D22268: lld: Add -m elf32_x86_64

H.J Lu via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 10:22:58 PDT 2016


hjl.tools created this revision.
hjl.tools added a reviewer: ruiu.
hjl.tools added a subscriber: llvm-commits.
hjl.tools set the repository for this revision to rL LLVM.
hjl.tools added a project: lld.

This patch adds -m elf32_x86_64 to lld.  It fixes PR 28507.

Repository:
  rL LLVM

http://reviews.llvm.org/D22268

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

Index: test/ELF/emulation.s
===================================================================
--- test/ELF/emulation.s
+++ test/ELF/emulation.s
@@ -29,6 +29,37 @@
 # X86-64-NEXT:   StringTableSectionIndex:
 # X86-64-NEXT: }
 
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnux32 %s -o %tx32
+# RUN: ld.lld -m elf32_x86_64 %tx32 -o %t2x32
+# RUN: llvm-readobj -file-headers %t2x32 | FileCheck --check-prefix=X32 %s
+# RUN: ld.lld %tx32 -o %t3x32
+# RUN: llvm-readobj -file-headers %t3x32 | FileCheck --check-prefix=X32 %s
+# X32:      ElfHeader {
+# X32-NEXT:   Ident {
+# X32-NEXT:     Magic: (7F 45 4C 46)
+# X32-NEXT:     Class: 32-bit (0x1)
+# X32-NEXT:     DataEncoding: LittleEndian (0x1)
+# X32-NEXT:     FileVersion: 1
+# X32-NEXT:     OS/ABI: SystemV (0x0)
+# X32-NEXT:     ABIVersion: 0
+# X32-NEXT:     Unused: (00 00 00 00 00 00 00)
+# X32-NEXT:   }
+# X32-NEXT:   Type: Executable (0x2)
+# X32-NEXT:   Machine: EM_X86_64 (0x3E)
+# X32-NEXT:   Version: 1
+# X32-NEXT:   Entry:
+# X32-NEXT:   ProgramHeaderOffset: 0x34
+# X32-NEXT:   SectionHeaderOffset:
+# X32-NEXT:   Flags [ (0x0)
+# X32-NEXT:   ]
+# X32-NEXT:   HeaderSize: 52
+# X32-NEXT:   ProgramHeaderEntrySize: 32
+# X32-NEXT:   ProgramHeaderCount:
+# X32-NEXT:   SectionHeaderEntrySize: 40
+# X32-NEXT:   SectionHeaderCount:
+# X32-NEXT:   StringTableSectionIndex:
+# X32-NEXT: }
+
 # RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %tx86
 # RUN: ld.lld -m elf_i386 %tx86 -o %t2x86
 # RUN: llvm-readobj -file-headers %t2x86 | FileCheck --check-prefix=X86 %s
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -70,6 +70,7 @@
           .Case("elf64ppc", {ELF64BEKind, EM_PPC64})
           .Case("elf_i386", {ELF32LEKind, EM_386})
           .Case("elf_x86_64", {ELF64LEKind, EM_X86_64})
+          .Case("elf32_x86_64", {ELF32LEKind, EM_X86_64})
           .Default({ELFNoneKind, EM_NONE});
 
   if (Ret.first == ELFNoneKind) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22268.63690.patch
Type: text/x-patch
Size: 2005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160712/e5ad41a8/attachment.bin>


More information about the llvm-commits mailing list