[lld] [LLD][COFF] Add support for ARM64X same-address thunks (PR #151255)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 09:04:41 PDT 2025
================
@@ -328,6 +328,22 @@ void LinkerDriver::parseSwaprun(StringRef arg) {
} while (!arg.empty());
}
+void LinkerDriver::parseSameAddress(StringRef arg) {
+ auto mangledName = getArm64ECMangledFunctionName(arg);
+ Symbol *sym = ctx.symtab.addUndefined(mangledName ? *mangledName : arg);
+
+ // MSVC appears to generate thunks even for non-hybrid ARM64EC images.
+ // As a side effect, the native symbol is pulled in. Since this is used
+ // in the CRT for thread-local constructors, it results in the image
+ // containing unnecessary native code. As these thunks don't appear to
+ // be useful, we limit this behavior to actual hybrid targets. This may
+ // change if compatibility becomes necessary.
+ if (ctx.config.machine != ARM64X)
----------------
cjacek wrote:
Yes, it can be handled via the command line, but as you said, arm64x needs to be specified explicitly (as does arm64ec; see #116281), so the check should be safe. And yes, I would expect it to be passed through directives anyway (I don't expect it to be widely used in application code, but its use in the CRT itself makes it relevant).
https://github.com/llvm/llvm-project/pull/151255
More information about the llvm-commits
mailing list