Commit 5e2b025f69

Alex Rønne Petersen <alex@alexrp.com>
2025-05-17 01:17:54
zig_llvm: Strip @<n> suffix from .def symbols on all targets.
We have to do this because upstream MinGW-w64 now has symbols in lib-common/ which are unconditionally decorated with @<n>.
1 parent 879bc2e
Changed files (1)
src/zig_llvm.cpp
@@ -484,20 +484,22 @@ bool ZigLLVMWriteImportLibrary(const char *def_path, unsigned int coff_machine,
         }
     }
 
-    if (machine == COFF::IMAGE_FILE_MACHINE_I386 && kill_at) {
+    if (kill_at) {
         for (object::COFFShortExport& E : def->Exports) {
             if (!E.ImportName.empty() || (!E.Name.empty() && E.Name[0] == '?'))
                 continue;
-            E.SymbolName = E.Name;
+            if (machine == COFF::IMAGE_FILE_MACHINE_I386) {
+                // By making sure E.SymbolName != E.Name for decorated symbols,
+                // writeImportLibrary writes these symbols with the type
+                // IMPORT_NAME_UNDECORATE.
+                E.SymbolName = E.Name;
+            }
             // Trim off the trailing decoration. Symbols will always have a
             // starting prefix here (either _ for cdecl/stdcall, @ for fastcall
             // or ? for C++ functions). Vectorcall functions won't have any
             // fixed prefix, but the function base name will still be at least
             // one char.
             E.Name = E.Name.substr(0, E.Name.find('@', 1));
-            // By making sure E.SymbolName != E.Name for decorated symbols,
-            // writeImportLibrary writes these symbols with the type
-            // IMPORT_NAME_UNDECORATE.
         }
     }