[lld] aa4dfba - [ELF] Infer EM_HEXAGON in getBitcodeMachineKind
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 7 20:46:43 PDT 2021
Author: Fangrui Song
Date: 2021-09-07T20:46:37-07:00
New Revision: aa4dfba522538019740268bd0c018e1674adb1c9
URL: https://github.com/llvm/llvm-project/commit/aa4dfba522538019740268bd0c018e1674adb1c9
DIFF: https://github.com/llvm/llvm-project/commit/aa4dfba522538019740268bd0c018e1674adb1c9.diff
LOG: [ELF] Infer EM_HEXAGON in getBitcodeMachineKind
Added:
lld/test/ELF/lto/hexagon.ll
Modified:
lld/ELF/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index d5b9efbe18fc5..5104d2dd453d6 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1629,6 +1629,8 @@ static uint16_t getBitcodeMachineKind(StringRef path, const Triple &t) {
return EM_ARM;
case Triple::avr:
return EM_AVR;
+ case Triple::hexagon:
+ return EM_HEXAGON;
case Triple::mips:
case Triple::mipsel:
case Triple::mips64:
diff --git a/lld/test/ELF/lto/hexagon.ll b/lld/test/ELF/lto/hexagon.ll
new file mode 100644
index 0000000000000..db62b4d8a867f
--- /dev/null
+++ b/lld/test/ELF/lto/hexagon.ll
@@ -0,0 +1,17 @@
+; REQUIRES: hexagon
+;; Test we can infer the e_machine value EM_HEXAGON from a bitcode file.
+
+; RUN: llvm-as %s -o %t.bc
+; RUN: ld.lld %t.bc -o %t
+; RUN: llvm-readobj -h %t | FileCheck %s
+
+; CHECK: Class: 32-bit
+; CHECK: DataEncoding: LittleEndian
+; CHECK: Machine: EM_HEXAGON
+
+target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
+target triple = "hexagon-unknown-unknown-elf"
+
+define void @_start() {
+ ret void
+}
More information about the llvm-commits
mailing list