| ... | @@ -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 | } |
| 486 | | 486 | |
| 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 a | 497 | // Trim off the trailing decoration. Symbols will always have a |
| 493 | // starting prefix here (either _ for cdecl/stdcall, @ for fastcall | 498 | // starting prefix here (either _ for cdecl/stdcall, @ for fastcall |
| 494 | // or ? for C++ functions). Vectorcall functions won't have any | 499 | // or ? for C++ functions). Vectorcall functions won't have any |
| 495 | // fixed prefix, but the function base name will still be at least | 500 | // 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 | } |
| 503 | | 505 | |