[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)
Garvit Gupta via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 6 05:28:59 PST 2024
================
@@ -503,12 +624,22 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const llvm::Triple::ArchType Arch = TC.getArch();
const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
- AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA);
+ if (!D.SysRoot.empty())
+ CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
+ Args.addAllArgs(CmdArgs, {options::OPT_u});
----------------
quic-garvgupt wrote:
Sure, I will be making these changes in the next patchset. However, I wanted to clarify if there is any specific reason why, in the RISCVToolchain baremetal object, OPT_L and OPT_u are added separately before FilePathLibArgs, and then subsequently the rest of the OPT_* options are added. https://github.com/llvm/llvm-project/blob/89e919fb0df391da42dbfd48cd8de268335fe672/clang/lib/Driver/ToolChains/RISCVToolchain.cpp#L201
I understand that for gnuld, the order in which flags and object files appear on the command line is relevant, unlike for lld. Was this intentional? If so, I will maintain that behavior; otherwise, I will add them in a single `addAllArgs(...)` function.
https://github.com/llvm/llvm-project/pull/118809
More information about the cfe-commits
mailing list