Make build-many-glibcs.py support running as a bot.
[glibc.git] / scripts / check-textrel.awk
blobe7f2d7008458fb3946e3c0a182387ca897744be2
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.
7 BEGIN { result = textrel = sanity = 0 }
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";
20 textrel = sanity = 0;
23 FILENAME != lastfile {
24 if (lastfile)
25 check_one(lastfile);
26 lastfile = FILENAME;
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;
38 END {
39 check_one(lastfile);
40 exit(result);