efriedma 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.
----------------
jacek wrote:
> 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?
From what I recall, I wrote the code here primarily to deal with issues trying 
to take the address of a function; even if the function is defined in arm64ec 
code, the address is the unmangled symbol.  So there's some weirdness there 
involving symbol lookup even before there's any actual x64 code involved.

If you have a better idea of how external symbol references are supposed to be 
emitted, I'd appreciate a brief writeup, since all the information I have comes 
from trying to read dumpbin dumps of MSVC output.


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