diff --git a/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch b/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch index a8e26c552..ad4c43506 100644 --- a/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch +++ b/openwrt/patch/generic/202-toolchain-gcc-add-support-for-GCC-15.patch @@ -55,7 +55,7 @@ index f5db99f..24c6535 100644 endif +ifeq ($(PKG_VERSION),15.0.0) -+ PKG_HASH:=ece90dcb6d14aa1db2b931aaef474b557df4924c54995e37827fe18528efe27b ++ PKG_HASH:=fc150b3d089a0d944096f4ec3e059811f6922e5888e5bac7d516de9fc5cf402b +endif + PATCH_DIR=../patches-$(GCC_MAJOR_VERSION).x diff --git a/openwrt/patch/openwrt-6.x/gcc-15/README.md b/openwrt/patch/openwrt-6.x/gcc-15/README.md new file mode 100644 index 000000000..e494d2d39 --- /dev/null +++ b/openwrt/patch/openwrt-6.x/gcc-15/README.md @@ -0,0 +1 @@ +### Fix build for GCC15 Snapshot diff --git a/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch b/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch new file mode 100644 index 000000000..8b73aed8a --- /dev/null +++ b/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch @@ -0,0 +1,40 @@ +From 40676fd44153c3d153db0fef3075daf665990764 Mon Sep 17 00:00:00 2001 +From: sbwml +Date: Wed, 17 Jul 2024 17:46:42 +0800 +Subject: [PATCH] backends: fix string initialization error on gcc15 + +Signed-off-by: sbwml +--- + backends/i386_regs.c | 2 +- + backends/x86_64_regs.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/backends/i386_regs.c b/backends/i386_regs.c +index 7ec93bb..4bca1b1 100644 +--- a/backends/i386_regs.c ++++ b/backends/i386_regs.c +@@ -83,7 +83,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)), + + switch (regno) + { +- static const char baseregs[][2] = ++ static const char baseregs[][3] = + { + "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip" + }; +diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c +index ef987da..c92c862 100644 +--- a/backends/x86_64_regs.c ++++ b/backends/x86_64_regs.c +@@ -80,7 +80,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)), + + switch (regno) + { +- static const char baseregs[][2] = ++ static const char baseregs[][3] = + { + "ax", "dx", "cx", "bx", "si", "di", "bp", "sp" + }; +-- +2.43.5 + diff --git a/openwrt/patch/openwrt-6.x/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch b/openwrt/patch/openwrt-6.x/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch new file mode 100644 index 000000000..088930831 --- /dev/null +++ b/openwrt/patch/openwrt-6.x/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch @@ -0,0 +1,15 @@ +diff --git a/plugins/ssh-base/crypto/chacha.c b/plugins/ssh-base/crypto/chacha.c +index 182280d..cb4c5bf 100644 +--- a/plugins/ssh-base/crypto/chacha.c ++++ b/plugins/ssh-base/crypto/chacha.c +@@ -59,8 +59,8 @@ typedef struct chacha_ctx chacha_ctx; + a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \ + c = PLUS(c,d); b = ROTATE(XOR(b,c), 7); + +-static const char sigma[16] = "expand 32-byte k"; +-static const char tau[16] = "expand 16-byte k"; ++static const char sigma[18] = "expand 32-byte k"; ++static const char tau[18] = "expand 16-byte k"; + + void + chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits) diff --git a/openwrt/patch/openwrt-6.x/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch b/openwrt/patch/openwrt-6.x/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch new file mode 100644 index 000000000..9724f4703 --- /dev/null +++ b/openwrt/patch/openwrt-6.x/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch @@ -0,0 +1,26 @@ +diff --git a/lib/crypt-port.h b/lib/crypt-port.h +index a707939..928a854 100644 +--- a/lib/crypt-port.h ++++ b/lib/crypt-port.h +@@ -473,7 +473,7 @@ make_failure_token (const char *setting, char *output, int size); + /* The base-64 encoding table used by most hashing methods. + (bcrypt uses a slightly different encoding.) Size 65 + because it's used as a C string in a few places. */ +-extern const unsigned char ascii64[65]; ++extern const unsigned char ascii64[68]; + + /* Same table gets used with other names in various places. */ + #define b64t ((const char *) ascii64) +diff --git a/lib/util-base64.c b/lib/util-base64.c +index d55461f..fdd545d 100644 +--- a/lib/util-base64.c ++++ b/lib/util-base64.c +@@ -20,7 +20,7 @@ + + #include "crypt-port.h" + +-const unsigned char ascii64[65] = ++const unsigned char ascii64[68] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + /* 0000000000111111111122222222223333333333444444444455555555556666 */ + /* 0123456789012345678901234567890123456789012345678901234567890123 */ diff --git a/openwrt/patch/openwrt-6.x/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch b/openwrt/patch/openwrt-6.x/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch new file mode 100644 index 000000000..a9baa9757 --- /dev/null +++ b/openwrt/patch/openwrt-6.x/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch @@ -0,0 +1,28 @@ +From 174eb9e201f84530d22c98c21e0c6a9d8d86dfac Mon Sep 17 00:00:00 2001 +From: sbwml +Date: Wed, 17 Jul 2024 17:18:48 +0800 +Subject: [PATCH] tests fix string initialization error on gcc15 + +Increase the size of the unsigned char ciphertext array from 32 to 34 to accommodate the full string and the null terminator, thereby fixing the initializer-string for array error in psa_exercise_key.c. + +Signed-off-by: sbwml +--- + tests/src/psa_exercise_key.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c +index 7105324..c1751d7 100644 +--- a/tests/src/psa_exercise_key.c ++++ b/tests/src/psa_exercise_key.c +@@ -150,7 +150,7 @@ static int exercise_cipher_key(mbedtls_svc_key_id_t key, + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_key_type_t key_type; + const unsigned char plaintext[16] = "Hello, world..."; +- unsigned char ciphertext[32] = "(wabblewebblewibblewobblewubble)"; ++ unsigned char ciphertext[34] = "(wabblewebblewibblewobblewubble)"; + size_t ciphertext_length = sizeof(ciphertext); + unsigned char decrypted[sizeof(ciphertext)]; + size_t part_length; +-- +2.43.5 + diff --git a/openwrt/scripts/05-fix-source.sh b/openwrt/scripts/05-fix-source.sh index abbb0f49f..efc68b51f 100644 --- a/openwrt/scripts/05-fix-source.sh +++ b/openwrt/scripts/05-fix-source.sh @@ -79,6 +79,19 @@ if [ "$USE_GCC14" = y ] || [ "$USE_GCC15" = y ]; then fi fi +# fix gcc-15 +if [ "$USE_GCC15" = y ]; then + # Mbedtls + curl -s https://$mirror/openwrt/patch/openwrt-6.x/gcc-15/mbedtls/901-tests-fix-string-initialization-error-on-gcc15.patch > package/libs/mbedtls/patches/901-tests-fix-string-initialization-error-on-gcc15.patch + # elfutils + curl -s https://$mirror/openwrt/patch/openwrt-6.x/gcc-15/elfutils/901-backends-fix-string-initialization-error-on-gcc15.patch > package/libs/elfutils/patches/901-backends-fix-string-initialization-error-on-gcc15.patch + # libwebsockets + curl -s https://$mirror/openwrt/patch/openwrt-6.x/gcc-15/libwebsockets/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libwebsockets/patches/901-fix-string-initialization-error-on-gcc15.patch + # libxcrypt + mkdir -p feeds/packages/libs/libxcrypt/patches + curl -s https://$mirror/openwrt/patch/openwrt-6.x/gcc-15/libxcrypt/901-fix-string-initialization-error-on-gcc15.patch > feeds/packages/libs/libxcrypt/patches/901-fix-string-initialization-error-on-gcc15.patch +fi + # xdp-tools [ "$platform" != "x86_64" ] && sed -i '/TARGET_LDFLAGS +=/iTARGET_CFLAGS += -Wno-error=maybe-uninitialized -ffat-lto-objects\n' package/network/utils/xdp-tools/Makefile [ "$platform" = "x86_64" ] && sed -i '/TARGET_LDFLAGS +=/iTARGET_CFLAGS += -ffat-lto-objects\n' package/network/utils/xdp-tools/Makefile