diff --git a/.github/workflows/gcc-compat.yml b/.github/workflows/gcc-compat.yml index 1be190cc5c..2f160388bf 100644 --- a/.github/workflows/gcc-compat.yml +++ b/.github/workflows/gcc-compat.yml @@ -27,6 +27,7 @@ jobs: - 13 - 14 - 15 + - 16 steps: - name: Install build dependencies diff --git a/general/package/all-patches/cmake/0002-bootstrap-guard-ghs-multi-include-gcc16.patch b/general/package/all-patches/cmake/0002-bootstrap-guard-ghs-multi-include-gcc16.patch new file mode 100644 index 0000000000..989612cd0b --- /dev/null +++ b/general/package/all-patches/cmake/0002-bootstrap-guard-ghs-multi-include-gcc16.patch @@ -0,0 +1,42 @@ +From: OpenIPC +Subject: [PATCH] Source/cmake.cxx: gate cmGlobalGhsMultiGenerator include behind CMAKE_BOOTSTRAP + +The single reference to cmGlobalGhsMultiGenerator in cmake.cxx (line 3014, +'this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());') +is already wrapped in '#if !defined(CMAKE_BOOTSTRAP)', so the GHS generator +is intentionally excluded from the bootstrap cmake build. + +The matching '#include "cmGlobalGhsMultiGenerator.h"' on line 132, however, +is only gated by host OS, not by CMAKE_BOOTSTRAP. GCC <= 15 + glibc didn't +care because the inline 'NewFactory()' was never ODR-used, so the +'cmGlobalGeneratorSimpleFactory' template +specialization never got emitted. Under GCC 16 the template specialization +is emitted anyway (more aggressive vague-linkage emission / speculative +devirtualization), and host-cmake's bootstrap link fails: + + cmake.cxx:(.text+0xbfee): undefined reference to + 'cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake*)' + cmake.cxx:(.text+0xce91): undefined reference to + 'cmGlobalGhsMultiGenerator::GetDocumentation()' + +because cmGlobalGhsMultiGenerator.cxx is (correctly) not in the bootstrap +source list. + +Wrap the include in the same CMAKE_BOOTSTRAP guard as the use site — same +pattern as the existing cmGlobalXCodeGenerator block just below. The +non-bootstrap host-cmake build is unaffected. + +--- a/Source/cmake.cxx ++++ b/Source/cmake.cxx +@@ -128,9 +128,11 @@ + + // NOTE: the __linux__ macro is predefined on Android host too, but + // main CMakeLists.txt filters out this generator by host name. ++#if !defined(CMAKE_BOOTSTRAP) + #if (defined(__linux__) && !defined(__ANDROID__)) || defined(_WIN32) + # include "cmGlobalGhsMultiGenerator.h" + #endif ++#endif + + #if defined(__APPLE__) + # if !defined(CMAKE_BOOTSTRAP) diff --git a/general/package/all-patches/dtc/0001-fix-const-discarding-gcc16.patch b/general/package/all-patches/dtc/0001-fix-const-discarding-gcc16.patch new file mode 100644 index 0000000000..ae6cf8c2f0 --- /dev/null +++ b/general/package/all-patches/dtc/0001-fix-const-discarding-gcc16.patch @@ -0,0 +1,48 @@ +From: OpenIPC +Subject: [PATCH] Fix const-discarding-qualifier errors with GCC 16 + +Starting with GCC 15 and especially GCC 16 + recent glibc, the _Generic +wrappers for memchr() / strchr() / strrchr() return a const-qualified +pointer when the input argument is const-qualified. With dtc's default +-Werror, this turns previously-silent assignments into hard build errors: + + libfdt/fdt_overlay.c:446: assignment discards 'const' qualifier from + pointer target type [-Werror=discarded-qualifiers] + fdtput.c:235: assignment discards 'const' qualifier from pointer target + type [-Werror=discarded-qualifiers] + +In fdt_overlay.c the local 'sep' is only read through (used for pointer +arithmetic and dereferences for the ':' check, never to write), so it can +be retyped to const char* without functional change. 'endptr' is split +out as its own declaration so strtoul() still has a non-const char** +output parameter. + +In fdtput.c::create_node() the function actually writes through the +returned pointer ('*p = \'\\0\';'), which means the const on the +'node_name' parameter has always been a lie about effects on the caller. +The function is called with argv elements (plain char*) only, so drop +the const from the parameter to match the actual semantics. + +--- a/libfdt/fdt_overlay.c ++++ b/libfdt/fdt_overlay.c +@@ -432,7 +432,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, + const char *fixup_str = value; + uint32_t path_len, name_len; + uint32_t fixup_len; +- char *sep, *endptr; ++ const char *sep; ++ char *endptr; + int poffset, ret; + + fixup_end = memchr(value, '\0', len); +--- a/fdtput.c ++++ b/fdtput.c +@@ -227,7 +227,7 @@ static int store_key_value(char **blob, const char *node_name, + * @param node_name Name of node to create + * @return new node offset if found, or -1 on failure + */ +-static int create_node(char **blob, const char *node_name) ++static int create_node(char **blob, char *node_name) + { + int node = 0; + char *p;