From 879bc2e5cb614bdb1b7a2426c9746989089bccd3 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Fri, 16 May 2025 23:27:53 +0200 Subject: mingw: Update MinGW-w64 sources to 38c8142f660b6ba11e7c408f2de1e9f8bfaf839e. --- src/libs/mingw.zig | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'src/libs') diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig index 8b5197a43b..ef6dfa6275 100644 --- a/src/libs/mingw.zig +++ b/src/libs/mingw.zig @@ -154,7 +154,8 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre try addCcArgs(comp, arena, &winpthreads_args); try winpthreads_args.appendSlice(&[_][]const u8{ "-DIN_WINPTHREAD", - "-DWIN32_LEAN_AND_MEAN", + // winpthreads incorrectly assumes that Clang has `-Wprio-ctor-dtor`. + "-Wno-unknown-warning-option", }); switch (comp.compilerRtOptMode()) { @@ -485,7 +486,6 @@ const mingw32_generic_src = [_][]const u8{ "crt" ++ path.sep_str ++ "pesect.c", "crt" ++ path.sep_str ++ "udllargc.c", "crt" ++ path.sep_str ++ "xthdloc.c", - "crt" ++ path.sep_str ++ "CRT_fp10.c", "crt" ++ path.sep_str ++ "mingw_helpers.c", "crt" ++ path.sep_str ++ "pseudo-reloc.c", "crt" ++ path.sep_str ++ "udll_argv.c", @@ -609,7 +609,6 @@ const mingw32_generic_src = [_][]const u8{ "misc" ++ path.sep_str ++ "delayimp.c", "misc" ++ path.sep_str ++ "dirent.c", "misc" ++ path.sep_str ++ "dirname.c", - "misc" ++ path.sep_str ++ "dllentrypoint.c", "misc" ++ path.sep_str ++ "dllmain.c", "misc" ++ path.sep_str ++ "feclearexcept.c", "misc" ++ path.sep_str ++ "fegetenv.c", @@ -621,10 +620,14 @@ const mingw32_generic_src = [_][]const u8{ "misc" ++ path.sep_str ++ "fesetexceptflag.c", "misc" ++ path.sep_str ++ "fesetround.c", "misc" ++ path.sep_str ++ "fetestexcept.c", + "misc" ++ path.sep_str ++ "mingw_controlfp.c", + "misc" ++ path.sep_str ++ "mingw_setfp.c", "misc" ++ path.sep_str ++ "feupdateenv.c", "misc" ++ path.sep_str ++ "ftruncate.c", - "misc" ++ path.sep_str ++ "ftw.c", + "misc" ++ path.sep_str ++ "ftw32.c", + "misc" ++ path.sep_str ++ "ftw32i64.c", "misc" ++ path.sep_str ++ "ftw64.c", + "misc" ++ path.sep_str ++ "ftw64i32.c", "misc" ++ path.sep_str ++ "fwide.c", "misc" ++ path.sep_str ++ "getlogin.c", "misc" ++ path.sep_str ++ "getopt.c", @@ -669,12 +672,12 @@ const mingw32_generic_src = [_][]const u8{ "stdio" ++ path.sep_str ++ "_findfirst64i32.c", "stdio" ++ path.sep_str ++ "_findnext64i32.c", "stdio" ++ path.sep_str ++ "_fstat64i32.c", - "stdio" ++ path.sep_str ++ "_stat.c", "stdio" ++ path.sep_str ++ "_stat64i32.c", "stdio" ++ path.sep_str ++ "_wfindfirst64i32.c", "stdio" ++ path.sep_str ++ "_wfindnext64i32.c", - "stdio" ++ path.sep_str ++ "_wstat.c", "stdio" ++ path.sep_str ++ "_wstat64i32.c", + "stdio" ++ path.sep_str ++ "__mingw_fix_stat_path.c", + "stdio" ++ path.sep_str ++ "__mingw_fix_wstat_path.c", "stdio" ++ path.sep_str ++ "asprintf.c", "stdio" ++ path.sep_str ++ "fopen64.c", "stdio" ++ path.sep_str ++ "fseeko32.c", @@ -749,23 +752,36 @@ const mingw32_generic_src = [_][]const u8{ "stdio" ++ path.sep_str ++ "ucrt__vscprintf.c", "stdio" ++ path.sep_str ++ "ucrt__vsnprintf.c", "stdio" ++ path.sep_str ++ "ucrt__vsnwprintf.c", + "stdio" ++ path.sep_str ++ "ucrt___local_stdio_printf_options.c", + "stdio" ++ path.sep_str ++ "ucrt___local_stdio_scanf_options.c", "stdio" ++ path.sep_str ++ "ucrt_fprintf.c", "stdio" ++ path.sep_str ++ "ucrt_fscanf.c", "stdio" ++ path.sep_str ++ "ucrt_fwprintf.c", - "stdio" ++ path.sep_str ++ "ucrt_ms_fprintf.c", + "stdio" ++ path.sep_str ++ "ucrt_fwscanf.c", "stdio" ++ path.sep_str ++ "ucrt_ms_fwprintf.c", "stdio" ++ path.sep_str ++ "ucrt_printf.c", "stdio" ++ path.sep_str ++ "ucrt_scanf.c", "stdio" ++ path.sep_str ++ "ucrt_snprintf.c", + "stdio" ++ path.sep_str ++ "ucrt_snwprintf.c", "stdio" ++ path.sep_str ++ "ucrt_sprintf.c", "stdio" ++ path.sep_str ++ "ucrt_sscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_swscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_swprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vfprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vfscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_vfwscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_vfwprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vscanf.c", "stdio" ++ path.sep_str ++ "ucrt_vsnprintf.c", + "stdio" ++ path.sep_str ++ "ucrt_vsnwprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vsprintf.c", + "stdio" ++ path.sep_str ++ "ucrt_vswprintf.c", "stdio" ++ path.sep_str ++ "ucrt_vsscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_vwscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_wscanf.c", + "stdio" ++ path.sep_str ++ "ucrt_vwprintf.c", + "stdio" ++ path.sep_str ++ "ucrt_wprintf.c", "string" ++ path.sep_str ++ "ucrt__wcstok.c", // uuid "libsrc" ++ path.sep_str ++ "ativscp-uuid.c", @@ -889,6 +905,8 @@ const mingw32_generic_src = [_][]const u8{ }; const mingw32_x86_src = [_][]const u8{ + // mingw32 + "crt" ++ path.sep_str ++ "CRT_fp10.c", // mingwex "math" ++ path.sep_str ++ "cbrtl.c", "math" ++ path.sep_str ++ "erfl.c", @@ -971,11 +989,11 @@ const mingw32_x86_32_src = [_][]const u8{ const mingw32_arm_src = [_][]const u8{ // mingwex "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "ldexpl.c", + "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "sincosl.c", }; const mingw32_arm32_src = [_][]const u8{ // mingwex - "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "_chgsignl.S", "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rint.c", "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rintf.c", "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincos.S", @@ -983,7 +1001,6 @@ const mingw32_arm32_src = [_][]const u8{ const mingw32_arm64_src = [_][]const u8{ // mingwex - "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "_chgsignl.S", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincos.S", @@ -997,7 +1014,6 @@ const mingw32_winpthreads_src = [_][]const u8{ "winpthreads" ++ path.sep_str ++ "misc.c", "winpthreads" ++ path.sep_str ++ "mutex.c", "winpthreads" ++ path.sep_str ++ "nanosleep.c", - "winpthreads" ++ path.sep_str ++ "ref.c", "winpthreads" ++ path.sep_str ++ "rwlock.c", "winpthreads" ++ path.sep_str ++ "sched.c", "winpthreads" ++ path.sep_str ++ "sem.c", -- cgit v1.2.3 From 78d6f1c56aa3bca72c3f336b89626982631da2e7 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Wed, 11 Jun 2025 20:10:15 +0200 Subject: mingw: Fix def file preprocessing. This needs to actually set the target on the aro.Compilation so that we get the expected target-specific preprocessor macros defined. --- src/libs/mingw.zig | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/libs') diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig index ef6dfa6275..9454a9af25 100644 --- a/src/libs/mingw.zig +++ b/src/libs/mingw.zig @@ -295,18 +295,12 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { "o", &digest, final_def_basename, }); - const target_defines = switch (target.cpu.arch) { - .thumb => "#define DEF_ARM32\n", - .aarch64 => "#define DEF_ARM64\n", - .x86 => "#define DEF_I386\n", - .x86_64 => "#define DEF_X64\n", - else => unreachable, - }; - const aro = @import("aro"); var aro_comp = aro.Compilation.init(gpa, std.fs.cwd()); defer aro_comp.deinit(); + aro_comp.target = target; + const include_dir = try comp.dirs.zig_lib.join(arena, &.{ "libc", "mingw", "def-include" }); if (comp.verbose_cc) print: { @@ -321,7 +315,6 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { try aro_comp.include_dirs.append(gpa, include_dir); const builtin_macros = try aro_comp.generateBuiltinMacros(.include_system_defines); - const user_macros = try aro_comp.addSourceFromBuffer("", target_defines); const def_file_source = try aro_comp.addSourceFromPath(def_file_path); var pp = aro.Preprocessor.init(&aro_comp); @@ -329,7 +322,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { pp.linemarkers = .none; pp.preserve_whitespace = true; - try pp.preprocessSources(&.{ def_file_source, builtin_macros, user_macros }); + try pp.preprocessSources(&.{ def_file_source, builtin_macros }); for (aro_comp.diagnostics.list.items) |diagnostic| { if (diagnostic.kind == .@"fatal error" or diagnostic.kind == .@"error") { -- cgit v1.2.3