]> git.pld-linux.org Git - packages/openssl.git/blob - duplicate-symbols-test.patch
upstream duplicate symbols test fix
[packages/openssl.git] / duplicate-symbols-test.patch
1 From 38cf48b3044749fd5b37e36e5d9b2dc9fe7056ff Mon Sep 17 00:00:00 2001
2 From: Richard Levitte <levitte@openssl.org>
3 Date: Thu, 30 Nov 2023 08:48:33 +0100
4 Subject: [PATCH 1/3] test/recipes/01-test_symbol_presence.t: Ignore symbols
5  starting with '__'
6
7 On some platforms, the compiler may add symbols that aren't ours and that we
8 should ignore.
9
10 They are generally expected to start with a double underscore, and thereby
11 easy to detect.
12
13 Fixes #22869 (partially)
14 ---
15  test/recipes/01-test_symbol_presence.t | 8 +++++++-
16  1 file changed, 7 insertions(+), 1 deletion(-)
17
18 diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t
19 index 9efa9f8d2d6eb..66e5669e193c7 100644
20 --- a/test/recipes/01-test_symbol_presence.t
21 +++ b/test/recipes/01-test_symbol_presence.t
22 @@ -124,7 +124,13 @@ foreach (sort keys %stlibname) {
23                  # Return the result
24                  $_
25              }
26 -            grep(m|.* [BCDST] .*|, @$_);
27 +            # Drop any symbol starting with a double underscore, they
28 +            # are reserved for the compiler / system ABI and are none
29 +            # of our business
30 +            grep !m|^__|,
31 +            # Only look at external definitions
32 +            grep m|.* [BCDST] .*|,
33 +            @$_ ),
34      }
35  
36      # Massage the mkdef.pl output to only contain global symbols
37
38 From feead62eb7873c6a8a95e75ad5ca3ac7b9ed8bcd Mon Sep 17 00:00:00 2001
39 From: Richard Levitte <levitte@openssl.org>
40 Date: Thu, 30 Nov 2023 09:02:25 +0100
41 Subject: [PATCH 2/3] test/recipes/01-test_symbol_presence.t: Treat common
42  symbols specially
43
44 Common symbols (type 'C' in the 'nm' output) are allowed to be defined more
45 than once.  This makes test/recipes/01-test_symbol_presence.t reflect that.
46
47 Fixes #22869 (partially)
48 Fixes #22837
49 ---
50  test/recipes/01-test_symbol_presence.t | 45 +++++++++++++++++---------
51  1 file changed, 30 insertions(+), 15 deletions(-)
52
53 diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t
54 index 66e5669e193c7..cd3ac48bae5e7 100644
55 --- a/test/recipes/01-test_symbol_presence.t
56 +++ b/test/recipes/01-test_symbol_presence.t
57 @@ -114,23 +114,38 @@ foreach (sort keys %stlibname) {
58      my @arrays = ( \@stlib_lines );
59      push @arrays, \@shlib_lines unless disabled('shared');
60      foreach (@arrays) {
61 +        my %commons;
62 +        foreach (@$_) {
63 +            if (m|^(.*) C .*|) {
64 +                $commons{$1}++;
65 +            }
66 +        }
67 +        foreach (sort keys %commons) {
68 +            note "Common symbol: $_";
69 +        }
70 +
71          @$_ =
72              sort
73 -            map {
74 -                # Drop the first space and everything following it
75 -                s| .*||;
76 -                # Drop OpenSSL dynamic version information if there is any
77 -                s|\@\@.+$||;
78 -                # Return the result
79 -                $_
80 -            }
81 -            # Drop any symbol starting with a double underscore, they
82 -            # are reserved for the compiler / system ABI and are none
83 -            # of our business
84 -            grep !m|^__|,
85 -            # Only look at external definitions
86 -            grep m|.* [BCDST] .*|,
87 -            @$_ ),
88 +            ( map {
89 +                  # Drop the first space and everything following it
90 +                  s| .*||;
91 +                  # Drop OpenSSL dynamic version information if there is any
92 +                  s|\@\@.+$||;
93 +                  # Drop any symbol starting with a double underscore, they
94 +                  # are reserved for the compiler / system ABI and are none
95 +                  # of our business
96 +                  s|^__||;
97 +                  # Return the result
98 +                  $_
99 +              }
100 +              # Drop any symbol starting with a double underscore, they
101 +              # are reserved for the compiler / system ABI and are none
102 +              # of our business
103 +              grep !m|^__|,
104 +              # Only look at external definitions
105 +              grep m|.* [BDST] .*|,
106 +              @$_ ),
107 +            keys %commons;
108      }
109  
110      # Massage the mkdef.pl output to only contain global symbols
111
112 From 1055cefa6718167759e51165324b10345f8e7a99 Mon Sep 17 00:00:00 2001
113 From: Richard Levitte <levitte@openssl.org>
114 Date: Thu, 30 Nov 2023 10:09:41 +0100
115 Subject: [PATCH 3/3] fixup! test/recipes/01-test_symbol_presence.t: Treat
116  common symbols specially
117
118 ---
119  test/recipes/01-test_symbol_presence.t | 4 ----
120  1 file changed, 4 deletions(-)
121
122 diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t
123 index cd3ac48bae5e7..222b1886aec01 100644
124 --- a/test/recipes/01-test_symbol_presence.t
125 +++ b/test/recipes/01-test_symbol_presence.t
126 @@ -131,10 +131,6 @@ foreach (sort keys %stlibname) {
127                    s| .*||;
128                    # Drop OpenSSL dynamic version information if there is any
129                    s|\@\@.+$||;
130 -                  # Drop any symbol starting with a double underscore, they
131 -                  # are reserved for the compiler / system ABI and are none
132 -                  # of our business
133 -                  s|^__||;
134                    # Return the result
135                    $_
136                }
This page took 0.038935 seconds and 3 git commands to generate.