[lld] r364996 - [ELF][RISCV] Support RISC-V in getBitcodeMachineKind
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 19:13:11 PDT 2019
Author: kito
Date: Tue Jul 2 19:13:11 2019
New Revision: 364996
URL: http://llvm.org/viewvc/llvm-project?rev=364996&view=rev
Log:
[ELF][RISCV] Support RISC-V in getBitcodeMachineKind
Add Triple::riscv64 and Triple::riscv32 to getBitcodeMachineKind for get right
e_machine during LTO.
Reviewed By: ruiu, MaskRay
Differential Revision: https://reviews.llvm.org/D52165
Added:
lld/trunk/test/ELF/lto/riscv32.ll
lld/trunk/test/ELF/lto/riscv64.ll
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=364996&r1=364995&r2=364996&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Jul 2 19:13:11 2019
@@ -1402,6 +1402,9 @@ static uint8_t getBitcodeMachineKind(Str
case Triple::ppc64:
case Triple::ppc64le:
return EM_PPC64;
+ case Triple::riscv32:
+ case Triple::riscv64:
+ return EM_RISCV;
case Triple::x86:
return T.isOSIAMCU() ? EM_IAMCU : EM_386;
case Triple::x86_64:
Added: lld/trunk/test/ELF/lto/riscv32.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/riscv32.ll?rev=364996&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/riscv32.ll (added)
+++ lld/trunk/test/ELF/lto/riscv32.ll Tue Jul 2 19:13:11 2019
@@ -0,0 +1,10 @@
+; REQUIRES: riscv
+
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
+target triple = "riscv32-unknown-elf"
+
+define void @f() {
+ ret void
+}
Added: lld/trunk/test/ELF/lto/riscv64.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/riscv64.ll?rev=364996&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/riscv64.ll (added)
+++ lld/trunk/test/ELF/lto/riscv64.ll Tue Jul 2 19:13:11 2019
@@ -0,0 +1,10 @@
+; REQUIRES: riscv
+
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
+target triple = "riscv64-unknown-elf"
+
+define void @f() {
+ ret void
+}
More information about the llvm-commits
mailing list