From: GAlvare <40766690+GAlvare@users.noreply.github.com> Date: Fri, 2 May 2025 16:57:22 +0000 (-0500) Subject: Fixes for build failures on OS X 10.4 Tiger X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7eee9d543e467c4767ebbbd12517fe5c9565202a;p=thirdparty%2Fopenssl.git Fixes for build failures on OS X 10.4 Tiger Also added darwin8-ppc-cc and darwin8-ppc64-cc build configurations for handling OS X 10.4 PowerPC specific configuration options, specifically disabling async by default. Reviewed-by: Neil Horman Reviewed-by: Bernd Edlinger Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/27578) --- diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index 01526cd3ef..7e9396868a 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -1862,6 +1862,10 @@ my %targets = ( # Option "freeze" such as -std=gnu9x can't negatively interfere # with future defaults for below two targets, because MacOS X # for PPC has no future, it was discontinued by vendor in 2009. + "darwin8-ppc-cc" => { + inherit_from => [ "darwin-ppc" ], + disable => [ "async" ] + }, "darwin-ppc-cc" => { inherit_from => [ "darwin-ppc" ] }, # Historic alias "darwin-ppc" => { inherit_from => [ "darwin-common" ], @@ -1871,6 +1875,10 @@ my %targets = ( asm_arch => 'ppc32', perlasm_scheme => "osx32", }, + "darwin8-ppc64-cc" => { + inherit_from => [ "darwin64-ppc" ], + disable => [ "async" ] + }, "darwin64-ppc-cc" => { inherit_from => [ "darwin64-ppc" ] }, # Historic alias "darwin64-ppc" => { inherit_from => [ "darwin-common" ], diff --git a/include/crypto/rand.h b/include/crypto/rand.h index f7c1a165b4..5f65e399d5 100644 --- a/include/crypto/rand.h +++ b/include/crypto/rand.h @@ -23,7 +23,12 @@ # include "crypto/rand_pool.h" # if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM) -# include +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 +# include +# else +# include +# include +# endif # if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || \ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) # define OPENSSL_APPLE_CRYPTO_RANDOM 1 diff --git a/include/internal/numbers.h b/include/internal/numbers.h index 4a93a24756..949bd56258 100644 --- a/include/internal/numbers.h +++ b/include/internal/numbers.h @@ -106,5 +106,13 @@ typedef __uint128_t uint128_t; # define OSSL_UINTMAX_MAX __MAXUINT__(ossl_uintmax_t) # endif +/* Fix for cross compiling 64-bit PowerPC on OS X 10.4 */ +# if defined(__APPLE__) && defined(_ARCH_PPC64) +# ifdef SIZE_MAX +# undef SIZE_MAX +# endif +# define SIZE_MAX __MAXUINT__(uint64_t) +# endif + #endif diff --git a/test/testutil/helper.c b/test/testutil/helper.c index 9c985e25a8..6a1da5c9ba 100644 --- a/test/testutil/helper.c +++ b/test/testutil/helper.c @@ -19,7 +19,9 @@ # define timezone _timezone #endif -#if defined(__FreeBSD__) || defined(__wasi__) +#if defined(__FreeBSD__) || defined(__wasi__) || \ + (defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM) && \ + !(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)) # define USE_TIMEGM #endif diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm index 24d0dfb060..4af388fa10 100755 --- a/util/perl/OpenSSL/config.pm +++ b/util/perl/OpenSSL/config.pm @@ -146,6 +146,7 @@ my $guess_patterns = [ ], [ 'Paragon.*?:.*', 'i860-intel-osf1' ], [ 'Rhapsody:.*', 'ppc-apple-rhapsody' ], + [ 'Darwin:8.*?:.*?:Power.*', 'ppc-apple-darwin8' ], [ 'Darwin:.*?:.*?:Power.*', 'ppc-apple-darwin' ], [ 'Darwin:.*', '${MACHINE}-apple-darwin' ], [ 'SunOS:5\..*', '${MACHINE}-whatever-solaris2' ], @@ -491,6 +492,22 @@ EOF } ], [ 'ppc-apple-rhapsody', { target => "rhapsody-ppc" } ], + [ 'ppc-apple-darwin8.*', + sub { + my $KERNEL_BITS = $ENV{KERNEL_BITS} // ''; + my $ISA64 = `sysctl -n hw.optional.64bitops 2>/dev/null`; + if ( $ISA64 == 1 && $KERNEL_BITS eq '' ) { + print < "darwin8-ppc64-cc" } + if $ISA64 == 1 && $KERNEL_BITS eq '64'; + return { target => "darwin8-ppc-cc" }; + } + ], [ 'ppc-apple-darwin.*', sub { my $KERNEL_BITS = $ENV{KERNEL_BITS} // '';