[llvm] [aarch64][win] Add support for import call optimization (equivalent to MSVC /d2ImportCallOptimization) (PR #121516)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 15:07:54 PST 2025


================
@@ -921,6 +931,15 @@ void AArch64AsmPrinter::emitEndOfAsmFile(Module &M) {
   // Emit stack and fault map information.
   FM.serializeToFaultMapSection();
 
+  // If import call optimization is enabled, emit the appropriate section.
+  // We do this whether or not we recorded any import calls.
+  if (EnableImportCallOptimization && TT.isOSBinFormatCOFF()) {
+    OutStreamer->switchSection(getObjFileLowering().getImportCallSection());
+
+    // Section always starts with some magic.
+    constexpr char ImpCallMagic[12] = "Imp_Call_V1";
+    OutStreamer->emitBytes(StringRef(ImpCallMagic, sizeof(ImpCallMagic)));
----------------
efriedma-quic wrote:

I think I'd prefer to make the assembler generate the magic number automatically, just so it's harder to mess up for people hand-writing asm.

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


More information about the llvm-commits mailing list