[lld] 47b8763 - [ELF][test] gitBitcodeMachineKind: test EM_ARM

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 00:26:41 PST 2023


Author: Fangrui Song
Date: 2023-11-17T00:26:26-08:00
New Revision: 47b8763f8a814c0e755e154516537d8deb57e4b0

URL: https://github.com/llvm/llvm-project/commit/47b8763f8a814c0e755e154516537d8deb57e4b0
DIFF: https://github.com/llvm/llvm-project/commit/47b8763f8a814c0e755e154516537d8deb57e4b0.diff

LOG: [ELF][test] gitBitcodeMachineKind: test EM_ARM

Added: 
    lld/test/ELF/lto/arm.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/lto/arm.ll b/lld/test/ELF/lto/arm.ll
new file mode 100644
index 000000000000000..00d08658adfe50a
--- /dev/null
+++ b/lld/test/ELF/lto/arm.ll
@@ -0,0 +1,59 @@
+; REQUIRES: arm
+;; Test we can infer the e_machine value EM_ARM from a bitcode file.
+
+; RUN: split-file %s %t
+
+; RUN: llvm-as %t/arm.ll -o %t/arm.o
+; RUN: ld.lld %t/arm.o -o %t/arm
+; RUN: llvm-readobj -h %t/arm | FileCheck %s --check-prefix=ARM
+; RUN: llvm-as %t/armeb.ll -o %t/armeb.o
+; RUN: not ld.lld %t/armeb.o -o %t/armeb
+
+; RUN: llvm-as %t/thumb.ll -o %t/thumb.o
+; RUN: ld.lld %t/thumb.o -o %t/thumb
+; RUN: llvm-readobj -h %t/thumb | FileCheck %s --check-prefix=THUMB
+; RUN: llvm-as %t/thumbeb.ll -o %t/thumbeb.o
+; RUN: not ld.lld %t/thumbeb.o -o %t/thumbeb
+
+; ARM:       Class: 32-bit
+; ARM:       DataEncoding: LittleEndian
+; ARM:     Machine: EM_ARM (
+; ARMEB:     Class: 32-bit
+; ARMEB:     DataEncoding: BigEndian
+; ARMEB:   Machine: EM_ARM (
+
+; THUMB:     Class: 32-bit
+; THUMB:     DataEncoding: LittleEndian
+; THUMB:   Machine: EM_ARM (
+
+;--- arm.ll
+target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armv7-linux-musleabi"
+
+define void @_start() {
+  ret void
+}
+
+;--- thumb.ll
+target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbv8m.base-none-unknown-gnueabi"
+
+define void @_start() {
+  ret void
+}
+
+;--- armeb.ll
+target datalayout = "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "armebv7-unknown-linux-musleabi"
+
+define void @_start() {
+  ret void
+}
+
+;--- thumbeb.ll
+target datalayout = "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbebv8m.base-none-unknown-gnueabi"
+
+define void @_start() {
+  ret void
+}


        


More information about the llvm-commits mailing list