[PATCH] D23126: lld: Add EM_IAMCU support
H.J Lu via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 3 11:13:02 PDT 2016
hjl.tools created this revision.
hjl.tools added reviewers: ruiu, rafael.
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 elf_iamcu" to ldd for IAMCU psABI:
https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
Repository:
rL LLVM
https://reviews.llvm.org/D23126
Files:
ELF/Driver.cpp
ELF/InputFiles.cpp
ELF/Target.cpp
test/ELF/emulation.s
Index: test/ELF/emulation.s
===================================================================
--- test/ELF/emulation.s
+++ test/ELF/emulation.s
@@ -122,6 +122,37 @@
# X86FBSD-NEXT: StringTableSectionIndex:
# X86FBSD-NEXT: }
+# RUN: llvm-mc -filetype=obj -triple=i586-intel-elfiamcu %s -o %tiamcu
+# RUN: ld.lld -m elf_iamcu %tiamcu -o %t2iamcu
+# RUN: llvm-readobj -file-headers %t2iamcu | FileCheck --check-prefix=IAMCU %s
+# RUN: ld.lld %tiamcu -o %t3iamcu
+# RUN: llvm-readobj -file-headers %t3iamcu | FileCheck --check-prefix=IAMCU %s
+# IAMCU: ElfHeader {
+# IAMCU-NEXT: Ident {
+# IAMCU-NEXT: Magic: (7F 45 4C 46)
+# IAMCU-NEXT: Class: 32-bit (0x1)
+# IAMCU-NEXT: DataEncoding: LittleEndian (0x1)
+# IAMCU-NEXT: FileVersion: 1
+# IAMCU-NEXT: OS/ABI: SystemV (0x0)
+# IAMCU-NEXT: ABIVersion: 0
+# IAMCU-NEXT: Unused: (00 00 00 00 00 00 00)
+# IAMCU-NEXT: }
+# IAMCU-NEXT: Type: Executable (0x2)
+# IAMCU-NEXT: Machine: EM_IAMCU (0x6)
+# IAMCU-NEXT: Version: 1
+# IAMCU-NEXT: Entry:
+# IAMCU-NEXT: ProgramHeaderOffset: 0x34
+# IAMCU-NEXT: SectionHeaderOffset:
+# IAMCU-NEXT: Flags [ (0x0)
+# IAMCU-NEXT: ]
+# IAMCU-NEXT: HeaderSize: 52
+# IAMCU-NEXT: ProgramHeaderEntrySize: 32
+# IAMCU-NEXT: ProgramHeaderCount:
+# IAMCU-NEXT: SectionHeaderEntrySize: 40
+# IAMCU-NEXT: SectionHeaderCount:
+# IAMCU-NEXT: StringTableSectionIndex:
+# IAMCU-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/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -214,6 +214,7 @@
TargetInfo *createTarget() {
switch (Config->EMachine) {
case EM_386:
+ case EM_IAMCU:
return new X86TargetInfo();
case EM_AARCH64:
return new AArch64TargetInfo();
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -579,7 +579,7 @@
case Triple::ppc64:
return EM_PPC64;
case Triple::x86:
- return EM_386;
+ return Triple(TripleStr).isOSIAMCU() ? EM_IAMCU : EM_386;
case Triple::x86_64:
return EM_X86_64;
default:
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -70,6 +70,7 @@
.Case("elf64ltsmip", {ELF64LEKind, EM_MIPS})
.Case("elf64ppc", {ELF64BEKind, EM_PPC64})
.Case("elf_i386", {ELF32LEKind, EM_386})
+ .Case("elf_iamcu", {ELF32LEKind, EM_IAMCU})
.Case("elf_x86_64", {ELF64LEKind, EM_X86_64})
.Default({ELFNoneKind, EM_NONE});
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23126.66680.patch
Type: text/x-patch
Size: 2797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/53ae190e/attachment.bin>
More information about the llvm-commits
mailing list