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.

Fixes #22869 (partially)
Fixes #22837

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #22880)

(cherry picked from commit 4ff5137)
  • Loading branch information
levitte committed Dec 4, 2023
1 parent 4428841 commit cc493c0
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions test/recipes/01-test_symbol_presence.t
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,34 @@ foreach (sort keys %stlibname) {
my @arrays = ( \@stlib_lines );
push @arrays, \@shlib_lines unless disabled('shared');
foreach (@arrays) {
my %commons;
foreach (@$_) {
if (m|^(.*) C .*|) {
$commons{$1}++;
}
}
foreach (sort keys %commons) {
note "Common symbol: $_";
}

@$_ =
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] .*|,
@$_ ),
( 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] .*|,
@$_ ),
keys %commons;
}

# Massage the mkdef.pl output to only contain global symbols
Expand Down

0 comments on commit cc493c0

Please sign in to comment.