[lld] [lld][ELF] Add armeb support when incoming bc is arm big endian (PR #72604)
dong jianqiang via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 19:03:42 PST 2023
https://github.com/dongjianqiang2 created https://github.com/llvm/llvm-project/pull/72604
Add armeb support when incoming bc is arm big endian:
Fix error: could not infer e_machine from bitcode target triple armebv7-linux-gnueabi.
>From 0203b086a2b1c2e6c5015abce018b28dc2f783bd Mon Sep 17 00:00:00 2001
From: Dong JianQiang <dongjianqiang2 at huawei.com>
Date: Thu, 16 Nov 2023 20:55:05 +0800
Subject: [PATCH] [lld][ELF] Add armeb support when incoming bc is arm big
endian
---
lld/ELF/InputFiles.cpp | 2 ++
lld/test/ELF/lto/armeb.ll | 12 ++++++++++++
2 files changed, 14 insertions(+)
create mode 100644 lld/test/ELF/lto/armeb.ll
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 4b4d7d6db93cd57..17ecd047e015287 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1582,7 +1582,9 @@ static uint16_t getBitcodeMachineKind(StringRef path, const Triple &t) {
case Triple::r600:
return EM_AMDGPU;
case Triple::arm:
+ case Triple::armeb:
case Triple::thumb:
+ case Triple::thumbeb:
return EM_ARM;
case Triple::avr:
return EM_AVR;
diff --git a/lld/test/ELF/lto/armeb.ll b/lld/test/ELF/lto/armeb.ll
new file mode 100644
index 000000000000000..77ac4e1297a63fe
--- /dev/null
+++ b/lld/test/ELF/lto/armeb.ll
@@ -0,0 +1,12 @@
+; REQUIRES: arm
+; RUN: llvm-as %s -o %t.bc
+; RUN: ld.lld %t.bc -o %t.o
+
+; Make sure the armeb triple is handled
+
+target triple = "armebv7-linux-musleabi"
+target datalayout = "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+
+define dso_local void @_start() #0 {
+ ret void
+}
More information about the llvm-commits
mailing list