From: Leonard Chan Date: Wed, 1 Mar 2023 19:42:15 +0000 (+0000) Subject: [llvm] Prevent building for riscv32-unknown-fuchsia X-Git-Tag: upstream/17.0.6~16124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa6aadd6cb680f366fed50030f6a667ff30c33c9;p=platform%2Fupstream%2Fllvm.git [llvm] Prevent building for riscv32-unknown-fuchsia Fuchsia is exclusively 64-bit so this throw an error when using this triple. Differential Revision: https://reviews.llvm.org/D144998 --- diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp index 4b510df..5fcb94c 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp @@ -111,6 +111,9 @@ RISCVTargetMachine::RISCVTargetMachine(const Target &T, const Triple &TT, // RISC-V supports the MachineOutliner. setMachineOutliner(true); setSupportsDefaultOutlining(true); + + if (TT.isOSFuchsia() && !TT.isArch64Bit()) + report_fatal_error("Fuchsia is only supported for 64-bit"); } const RISCVSubtarget * diff --git a/llvm/test/CodeGen/RISCV/rv32-fuchsia.ll b/llvm/test/CodeGen/RISCV/rv32-fuchsia.ll new file mode 100644 index 0000000..c628ec7 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rv32-fuchsia.ll @@ -0,0 +1,6 @@ +; RUN: not --crash llc -mtriple=riscv32-unknown-fuchsia < %s 2>&1 | FileCheck %s + +; CHECK: LLVM ERROR: Fuchsia is only supported for 64-bit +define void @nothing() nounwind { + ret void +}