mingw libc: solve the segfault having to do with destructors

* fixed --verbose-cc printing an extra "zig" before the rest of
   the command line
 * windows-gnu targets use libfoo.a, foo.o extensions to match mingw
   conventions.
This commit is contained in:
Andrew Kelley
2019-07-12 14:44:34 -04:00
parent d9c4c96bf2
commit 7b8ba871a9
4 changed files with 29 additions and 18 deletions

View File

@@ -993,7 +993,9 @@ bool target_allows_addr_zero(const ZigTarget *target) {
}
const char *target_o_file_ext(const ZigTarget *target) {
if (target->abi == ZigLLVM_MSVC || target->os == OsWindows || target->os == OsUefi) {
if (target->abi == ZigLLVM_MSVC ||
(target->os == OsWindows && !target_abi_is_gnu(target->abi)) ||
target->os == OsUefi) {
return ".obj";
} else {
return ".o";
@@ -1021,7 +1023,10 @@ const char *target_exe_file_ext(const ZigTarget *target) {
}
const char *target_lib_file_prefix(const ZigTarget *target) {
if (target->os == OsWindows || target->os == OsUefi || target_is_wasm(target)) {
if ((target->os == OsWindows && !target_abi_is_gnu(target->abi)) ||
target->os == OsUefi ||
target_is_wasm(target))
{
return "";
} else {
return "lib";
@@ -1036,7 +1041,11 @@ const char *target_lib_file_ext(const ZigTarget *target, bool is_static,
}
if (target->os == OsWindows || target->os == OsUefi) {
if (is_static) {
return ".lib";
if (target->os == OsWindows && target_abi_is_gnu(target->abi)) {
return ".a";
} else {
return ".lib";
}
} else {
return ".dll";
}