Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lld][ELF] Add armeb support when incoming bc is arm big endian #72604

Merged
merged 1 commit into from
Nov 21, 2023
Merged

[lld][ELF] Add armeb support when incoming bc is arm big endian #72604

merged 1 commit into from
Nov 21, 2023

Conversation

dongjianqiang2
Copy link
Contributor

Add armeb support when incoming bc is arm big endian:
Fix error: could not infer e_machine from bitcode target triple armebv7-linux-gnueabi.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 17, 2023

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-elf

Author: dong jianqiang (dongjianqiang2)

Changes

Add armeb support when incoming bc is arm big endian:
Fix error: could not infer e_machine from bitcode target triple armebv7-linux-gnueabi.


Full diff: https://github.com/llvm/llvm-project/pull/72604.diff

2 Files Affected:

  • (modified) lld/ELF/InputFiles.cpp (+2)
  • (added) lld/test/ELF/lto/armeb.ll (+12)
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
+}

@dongjianqiang2 dongjianqiang2 marked this pull request as draft November 17, 2023 03:15
@dongjianqiang2 dongjianqiang2 marked this pull request as ready for review November 17, 2023 03:16
lld/test/ELF/lto/armeb.ll Outdated Show resolved Hide resolved
Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment about arm.ll is not resolved.

@dongjianqiang2
Copy link
Contributor Author

@MaskRay can you help me merge it ?

@MaskRay MaskRay merged commit 89f095d into llvm:main Nov 21, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants