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 getBitcodeMachineKind test for LoongArch #71931

Merged
merged 1 commit into from
Nov 24, 2023

Conversation

GongMengyao
Copy link
Contributor

Test that getBitcodeMachineKind can get right e_machine for Triple::loongarch64 and Triple::loongarch32 during LTO.

Test that getBitcodeMachineKind can get right e_machine for Triple::loongarch64 and Triple::loongarch32 during LTO.
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2023

@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-lld

Author: None (GongMengyao)

Changes

Test that getBitcodeMachineKind can get right e_machine for Triple::loongarch64 and Triple::loongarch32 during LTO.


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

1 Files Affected:

  • (added) lld/test/ELF/lto/loongarch.ll (+32)
diff --git a/lld/test/ELF/lto/loongarch.ll b/lld/test/ELF/lto/loongarch.ll
new file mode 100644
index 000000000000000..06ebdce0286d705
--- /dev/null
+++ b/lld/test/ELF/lto/loongarch.ll
@@ -0,0 +1,32 @@
+; REQUIRES: loongarch
+;; Test we can infer the e_machine value EM_LOONGARCH from a bitcode file.
+
+; RUN: split-file %s %t
+; RUN: llvm-as %t/32.ll -o %t/32.o
+; RUN: ld.lld %t/32.o -o %t/32
+; RUN: llvm-readobj -h %t/32 | FileCheck %s --check-prefixes=CHECK,LA32
+
+; RUN: llvm-as %t/64.ll -o %t/64.o
+; RUN: ld.lld %t/64.o -o %t/64
+; RUN: llvm-readobj -h %t/64 | FileCheck %s --check-prefixes=CHECK,LA64
+
+; LA32:    Class: 32-bit
+; LA64:    Class: 64-bit
+; CHECK:   DataEncoding: LittleEndian
+; CHECK: Machine: EM_LOONGARCH
+
+;--- 32.ll
+target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
+target triple = "loongarch32-unknown-elf"
+
+define void @_start() {
+  ret void
+}
+
+;--- 64.ll
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
+target triple = "loongarch64-unknown-elf"
+
+define void @_start() {
+  ret void
+}

@GongMengyao
Copy link
Contributor Author

@SixWeining

@SixWeining SixWeining merged commit c072247 into llvm:main Nov 24, 2023
5 checks passed
Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Nov 30, 2023
Local branch amd-gfx 94e1716 Merged main:ea81e31aa11c into amd-gfx:376ca00d5225
Remote branch main c072247 [lld][ELF] Add getBitcodeMachineKind test for LoongArch (llvm#71931)
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