[llvm-branch-commits] [clang] [RISCV][Driver] Add riscv emulation mode to linker job of BareMetal toolchain (PR #134442)
Petr Hosek via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 15 01:13:07 PDT 2025
================
@@ -534,8 +534,14 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-Bstatic");
- if (TC.getTriple().isRISCV() && Args.hasArg(options::OPT_mno_relax))
- CmdArgs.push_back("--no-relax");
+ if (Triple.isRISCV()) {
+ if (Args.hasArg(options::OPT_mno_relax))
+ CmdArgs.push_back("--no-relax");
+ CmdArgs.push_back("-m");
+ CmdArgs.push_back(Arch == llvm::Triple::riscv64 ? "elf64lriscv"
+ : "elf32lriscv");
----------------
petrhosek wrote:
I think it'd be cleaner to move https://github.com/llvm/llvm-project/blob/0f526498a1b0819055d1094fd9850fdbcab5b903/clang/lib/Driver/ToolChains/Gnu.cpp#L224-L292 to https://github.com/llvm/llvm-project/blob/0f526498a1b0819055d1094fd9850fdbcab5b903/clang/lib/Driver/ToolChains/CommonArgs.cpp and then use it here rather than duplicating this logic in two places.
https://github.com/llvm/llvm-project/pull/134442
More information about the llvm-branch-commits
mailing list