diff --git a/pkgs/by-name/mb/mbedtls/fix-gcc153-32bit.patch b/pkgs/by-name/mb/mbedtls/fix-gcc153-32bit.patch new file mode 100644 index 000000000000..c4015ecb4806 --- /dev/null +++ b/pkgs/by-name/mb/mbedtls/fix-gcc153-32bit.patch @@ -0,0 +1,14 @@ +diff --git a/library/common.h b/library/common.h +index 1f59b32426..8c756bcb07 100644 +--- a/library/common.h ++++ b/library/common.h +@@ -332,7 +332,8 @@ static inline void mbedtls_xor_no_simd(unsigned char *r, + uint32_t x = mbedtls_get_unaligned_uint32(a + i) ^ mbedtls_get_unaligned_uint32(b + i); + mbedtls_put_unaligned_uint32(r + i, x); + } +-#if defined(__IAR_SYSTEMS_ICC__) ++#if defined(__IAR_SYSTEMS_ICC__) || \ ++ (defined(MBEDTLS_COMPILER_IS_GCC) && MBEDTLS_GCC_VERSION >= 150300) + if (n % 4 == 0) { + return; + } diff --git a/pkgs/by-name/mb/mbedtls/package.nix b/pkgs/by-name/mb/mbedtls/package.nix index 44fde80fa51d..3bf8e310d0ba 100644 --- a/pkgs/by-name/mb/mbedtls/package.nix +++ b/pkgs/by-name/mb/mbedtls/package.nix @@ -1,4 +1,9 @@ -{ callPackage, fetchurl }: +{ + lib, + stdenv, + callPackage, + fetchurl, +}: callPackage ./generic.nix { version = "3.6.6"; @@ -14,5 +19,10 @@ callPackage ./generic.nix { url = "https://raw.githubusercontent.com/openwrt/openwrt/52b6c9247997e51a97f13bb9e94749bc34e2d52e/package/libs/mbedtls/patches/100-fix-gcc14-build.patch"; hash = "sha256-20bxGoUHkrOEungN3SamYKNgj95pM8IjbisNRh68Wlw="; }) + ] + ++ lib.optionals stdenv.hostPlatform.is32bit [ + # Fixes build with GCC 15.3 on 32-bit platforms. + # See: https://github.com/Mbed-TLS/mbedtls/pull/10793 + ./fix-gcc153-32bit.patch ]; }