================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to