From: Richard Levitte Date: Thu, 30 Nov 2023 08:02:25 +0000 (+0100) Subject: test/recipes/01-test_symbol_presence.t: Treat common symbols specially X-Git-Tag: openssl-3.0.13~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa472dd02af4027ba0fccbe365ecaf89e6289327;p=thirdparty%2Fopenssl.git test/recipes/01-test_symbol_presence.t: Treat common symbols specially 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 Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/22929) (cherry picked from commit 3cd209a6ba62ea282227305d9ba1f70b55241fb2) --- diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t index 8aaea51a889..3de3d2ccf19 100644 --- a/test/recipes/01-test_symbol_presence.t +++ b/test/recipes/01-test_symbol_presence.t @@ -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