[lld] [LLD][COFF] Add support for ARM64X same-address thunks (PR #151255)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 05:03:25 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)
----------------
mstorsjo wrote:
This option can be handled on the command line, too, right? In that case, the machine probably isn't known yet (unless explicitly specified)? Then again, arm64x mode isn't ever really implied, it is always specified explicitly with `-machine:arm64x`, so this is probably fine. (Plus, this is mostly passed in practice through directives in object files in practice anyway, I guess.)
https://github.com/llvm/llvm-project/pull/151255
More information about the llvm-commits
mailing list