]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/recipes/01-test_symbol_presence.t: Treat common symbols specially
authorRichard Levitte <levitte@openssl.org>
Thu, 30 Nov 2023 08:02:25 +0000 (09:02 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 8 Dec 2023 08:07:35 +0000 (09:07 +0100)
Common symbols (type 'C' in the 'nm' output) are allowed to be defined more
than once.  This makes test/recipes/01-test_symbol_presence.t reflect that.

(backport of commit 4ff5137ff5fb896e0273d274110517e3c7adb8cf)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22929)

test/recipes/01-test_symbol_presence.t

index 8aaea51a889c05d9ba3a66c65bf28640ff650766..3de3d2ccf19bd17561d29796d927a221d339715b 100644 (file)
@@ -70,23 +70,35 @@ foreach my $libname (@libnames) {
         note "Number of lines in \@def_lines before massaging: ", scalar @def_lines;
 
         # Massage the nm output to only contain defined symbols
+        # Common symbols need separate treatment
+        my %commons;
+        foreach (@nm_lines) {
+            if (m|^(.*) C .*|) {
+                $commons{$1}++;
+            }
+        }
+        foreach (sort keys %commons) {
+            note "Common symbol: $_";
+        }
+
         @nm_lines =
             sort
-            map {
-                # Drop the first space and everything following it
-                s| .*||;
-                # Drop OpenSSL dynamic version information if there is any
-                s|\@\@.+$||;
-                # Return the result
-                $_
-            }
-            # Drop any symbol starting with a double underscore, they
-            # are reserved for the compiler / system ABI and are none
-            # of our business
-            grep !m|^__|,
-            # Only look at external definitions
-            grep m|.* [BCDST] .*|,
-            @nm_lines;
+            ( map {
+                  # Drop the first space and everything following it
+                  s| .*||;
+                  # Drop OpenSSL dynamic version information if there is any
+                  s|\@\@.+$||;
+                  # Return the result
+                  $_
+              }
+              # Drop any symbol starting with a double underscore, they
+              # are reserved for the compiler / system ABI and are none
+              # of our business
+              grep !m|^__|,
+              # Only look at external definitions
+              grep m|.* [BDST] .*|,
+              @nm_lines ),
+            keys %commons;
 
         # Massage the mkdef.pl output to only contain global symbols
         # The output we got is in Unix .map format, which has a global