[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 09:35:41 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:

If this is 0, won't this end up with a rather bogus instruction sequence? Shouldn't we replace the adrp+add with a `mov x0, #0` or similar instead, in that case?

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


More information about the llvm-commits mailing list