Skip to content

Commit

Permalink
test/recipes/01-test_symbol_presence.t: Treat common symbols specially
Browse files Browse the repository at this point in the history
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 4ff5137)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from #22929)
  • Loading branch information
levitte committed Dec 8, 2023
1 parent cef95c2 commit 3cd209a
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions test/recipes/01-test_symbol_presence.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cd209a

Please sign in to comment.