diff --git a/Dockerfile b/Dockerfile index 6b91666..61b2a8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,8 @@ COPY src/w64devkit.ico src/alias.c $PREFIX/src/ FROM base AS dl-cross ARG BINUTILS_VERSION=2.46.0 \ BINUTILS_SHA256=d75a94f4d73e7a4086f7513e67e439e8fcdcbb726ffe63f4661744e6256b2cf2 \ - GCC_VERSION=15.2.0 \ - GCC_SHA256=438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e \ + GCC_VERSION=16.1.0 \ + GCC_SHA256=50efb4d94c3397aff3b0d61a5abd748b4dd31d9d3f2ab7be05b171d36a510f79 \ GMP_VERSION=6.3.0 \ GMP_SHA256=a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 \ MINGW_VERSION=14.0.0 \ @@ -256,6 +256,7 @@ RUN cat $PREFIX/src/gcc-*.patch | patch -d/dl/gcc -p1 \ --enable-languages=c,c++,fortran \ --enable-libgomp \ --enable-threads=posix \ + --enable-tls \ --enable-version-specific-runtime-libs \ --disable-libstdcxx-verbose \ --disable-dependency-tracking \ @@ -424,6 +425,7 @@ RUN echo 'BEGIN {print "pecoff"}' \ --enable-languages=c,c++,fortran \ --enable-libgomp \ --enable-threads=posix \ + --enable-tls \ --enable-version-specific-runtime-libs \ --disable-libstdcxx-verbose \ --disable-dependency-tracking \ diff --git a/src/gcc-dynamic-load-tzdb.patch b/src/gcc-dynamic-load-tzdb.patch new file mode 100644 index 0000000..7dcd083 --- /dev/null +++ b/src/gcc-dynamic-load-tzdb.patch @@ -0,0 +1,24 @@ +diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc +index d79b61ad673..7c223ac0faa 100644 +--- a/libstdc++-v3/src/c++20/tzdb.cc ++++ b/libstdc++-v3/src/c++20/tzdb.cc +@@ -1775,6 +1775,19 @@ namespace std::chrono + string_view + detect_windows_zone() noexcept + { ++#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 ++ static const HMODULE kernel32 = LoadLibraryW(L"kernel32.dll"); ++ using GetDynamicTimeZoneInformation_t = ++ DWORD (WINAPI *) (PDYNAMIC_TIME_ZONE_INFORMATION); ++ static auto *const GetDynamicTimeZoneInformation = ++ reinterpret_cast( ++ GetProcAddress(kernel32, "GetDynamicTimeZoneInformation")); ++ // MSVC's implementation dynamically loads `icu.dll`. It won't ++ // work until Windows 10 v1903. So we simply "fail as expected". ++ if (!GetDynamicTimeZoneInformation) ++ return {}; ++#endif ++ + DYNAMIC_TIME_ZONE_INFORMATION information{}; + if (GetDynamicTimeZoneInformation(&information) == TIME_ZONE_ID_INVALID) + return {}; diff --git a/src/gcc-libgfortran-mapview.patch b/src/gcc-libgfortran-mapview.patch new file mode 100644 index 0000000..cf965c6 --- /dev/null +++ b/src/gcc-libgfortran-mapview.patch @@ -0,0 +1,21 @@ +Use MapViewOfFileEx for libgfortran caf_shmem on Windows. + +GCC 16 started using MapViewOfFileExNuma here, but mingw-w64 only +declares that API for newer Windows targets. w64devkit keeps an older +target, and this code does not need NUMA placement: NUMA_NO_PREFERRED_NODE +is equivalent to no NUMA preference. MapViewOfFileEx still accepts the +requested base address and is available on older Windows targets. + +--- a/libgfortran/caf/shmem/shared_memory.c ++++ b/libgfortran/caf/shmem/shared_memory.c +@@ -234,8 +234,8 @@ shared_memory_init (shared_memory_act *mem, size_t size) + } + #elif defined(WIN32) + mem->glbl.base +- = (LPTSTR) MapViewOfFileExNuma (mem->shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, +- size, base_ptr, NUMA_NO_PREFERRED_NODE); ++ = (LPTSTR) MapViewOfFileEx (mem->shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, ++ size, base_ptr); + if (mem->glbl.base == NULL) + { + perror ("MapViewOfFile failed"); diff --git a/src/gcc-stdcall-align.patch b/src/gcc-stdcall-align.patch deleted file mode 100644 index e69fe83..0000000 --- a/src/gcc-stdcall-align.patch +++ /dev/null @@ -1,33 +0,0 @@ -GCC requires 16-byte stack alignment on function entry, but x86 calling -conventions only provide 4-byte alignment. Entry points, such as thread -procedures, callbacks, and process entry points, are likely called on a -stack not aligned to GCC's expectations. Since these functions are also -typically __stdcall, silently add the force_align_arg_pointer attribute -to such functions so that GCC re-aligns the stack. - -Note: main, wmain, WinMain, and wWinMain are special cases which the CRT -calls with 16-byte alignment. - ---- a/gcc/config/i386/i386-options.cc -+++ b/gcc/config/i386/i386-options.cc -@@ -3689,7 +3689,7 @@ - arguments as in struct attribute_spec.handler. */ - - static tree --ix86_handle_cconv_attribute (tree *node, tree name, tree args, int, -+ix86_handle_cconv_attribute (tree *node, tree name, tree args, int flags, - bool *no_add_attrs) - { - if (TREE_CODE (*node) != FUNCTION_TYPE -@@ -3773,6 +3773,11 @@ - sseregparm. */ - else if (is_attribute_p ("stdcall", name)) - { -+ if (!TARGET_64BIT) -+ { -+ tree attr = tree_cons (get_identifier ("force_align_arg_pointer"), NULL_TREE, NULL_TREE); -+ decl_attributes (node, attr, flags); -+ } - if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node))) - { - error ("stdcall and cdecl attributes are not compatible");