authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-17 01:17:54+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-06-11 18:27:17+02:00
log5e2b025f69ec0e811975c67b0eda5f11594225b9
tree618bcb920236ae68a588b64f2115cce73a2b1e66
parent879bc2e5cb614bdb1b7a2426c9746989089bccd3
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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 files changed, 7 insertions(+), 5 deletions(-)

src/zig_llvm.cpp+7-5
...@@ -484,20 +484,22 @@ bool ZigLLVMWriteImportLibrary(const char *def_path, unsigned int coff_machine,...@@ -484,20 +484,22 @@ bool ZigLLVMWriteImportLibrary(const char *def_path, unsigned int coff_machine,
484 }484 }
485 }485 }
486486
487 if (machine == COFF::IMAGE_FILE_MACHINE_I386 && kill_at) {487 if (kill_at) {
488 for (object::COFFShortExport& E : def->Exports) {488 for (object::COFFShortExport& E : def->Exports) {
489 if (!E.ImportName.empty() || (!E.Name.empty() && E.Name[0] == '?'))489 if (!E.ImportName.empty() || (!E.Name.empty() && E.Name[0] == '?'))
490 continue;490 continue;
491 E.SymbolName = E.Name;491 if (machine == COFF::IMAGE_FILE_MACHINE_I386) {
492 // By making sure E.SymbolName != E.Name for decorated symbols,
493 // writeImportLibrary writes these symbols with the type
494 // IMPORT_NAME_UNDECORATE.
495 E.SymbolName = E.Name;
496 }
492 // Trim off the trailing decoration. Symbols will always have a497 // Trim off the trailing decoration. Symbols will always have a
493 // starting prefix here (either _ for cdecl/stdcall, @ for fastcall498 // starting prefix here (either _ for cdecl/stdcall, @ for fastcall
494 // or ? for C++ functions). Vectorcall functions won't have any499 // or ? for C++ functions). Vectorcall functions won't have any
495 // fixed prefix, but the function base name will still be at least500 // fixed prefix, but the function base name will still be at least
496 // one char.501 // one char.
497 E.Name = E.Name.substr(0, E.Name.find('@', 1));502 E.Name = E.Name.substr(0, E.Name.find('@', 1));
498 // By making sure E.SymbolName != E.Name for decorated symbols,
499 // writeImportLibrary writes these symbols with the type
500 // IMPORT_NAME_UNDECORATE.
501 }503 }
502 }504 }
503505