]>
Commit | Line | Data |
---|---|---|
82a79e7d RM |
1 | # This awk script expects to get command-line files that are each |
2 | # the output of 'readelf -d' on a single shared object. | |
3 | # It exits successfully (0) if none contained any TEXTREL markers. | |
4 | # It fails (1) if any did contain a TEXTREL marker. | |
5 | # It fails (2) if the input did not take the expected form. | |
6 | ||
7 | BEGIN { result = textrel = sanity = 0 } | |
8 | ||
9 | function check_one(name) { | |
10 | if (!sanity) { | |
11 | print name ": *** input did not look like readelf -d output"; | |
12 | result = 2; | |
13 | } else if (textrel) { | |
14 | print name ": *** text relocations used"; | |
15 | result = result ? result : 1; | |
16 | } else { | |
17 | print name ": OK"; | |
18 | } | |
19 | ||
20 | textrel = sanity = 0; | |
21 | } | |
22 | ||
23 | FILENAME != lastfile { | |
24 | if (lastfile) | |
25 | check_one(lastfile); | |
26 | lastfile = FILENAME; | |
27 | } | |
28 | ||
29 | $1 == "Tag" && $2 == "Type" { sanity = 1 } | |
30 | $2 == "(TEXTREL)" { textrel = 1 } | |
31 | $2 == "(FLAGS)" { | |
32 | for (i = 3; i <= NF; ++i) { | |
33 | if ($i == "TEXTREL") | |
34 | textrel = 1; | |
35 | } | |
36 | } | |
37 | ||
38 | END { | |
39 | check_one(lastfile); | |
40 | exit(result); | |
41 | } |