[PATCH] D53539: [ELF] Handle elf32-littlearm in OUTPUT_FORMAT
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 22 16:46:44 PDT 2018
smeenai created this revision.
smeenai added reviewers: grimar, ruiu.
Herald added subscribers: chrib, kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.
We need this to support 32-bit ARM. Add test cases for emulation
handling for this architecture as well.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D53539
Files:
ELF/ScriptParser.cpp
test/ELF/emulation.s
Index: test/ELF/emulation.s
===================================================================
--- test/ELF/emulation.s
+++ test/ELF/emulation.s
@@ -1,4 +1,4 @@
-# REQUIRES: x86,ppc,mips,aarch64
+# REQUIRES: x86,ppc,mips,aarch64,arm
# 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
@@ -408,5 +408,34 @@
# AARCH64-NEXT: Flags [ (0x0)
# AARCH64-NEXT: ]
+# RUN: llvm-mc -filetype=obj -triple=armv7-unknown-linux %s -o %tarm
+# RUN: ld.lld -m armelf %tarm -o %t2arm
+# RUN: llvm-readobj -file-headers %t2arm | FileCheck --check-prefix=ARM %s
+# RUN: ld.lld -m armelf_linux_eabi %tarm -o %t3arm
+# RUN: llvm-readobj -file-headers %t3arm | FileCheck --check-prefix=ARM %s
+# RUN: ld.lld %tarm -o %t4arm
+# RUN: llvm-readobj -file-headers %t4arm | FileCheck --check-prefix=ARM %s
+# RUN: echo 'OUTPUT_FORMAT(elf32-littlearm)' > %t5arm.script
+# RUN: ld.lld %t5arm.script %tarm -o %t5arm
+# RUN: llvm-readobj -file-headers %t5arm | FileCheck --check-prefix=ARM %s
+# ARM: ElfHeader {
+# ARM-NEXT: Ident {
+# ARM-NEXT: Magic: (7F 45 4C 46)
+# ARM-NEXT: Class: 32 (0x1)
+# ARM-NEXT: DataEncoding: LittleEndian (0x1)
+# ARM-NEXT: FileVersion: 1
+# ARM-NEXT: OS/ABI: SystemV (0x0)
+# ARM-NEXT: ABIVersion: 0
+# ARM-NEXT: Unused: (00 00 00 00 00 00 00)
+# ARM-NEXT: }
+# ARM-NEXT: Type: Executable (0x2)
+# ARM-NEXT: Machine: EM_ARM (0xB7)
+# ARM-NEXT: Version: 1
+# ARM-NEXT: Entry:
+# ARM-NEXT: ProgramHeaderOffset: 0x40
+# ARM-NEXT: SectionHeaderOffset:
+# ARM-NEXT: Flags [ (0x0)
+# ARM-NEXT: ]
+
.globl _start
_start:
Index: ELF/ScriptParser.cpp
===================================================================
--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -389,6 +389,8 @@
return {ELF32LEKind, EM_386};
if (S == "elf32-iamcu")
return {ELF32LEKind, EM_IAMCU};
+ if (S == "elf32-littlearm")
+ return {ELF32LEKind, EM_ARM};
if (S == "elf32-x86-64")
return {ELF32LEKind, EM_X86_64};
if (S == "elf64-littleaarch64")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53539.170525.patch
Type: text/x-patch
Size: 2157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181022/b94b0478/attachment.bin>
More information about the llvm-commits
mailing list