[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:49 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"};
+  case ARM64EC:
+    return {"arm64ec-pc-windows-msvc"};
----------------
mstorsjo wrote:

I'm a little unsure about what the best thing to do for ARM64EC is here.

@cjacek, what does Clang do for the per-target-runtime directories? I would think that it just gets the plain `aarch64` target.

For the compiler-rt builtins, for the non-per-target-runtime form (`lib/windows/clang_rt.<arch>.lib`), I do know that it treats arm64ec as plain aarch64. This is required for having ARM64X linking working, when you need to pass the same file for both aarch64 and arm64ec.

I think keeping arm64ec equal to aarch64 is the simplest thing to do here. I don't think the main LLVM runtimes often are built for arm64ec with the per-target runtime directories though. (And again, if it needs to work for ARM64X, it needs to be the same as for aarch64 anyway.)

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


More information about the llvm-commits mailing list