[lld] [LLD][COFF] Add support for the -defArm64Native argument (PR #123850)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 01:46:31 PST 2025


================
@@ -2291,6 +2291,12 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
   if (auto *arg = args.getLastArg(OPT_deffile)) {
     // parseModuleDefs mutates Config object.
     mainSymtab.parseModuleDefs(arg->getValue());
+    if (ctx.hybridSymtab) {
+      // MSVC ignores the /defArm64Native argument on non-ARM64X targets.
+      // It is also ignored if the /def option is not specified.
+      if (auto *arg = args.getLastArg(OPT_defarm64native))
+        ctx.symtab.parseModuleDefs(arg->getValue());
----------------
mstorsjo wrote:

Side note: The naming of the variables constantly feels unintuitive to me here, where `mainSymtab` is the EC symbol table, while `ctx.symtab` (which similarly feels like the "main" one) is the native one.

We can't probably do much about it, because this is how the linker is supposed to be have, if mimicing link.exe, but we perhaps make it clearer. I think it would be good to have a comment on the definition of `mainSymtab` to really spell out what it is, and why.

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


More information about the llvm-commits mailing list