Remove duplication from gconv-modules
[glibc.git] / scripts / check-localplt.awk
blobbb1b9121319b0e39c6e45d2731f24e39b80d5d3a
1 # This is an awk script to process the output of elf/check-localplt.
2 # The first file argument is the file of expected results.
3 # Each line is either a comment starting with # or it looks like:
4 # libfoo.so: function
5 # or
6 # libfoo.so: function ?
7 # The latter means that a PLT entry for function is optional in libfoo.so.
8 # The former means one is required.
9 # The second file argument is - and this (stdin) receives the output
10 # of the check-localplt program.
12 BEGIN { result = 0 }
14 FILENAME != "-" && /^#/ { next }
16 FILENAME != "-" {
17 if (NF != 2 && !(NF == 3 && $3 == "?")) {
18 printf "%s:%d: bad data line: %s\n", FILENAME, FNR, $0 > "/dev/stderr";
19 result = 2;
20 } else {
21 accept[$1 " " $2] = NF == 2;
23 next;
26 NF != 2 {
27 print "Unexpected output from check-localplt:", $0 > "/dev/stderr";
28 result = 2;
29 next
33 key = $1 " " $2
34 if (key in accept) {
35 delete accept[key]
36 } else {
37 print "Extra PLT reference:", $0;
38 if (result == 0)
39 result = 1;
43 END {
44 for (key in accept) {
45 if (accept[key]) {
46 # It's mandatory.
47 print "Missing required PLT reference:", key;
48 result = 1;
52 exit(result);