[K/N] Fix mingw_x86 compilation

It was broken in 9ed97a27f1.
This commit is contained in:
Sergey Bogolepov
2021-07-12 13:45:26 +07:00
committed by Space
parent 447900c3f2
commit 118889add5
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -928,7 +928,7 @@ linkerDynamicFlags.mingw_x86 = -shared
linkerKonanFlags.mingw_x86 = -static-libgcc -static-libstdc++ \
-Wl,--dynamicbase \
-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive,-Bdynamic \
-Wl,--defsym,__cxa_demangle=Konan_cxa_demangle
-Wl,--defsym,__cxa_demangle=_Konan_cxa_demangle
mimallocLinkerDependencies.mingw_x86 = -lbcrypt
linkerOptimizationFlags.mingw_x86 = -Wl,--gc-sections
runtimeDefinitions.mingw_x86 = USE_GCC_UNWIND=1 USE_PE_COFF_SYMBOLS=1 KONAN_WINDOWS=1 \
@@ -480,11 +480,16 @@ class MingwLinker(targetProperties: MingwConfigurables)
if (HostManager.hostIsMingw) {
lldCompatibilityChecker?.let { checkLldCompatibiity ->
// -### flag allows to avoid actual linkage process.
val konanCxaDemangleSymbol = when (target) {
KonanTarget.MINGW_X64 -> "Konan_cxa_demangle"
KonanTarget.MINGW_X86 -> "_Konan_cxa_demangle"
else -> error("Unexpected target: $target")
}
val lldCommand = Command(linker).constructLinkerArguments(
// Add -fuse-ld to the end of the list to override previous appearances.
additionalArguments = listOf("-fuse-ld=$absoluteLldLocation", "-Wl,-###"),
// LLD doesn't support defsym.
skipDefaultArguments = listOf("-Wl,--defsym,__cxa_demangle=Konan_cxa_demangle")
skipDefaultArguments = listOf("-Wl,--defsym,__cxa_demangle=$konanCxaDemangleSymbol")
)
checkLldCompatibiity(lldCommand)
}