Configurations/platform/Unix.pm: account for variants in sharedlib_simple()
authorRichard Levitte <levitte@openssl.org>
Wed, 15 Sep 2021 07:11:41 +0000 (09:11 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 18 Sep 2021 06:12:28 +0000 (08:12 +0200)
OpenSSL 1.1.1 links the simple libcrypto.so to libcrypto_variant.so,
this was inadvertently dropped.

Fixes #16605

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16608)

Configurations/platform/Unix.pm

index c7d7d9eb808c89c44fc1e33582608b58b5943ff0..8db0ed912e3a2f56443c4870d92ca2f03544a90f 100644 (file)
@@ -63,9 +63,21 @@ sub sharedname_simple {
 }
 
 sub sharedlib_simple {
-    return undef if $_[0]->shlibext() eq $_[0]->shlibextsimple();
-    return platform::BASE::__concat($_[0]->sharedname_simple($_[1]),
-                                    $_[0]->shlibextsimple());
+    # This function returns the simplified shared library name (no version
+    # or variant in the shared library file name) if the simple variants of
+    # the base name or the suffix differ from the full variants of the same.
+
+    # Note: if $_[1] isn't a shared library name, then $_[0]->sharedname()
+    # and $_[0]->sharedname_simple() will return undef.  This needs being
+    # accounted for.
+    my $name = $_[0]->sharedname($_[1]);
+    my $simplename = $_[0]->sharedname_simple($_[1]);
+    my $ext = $_[0]->shlibext();
+    my $simpleext = $_[0]->shlibextsimple();
+
+    return undef unless defined $simplename && defined $name;
+    return undef if ($name eq $simplename && $ext eq $simpleext);
+    return platform::BASE::__concat($simplename, $simpleext);
 }
 
 sub sharedlib_import {