================ @@ -534,8 +534,18 @@ 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()) { + CmdArgs.push_back("-X"); + if (Args.hasArg(options::OPT_mno_relax)) + CmdArgs.push_back("--no-relax"); + if (const char *LDMOption = getLDMOption(TC.getTriple(), Args)) { + CmdArgs.push_back("-m"); + CmdArgs.push_back(LDMOption); + } else { + D.Diag(diag::err_target_unknown_triple) << Triple.str(); + return; + } ---------------- petrhosek wrote:
Can you also swap the order of the `-m` option to be the same as in the `Gnu` driver? ```suggestion if (const char *LDMOption = getLDMOption(TC.getTriple(), Args)) { CmdArgs.push_back("-m"); CmdArgs.push_back(LDMOption); } else { D.Diag(diag::err_target_unknown_triple) << Triple.str(); return; } CmdArgs.push_back("-X"); if (Args.hasArg(options::OPT_mno_relax)) CmdArgs.push_back("--no-relax"); ``` In a follow up change, I'd like to move the `-m` out of this condition since it'd be also beneficial for other targets. https://github.com/llvm/llvm-project/pull/134442 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits