Skip to content

Commit 2932d28

Browse files
committed
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 795fdba commit 2932d28

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/zig_llvm.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -484,20 +484,22 @@ bool ZigLLVMWriteImportLibrary(const char *def_path, unsigned int coff_machine,
484484
}
485485
}
486486

487-
if (machine == COFF::IMAGE_FILE_MACHINE_I386 && kill_at) {
487+
if (kill_at) {
488488
for (object::COFFShortExport& E : def->Exports) {
489489
if (!E.ImportName.empty() || (!E.Name.empty() && E.Name[0] == '?'))
490490
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+
}
492497
// Trim off the trailing decoration. Symbols will always have a
493498
// starting prefix here (either _ for cdecl/stdcall, @ for fastcall
494499
// or ? for C++ functions). Vectorcall functions won't have any
495500
// fixed prefix, but the function base name will still be at least
496501
// one char.
497502
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.
501503
}
502504
}
503505

0 commit comments

Comments
 (0)