1 # Copyright (C) 2018-2023 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
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
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.
25 BEGIN { result = _init = _fini = sanity =
0 }
27 function check_one
(name
) {
29 print name
": *** input did not look like readelf -d output";
34 print name
": *** _init is in dynamic symbol table";
35 result = result ? result
: 1;
39 print name
": *** _fini is in dynamic symbol table";
40 result = result ? result
: 1;
47 _init = _fini = sanity =
0
50 FILENAME != lastfile
{
56 $
1 ==
"Symbol" && $
2 ==
"table" && $
3 ==
"'.dynsym'" { sanity =
1 }
57 $
8 ==
"_init" { _init =
1 }
58 $
8 ==
"_fini" { _fini =
1 }