Skip to content

Commit c072247

Browse files
authored
[lld][ELF] Add getBitcodeMachineKind test for LoongArch (#71931)
Test that getBitcodeMachineKind can get right e_machine for Triple::loongarch64 and Triple::loongarch32 during LTO.
1 parent 5169100 commit c072247

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lld/test/ELF/lto/loongarch.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; REQUIRES: loongarch
2+
;; Test we can infer the e_machine value EM_LOONGARCH from a bitcode file.
3+
4+
; RUN: split-file %s %t
5+
; RUN: llvm-as %t/32.ll -o %t/32.o
6+
; RUN: ld.lld %t/32.o -o %t/32
7+
; RUN: llvm-readobj -h %t/32 | FileCheck %s --check-prefixes=CHECK,LA32
8+
9+
; RUN: llvm-as %t/64.ll -o %t/64.o
10+
; RUN: ld.lld %t/64.o -o %t/64
11+
; RUN: llvm-readobj -h %t/64 | FileCheck %s --check-prefixes=CHECK,LA64
12+
13+
; LA32: Class: 32-bit
14+
; LA64: Class: 64-bit
15+
; CHECK: DataEncoding: LittleEndian
16+
; CHECK: Machine: EM_LOONGARCH
17+
18+
;--- 32.ll
19+
target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
20+
target triple = "loongarch32-unknown-elf"
21+
22+
define void @_start() {
23+
ret void
24+
}
25+
26+
;--- 64.ll
27+
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
28+
target triple = "loongarch64-unknown-elf"
29+
30+
define void @_start() {
31+
ret void
32+
}

0 commit comments

Comments
 (0)