]>
Commit | Line | Data |
---|---|---|
d614a753 | 1 | # Copyright (C) 2018-2020 Free Software Foundation, Inc. |
67c05796 L |
2 | # This file is part of the GNU C Library. |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU Lesser General Public | |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | # Lesser General Public License for more details. | |
13 | ||
14 | # You should have received a copy of the GNU Lesser General Public | |
15 | # License along with the GNU C Library; if not, see | |
5a82c748 | 16 | # <https://www.gnu.org/licenses/>. |
67c05796 L |
17 | |
18 | # This awk script expects to get command-line files that are each | |
19 | # the output of 'readelf -W --dyn-syms' on a single shared object. | |
20 | # It exits successfully (0) if none contained _init nor _fini in dynamic | |
21 | # symbol table. | |
22 | # It fails (1) if any did contain _init or _fini in dynamic symbol table. | |
23 | # It fails (2) if the input did not take the expected form. | |
24 | ||
25 | BEGIN { result = _init = _fini = sanity = 0 } | |
26 | ||
27 | function check_one(name) { | |
28 | if (!sanity) { | |
29 | print name ": *** input did not look like readelf -d output"; | |
30 | result = 2; | |
31 | } else { | |
32 | ok = 1; | |
33 | if (_init) { | |
34 | print name ": *** _init is in dynamic symbol table"; | |
35 | result = result ? result : 1; | |
36 | ok = 0; | |
37 | } | |
38 | if (_fini) { | |
39 | print name ": *** _fini is in dynamic symbol table"; | |
40 | result = result ? result : 1; | |
41 | ok = 0; | |
42 | } | |
43 | if (ok) | |
44 | print name ": OK"; | |
45 | } | |
46 | ||
47 | _init = _fini = sanity = 0 | |
48 | } | |
49 | ||
50 | FILENAME != lastfile { | |
51 | if (lastfile) | |
52 | check_one(lastfile); | |
53 | lastfile = FILENAME; | |
54 | } | |
55 | ||
56 | $1 == "Symbol" && $2 == "table" && $3 == "'.dynsym'" { sanity = 1 } | |
57 | $8 == "_init" { _init = 1 } | |
58 | $8 == "_fini" { _fini = 1 } | |
59 | ||
60 | END { | |
61 | check_one(lastfile); | |
62 | exit(result); | |
63 | } |