From: Bob Beck Date: Wed, 17 Jun 2026 23:05:05 +0000 (-0600) Subject: We no longer need to test for GCC versions this old X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=a7241e862e7a3faa3bd0f254ab6f968cbf98f6f4;p=thirdparty%2Fopenssl.git We no longer need to test for GCC versions this old The minimum gcc to compile our code appears to be version 9, and we are now C99. All these older checks become a tautology on anything that will build a modern OpenSSL tree, so clean this up. Reviewed-by: Milan Broz Reviewed-by: Tomas Mraz Reviewed-by: Neil Horman MergeDate: Fri Jul 10 11:47:17 2026 (Merged from https://github.com/openssl/openssl/pull/31677) --- diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index 6b2d1cffe41..4dd4250d1b5 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -906,7 +906,6 @@ my %targets = ( perlasm_scheme => 'void', }, "linux64-sparcv9" => { - # GCC 3.1 is a requirement inherit_from => [ "linux-generic64" ], cflags => add("-m64 -mcpu=ultrasparc"), cxxflags => add("-m64 -mcpu=ultrasparc"), diff --git a/crypto/armcap.c b/crypto/armcap.c index 1b8ebb5025f..31b17f06a57 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -69,7 +69,7 @@ uint32_t OPENSSL_rdtsc(void) /* First determine if getauxval() is available (OSSL_IMPLEMENT_GETAUXVAL) */ -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) void OPENSSL_cpuid_setup(void) __attribute__((constructor)); #endif diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c index 7edb77806ed..03299a7b72e 100644 --- a/crypto/bn/asm/x86_64-gcc.c +++ b/crypto/bn/asm/x86_64-gcc.c @@ -8,7 +8,7 @@ */ #include "../bn_local.h" -#if !(defined(__GNUC__) && __GNUC__ >= 2) +#if !defined(__GNUC__) /* clang-format off */ # include "../bn_asm.c" /* kind of dirty hack for Sun Studio */ /* clang-format on */ diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index 2b2ace05e30..a731b2d37dd 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -160,7 +160,7 @@ static int bn_left_align(BIGNUM *num) #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) \ && !defined(PEDANTIC) && !defined(BN_DIV3W) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #if defined(__i386) || defined(__i386__) /*- * There were two reasons for implementing this template: diff --git a/crypto/bn/bn_local.h b/crypto/bn/bn_local.h index db027111327..4602cdcaba0 100644 --- a/crypto/bn/bn_local.h +++ b/crypto/bn/bn_local.h @@ -380,7 +380,7 @@ struct bn_gencb_st { #if defined(__DECC) #include #define BN_UMULT_HIGH(a, b) (BN_ULONG)asm("umulh %a0,%a1,%v0", (a), (b)) -#elif defined(__GNUC__) && __GNUC__ >= 2 +#elif defined(__GNUC__) #define BN_UMULT_HIGH(a, b) ({ \ register BN_ULONG ret; \ asm ("umulh %1,%2,%0" \ @@ -389,7 +389,7 @@ struct bn_gencb_st { ret; }) #endif /* compiler */ #elif defined(_ARCH_PPC64) && defined(SIXTY_FOUR_BIT_LONG) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #define BN_UMULT_HIGH(a, b) ({ \ register BN_ULONG ret; \ asm ("mulhdu %0,%1,%2" \ @@ -398,7 +398,7 @@ struct bn_gencb_st { ret; }) #endif /* compiler */ #elif (defined(__x86_64) || defined(__x86_64__)) && (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT)) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #define BN_UMULT_HIGH(a, b) ({ \ register BN_ULONG ret,discard; \ asm ("mulq %3" \ @@ -422,7 +422,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b, #define BN_UMULT_LOHI(low, high, a, b) ((low) = _umul128((a), (b), &(high))) #endif #elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #define BN_UMULT_HIGH(a, b) ({ \ register BN_ULONG ret; \ asm ("dmultu %1,%2" \ @@ -435,7 +435,7 @@ unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b, : "r"(a), "r"(b)); #endif #elif defined(__aarch64__) && defined(SIXTY_FOUR_BIT_LONG) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #define BN_UMULT_HIGH(a, b) ({ \ register BN_ULONG ret; \ asm ("umulh %0,%1,%2" \ diff --git a/crypto/chacha/chacha_enc.c b/crypto/chacha/chacha_enc.c index e9a4d3263a5..c7c36b9c548 100644 --- a/crypto/chacha/chacha_enc.c +++ b/crypto/chacha/chacha_enc.c @@ -24,7 +24,7 @@ typedef union { #define ROTATE(v, n) (((v) << (n)) | ((v) >> (32 - (n)))) #ifndef PEDANTIC -#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) +#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__riscv_zbb) || defined(__riscv_zbkb) #if __riscv_xlen == 64 #undef ROTATE diff --git a/crypto/des/des_local.h b/crypto/des/des_local.h index 0fee059ec47..fa368c359c2 100644 --- a/crypto/des/des_local.h +++ b/crypto/des/des_local.h @@ -32,7 +32,7 @@ #define ROTATE(a, n) (_lrotr(a, n)) #elif defined(__ICC) #define ROTATE(a, n) (_rotr(a, n)) -#elif defined(__GNUC__) && __GNUC__ >= 2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) #define ROTATE(a, n) ({ \ register unsigned int ret; \ diff --git a/crypto/ec/curve448/curve448.c b/crypto/ec/curve448/curve448.c index 1a31f863559..29edb317f13 100644 --- a/crypto/ec/curve448/curve448.c +++ b/crypto/ec/curve448/curve448.c @@ -502,7 +502,7 @@ struct smvt_control { int power, addend; }; -#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) +#if defined(__GNUC__) #define NUMTRAILINGZEROS __builtin_ctz #else #define NUMTRAILINGZEROS numtrailingzeros diff --git a/crypto/ppccap.c b/crypto/ppccap.c index a2acf6b6ed2..e029eb3051a 100644 --- a/crypto/ppccap.c +++ b/crypto/ppccap.c @@ -134,7 +134,7 @@ static unsigned long getauxval(unsigned long key) #define HWCAP_ARCH_3_00 (1U << 23) #define HWCAP_ARCH_3_1 (1U << 18) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) __attribute__((constructor)) #endif void OPENSSL_cpuid_setup(void) diff --git a/crypto/rc5/rc5_local.h b/crypto/rc5/rc5_local.h index a1fbe61fecb..7b5f8c847bc 100644 --- a/crypto/rc5/rc5_local.h +++ b/crypto/rc5/rc5_local.h @@ -19,7 +19,7 @@ #elif defined(__ICC) #define ROTATE_l32(a, n) _rotl(a, n) #define ROTATE_r32(a, n) _rotr(a, n) -#elif defined(__GNUC__) && __GNUC__ >= 2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) #define ROTATE_l32(a, n) ({ \ register unsigned int ret; \ diff --git a/crypto/riscvcap.c b/crypto/riscvcap.c index cdec9a02163..760fc5b0dd5 100644 --- a/crypto/riscvcap.c +++ b/crypto/riscvcap.c @@ -129,7 +129,7 @@ size_t riscv_vlen(void) return vlen; } -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) __attribute__((constructor)) #endif void OPENSSL_cpuid_setup(void) diff --git a/crypto/sha/sha256.c b/crypto/sha/sha256.c index eab94876225..8cbbfdbb30e 100644 --- a/crypto/sha/sha256.c +++ b/crypto/sha/sha256.c @@ -164,7 +164,7 @@ static const SHA_LONG K256[64] = { }; #ifndef PEDANTIC -#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) +#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__riscv_zknh) #define Sigma0(x) ({ MD32_REG_T ret; \ asm ("sha256sum0 %0, %1" \ diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c index 6ccc0070e03..9ba32f29264 100644 --- a/crypto/sha/sha512.c +++ b/crypto/sha/sha512.c @@ -343,7 +343,7 @@ static const SHA_LONG64 K512[80] = { }; #ifndef PEDANTIC -#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) +#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__x86_64) || defined(__x86_64__) #define ROTR(a, n) ({ SHA_LONG64 ret; \ asm ("rorq %1,%0" \ diff --git a/crypto/sm3/sm3_local.h b/crypto/sm3/sm3_local.h index 6cb8dca61b1..41639b3c95b 100644 --- a/crypto/sm3/sm3_local.h +++ b/crypto/sm3/sm3_local.h @@ -77,7 +77,7 @@ void ossl_sm3_transform(SM3_CTX *c, const unsigned char *data); /* clang-format on */ #ifndef PEDANTIC -#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) +#if defined(__GNUC__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__riscv_zksh) #define P0(x) ({ MD32_REG_T ret; \ asm ("sm3p0 %0, %1" \ diff --git a/crypto/sparcv9cap.c b/crypto/sparcv9cap.c index c9cc2b9575e..cea44ada9b8 100644 --- a/crypto/sparcv9cap.c +++ b/crypto/sparcv9cap.c @@ -71,7 +71,7 @@ static void common_handler(int sig) } #if defined(__sun) && defined(__SVR4) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) extern unsigned int getisax(unsigned int vec[], unsigned int sz) __attribute__((weak)); #elif defined(__SUNPRO_C) #pragma weak getisax diff --git a/crypto/whrlpool/wp_block.c b/crypto/whrlpool/wp_block.c index 13b3f7b37fe..62fa849dad8 100644 --- a/crypto/whrlpool/wp_block.c +++ b/crypto/whrlpool/wp_block.c @@ -103,7 +103,7 @@ typedef uint64_t u64_aX; #pragma intrinsic(_rotl64) #define ROTATE(a, n) _rotl64((a), n) #endif -#elif defined(__GNUC__) && __GNUC__ >= 2 +#elif defined(__GNUC__) #if defined(__x86_64) || defined(__x86_64__) #if defined(L_ENDIAN) #define ROTATE(a, n) ({ uint64_t ret; asm ("rolq %1,%0" \ diff --git a/include/crypto/modes.h b/include/crypto/modes.h index d749eed77df..baa0f3a6c14 100644 --- a/include/crypto/modes.h +++ b/include/crypto/modes.h @@ -31,7 +31,7 @@ #endif #if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) -#if defined(__GNUC__) && __GNUC__ >= 2 +#if defined(__GNUC__) #if defined(__x86_64) || defined(__x86_64__) #define BSWAP8(x) ({ uint64_t ret_=(x); \ asm ("bswapq %0" \ diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h index 5f390037d78..f3cda73da16 100644 --- a/include/openssl/e_os2.h +++ b/include/openssl/e_os2.h @@ -253,7 +253,7 @@ typedef uint64_t ossl_uintmax_t; #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* just use inline */ #define ossl_inline inline -#elif defined(__GNUC__) && __GNUC__ >= 2 +#elif defined(__GNUC__) #define ossl_inline __inline__ #elif defined(_MSC_VER) /* @@ -271,7 +271,7 @@ typedef uint64_t ossl_uintmax_t; #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) #define ossl_noreturn _Noreturn -#elif defined(__GNUC__) && __GNUC__ >= 2 +#elif defined(__GNUC__) #define ossl_noreturn __attribute__((noreturn)) #else #define ossl_noreturn diff --git a/include/openssl/macros.h b/include/openssl/macros.h index 40f067c8ab5..7e820875e22 100644 --- a/include/openssl/macros.h +++ b/include/openssl/macros.h @@ -53,21 +53,11 @@ __pragma(warning(push)) __pragma(warning(disable : 4996)) #define OSSL_END_ALLOW_DEPRECATED __pragma(warning(pop)) #elif defined(__GNUC__) -/* - * According to GCC documentation, deprecations with message appeared in - * GCC 4.5.0 - */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) #define OSSL_DEPRECATED(since) \ __attribute__((deprecated("Since OpenSSL " #since))) #define OSSL_DEPRECATED_FOR(since, message) \ __attribute__((deprecated("Since OpenSSL " #since ";" message))) #define OSSL_DEPRECATED_MESSAGE(message) __attribute__((deprecated(message))) -#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) -#define OSSL_DEPRECATED(since) __attribute__((deprecated)) -#define OSSL_DEPRECATED_FOR(since, message) __attribute__((deprecated)) -#define OSSL_DEPRECATED_MESSAGE(message) __attribute__((deprecated)) -#endif #define OSSL_BEGIN_ALLOW_DEPRECATED \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") @@ -376,7 +366,7 @@ #if defined(__STDC_VERSION__) #if __STDC_VERSION__ >= 199901L #define OPENSSL_FUNC __func__ -#elif defined(__GNUC__) && __GNUC__ >= 2 +#elif defined(__GNUC__) #define OPENSSL_FUNC __FUNCTION__ #endif #elif defined(_MSC_VER) diff --git a/providers/fips/self_test_kats.c b/providers/fips/self_test_kats.c index 17f79b9d0c4..f2d5c439d9e 100644 --- a/providers/fips/self_test_kats.c +++ b/providers/fips/self_test_kats.c @@ -213,7 +213,7 @@ err: return ret; } -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) #define SENTINEL __attribute__((sentinel)) #endif diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index 95742eb8482..67b38cb7199 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -354,7 +354,7 @@ static ssize_t syscall_random(void *buf, size_t buflen) * internally. So we need to check errno for ENOSYS */ #if !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__FreeBSD__) -#if defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__) && !defined(__hpux) +#if defined(__GNUC__) && defined(__ELF__) && !defined(__hpux) extern int getentropy(void *buffer, size_t length) __attribute__((weak)); if (getentropy != NULL) {