[lld] [LLD][COFF] Add support for ARM64EC import call thunks. (PR #107931)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 14:13:56 PDT 2024


================
@@ -1093,4 +1093,21 @@ void CHPERedirectionChunk::writeTo(uint8_t *buf) const {
   }
 }
 
+ImportThunkChunkARM64EC::ImportThunkChunkARM64EC(ImportFile *file)
+    : ImportThunkChunk(file->ctx, file->impSym), file(file) {}
+
+void ImportThunkChunkARM64EC::writeTo(uint8_t *buf) const {
+  memcpy(buf, importThunkARM64EC, sizeof(importThunkARM64EC));
+  applyArm64Addr(buf, file->impSym->getRVA(), rva, 12);
+  applyArm64Ldr(buf + 4, file->impSym->getRVA() & 0xfff);
+
+  uint32_t exitThunkRVA = exitThunk ? exitThunk->getRVA() : 0;
----------------
mstorsjo wrote:

Ok, fair enough. So if the symbol is missing, we end up with RVA 0, which ends up in producing an adrp+add pair that produces the image base address, which is passed to `__icall_helper_arm64ec`, which wouldn't use it in this case - that sounds ok with me.

Perhaps a comment, saying that this 0 case _can_ happen, but in these cases, the address ends up ignored - if I'm understanding the issue correctly?

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


More information about the llvm-commits mailing list