Commit ec80caff85 for openssl.org

commit ec80caff8506057a9b56ac21d76ebc2fb2e20104
Author: Sergey Fedorov <barracuda@macos-powerpc.org>
Date:   Wed Nov 4 03:33:02 2026 +0000

    Restore darwin-ppc{,64} targets

    This effectively reverts commit 41329aba5221 "Drop darwin-ppc{,64}
    targets", as they are not abandoned anymore[1].

    [1] https://github.com/openssl/general-policies/pull/95

    References: https://github.com/openssl/general-policies/pull/95
    References: 41329aba5221 "Drop darwin-ppc{,64} targets"
    Signed-off-by: Sergey Fedorov <vital.had@gmail.com>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Merge-date: Tue Nov 10 14:37:21 2026
    Merged-from: https://github.com/openssl/openssl/pull/33585

diff --git a/CHANGES.md b/CHANGES.md
index 712f17e8bd..54279dfc0a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -38,6 +38,11 @@ OpenSSL 4.2

    *Richard Levitte*

+ * Restored `darwin-ppc{,64}{,-cc}` targets.
+   <!-- https://github.com/openssl/openssl/pull/33585 -->
+
+   *Sergey Fedorov*
+
  * Deprecated `SSL_copy_session_id()` and `BIO_ssl_copy_session_id()`.
    Use `SSL_set_session()` to resume a session on a new connection, or
    `SSL_dup()` to copy an SSL object.
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 3d044e8045..b71612364b 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1733,6 +1733,35 @@ my %targets = (
         shared_cflag     => "-fPIC",
         shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
     },
+    # 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" ],
+        cflags           => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
+        lib_cppflags     => add("-DB_ENDIAN"),
+        shared_cflag     => add("-fno-common"),
+        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" ],
+        cflags           => add("-arch ppc64 -std=gnu9x"),
+        lib_cppflags     => add("-DB_ENDIAN"),
+        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'ppc64',
+        perlasm_scheme   => "osx64",
+    },
     "darwin64-x86_64-cc" => { inherit_from => [ "darwin64-x86_64" ] }, # Historic alias
     "darwin64-x86_64" => {
         inherit_from     => [ "darwin-common" ],
diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm
index e9dc9d3243..1e73f9608f 100755
--- a/util/perl/OpenSSL/config.pm
+++ b/util/perl/OpenSSL/config.pm
@@ -145,6 +145,8 @@ my $guess_patterns = [
       }
     ],
     [ 'Paragon.*?:.*',              'i860-intel-osf1' ],
+    [ 'Darwin:8.*?:.*?:Power.*',    'ppc-apple-darwin8' ],
+    [ 'Darwin:.*?:.*?:Power.*',     'ppc-apple-darwin' ],
     [ 'Darwin:.*',                  '${MACHINE}-apple-darwin' ],
     [ 'SunOS:5\..*',                '${MACHINE}-whatever-solaris2' ],
     [ 'SunOS:.*',                   '${MACHINE}-sun-sunos4' ],
@@ -488,6 +490,38 @@ EOF
             return { target => "irix-mips3" };
         }
       ],
+      [ '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 <<EOF;
+WARNING! To build 64-bit package, do this:
+         $WHERE/Configure darwin8-ppc64-cc
+EOF
+                maybe_abort();
+            }
+            return { target => "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} // '';
+            my $ISA64 = `sysctl -n hw.optional.64bitops 2>/dev/null`;
+            if ( $ISA64 == 1 && $KERNEL_BITS eq '' ) {
+                print <<EOF;
+WARNING! To build 64-bit package, do this:
+         $WHERE/Configure darwin64-ppc-cc
+EOF
+                maybe_abort();
+            }
+            return { target => "darwin64-ppc" }
+                if $ISA64 == 1 && $KERNEL_BITS eq '64';
+            return { target => "darwin-ppc" };
+        }
+      ],
       [ 'x86_64-apple-darwin.*',
         sub {
             my $KERNEL_BITS = $ENV{KERNEL_BITS} // '';