[PATCH] D92931: lld/ELF: Parse MSP430 BFD/emulation names
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 09:38:24 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92c6141ce6a9: lld/ELF: Parse MSP430 BFD/emulation names (authored by LemonBoy, committed by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92931/new/
https://reviews.llvm.org/D92931
Files:
lld/ELF/Driver.cpp
lld/ELF/ScriptParser.cpp
lld/test/ELF/emulation-msp430.s
Index: lld/test/ELF/emulation-msp430.s
===================================================================
--- /dev/null
+++ lld/test/ELF/emulation-msp430.s
@@ -0,0 +1,26 @@
+# REQUIRES: msp430
+# RUN: llvm-mc -filetype=obj -triple=msp430 %s -o %t.o
+# RUN: ld.lld %t.o -o %t1
+# RUN: llvm-readobj --file-headers %t1 | FileCheck %s
+# RUN: ld.lld -m msp430elf %t.o -o %t2
+# RUN: cmp %t1 %t2
+# RUN: echo 'OUTPUT_FORMAT(elf32-msp430)' > %t.lds
+# RUN: ld.lld -T %t.lds %t.o -o %t3
+# RUN: llvm-readobj --file-headers %t3 | FileCheck %s
+
+# CHECK: ElfHeader {
+# CHECK-NEXT: Ident {
+# CHECK-NEXT: Magic: (7F 45 4C 46)
+# CHECK-NEXT: Class: 32-bit (0x1)
+# CHECK-NEXT: DataEncoding: LittleEndian (0x1)
+# CHECK-NEXT: FileVersion: 1
+# CHECK-NEXT: OS/ABI: Standalone (0xFF)
+# CHECK-NEXT: ABIVersion: 0
+# CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
+# CHECK-NEXT: }
+# CHECK-NEXT: Type: Executable (0x2)
+# CHECK-NEXT: Machine: EM_MSP430 (0x69)
+# CHECK-NEXT: Version: 1
+
+.globl _start
+_start:
Index: lld/ELF/ScriptParser.cpp
===================================================================
--- lld/ELF/ScriptParser.cpp
+++ lld/ELF/ScriptParser.cpp
@@ -425,6 +425,7 @@
.Case("elf32-littleriscv", {ELF32LEKind, EM_RISCV})
.Case("elf64-littleriscv", {ELF64LEKind, EM_RISCV})
.Case("elf64-sparc", {ELF64BEKind, EM_SPARCV9})
+ .Case("elf32-msp430", {ELF32LEKind, EM_MSP430})
.Default({ELFNoneKind, EM_NONE});
}
@@ -443,6 +444,8 @@
setError("unknown output format name: " + config->bfdname);
if (s == "elf32-ntradlittlemips" || s == "elf32-ntradbigmips")
config->mipsN32Abi = true;
+ if (config->emachine == EM_MSP430)
+ config->osabi = ELFOSABI_STANDALONE;
if (consume(")"))
return;
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -161,10 +161,13 @@
.Case("elf_i386", {ELF32LEKind, EM_386})
.Case("elf_iamcu", {ELF32LEKind, EM_IAMCU})
.Case("elf64_sparc", {ELF64BEKind, EM_SPARCV9})
+ .Case("msp430elf", {ELF32LEKind, EM_MSP430})
.Default({ELFNoneKind, EM_NONE});
if (ret.first == ELFNoneKind)
error("unknown emulation: " + emul);
+ if (ret.second == EM_MSP430)
+ osabi = ELFOSABI_STANDALONE;
return std::make_tuple(ret.first, ret.second, osabi);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92931.311635.patch
Type: text/x-patch
Size: 2424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201214/7bb214d4/attachment.bin>
More information about the llvm-commits
mailing list