[lld] [lld][COFF] Add per-target runtime directories to library search path (PR #227744)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 13:56:48 PDT 2026


================
@@ -204,6 +204,23 @@ static bool compatibleMachineType(COFFLinkerContext &ctx, MachineTypes mt) {
   }
 }
 
+static std::optional<std::string>
+perTargetRuntimeDirForMachineType(MachineTypes mt) {
+  switch (mt) {
+  case ARM64:
+  case ARM64X:
+    return {"aarch64-pc-windows-msvc"};
----------------
mstorsjo wrote:

I meant to say that in addition to `-pc-windows-msvc`, the triples can also be `-w64-windows-gnu` for mingw targets (or `-pc-windows-gnu` which also is used in some places).

But on the other hand - lld-link is invoked standalone mostly in MSVC scenarios. In mingw scenarios, it's called by the compiler driver, which injects all the paths that are needed. So we probably don't need to handle the mingw cases here after all.

It might be good to spell this out in the commit message (i.e. the PR description) so that this aspect is made clear, that it is known and considered.

When reading further, I see that the call to this function is gated behind `if (!ctx.config.mingw)` - that's good. I guess that's even more reason to explain it in the commit message.



https://github.com/llvm/llvm-project/pull/227744


More information about the llvm-commits mailing list