jacek added inline comments.

================
Comment at: llvm/lib/Target/AArch64/AArch64MCInstLower.cpp:51-54
+    // For ARM64EC, symbol lookup in the MSVC linker has limited awareness
+    // of ARM64EC mangling ("#"/"$$h"). So object files need to refer to both
+    // the mangled and unmangled names of ARM64EC symbols, even if they aren't
+    // actually used by any relocations. Emit the necessary references here.
----------------
I think that mangled weak symbol should link to another kind exit thunk, not to 
unmangled symbol directly.

When an extern code symbol is resolved by an unmangled name, it means that we 
have ARM64EC->X64 call and we need to use an exit thunk. Linker doesn't need a 
special logic for that: on MSVC it seems to be achieved by pointing the 
antidependency symbol to yet another exit thunk. That other exit thunk loads 
the target exit thunk and X64 (unmangled) symbol into x10, x11 and uses 
__os_arm64x_dispatch_icall to call emulator. I guess we may worry about that 
later, but in that case maybe it's better not to emit mangled antidependency 
symbol at all for now?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157547/new/

https://reviews.llvm.org/D157547

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to