]>
Commit | Line | Data |
---|---|---|
83bcd236 RM |
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. | |
11 | ||
12 | BEGIN { result = 0 } | |
13 | ||
14 | FILENAME != "-" && /^#/ { next } | |
15 | ||
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; | |
22 | } | |
23 | next; | |
24 | } | |
25 | ||
26 | NF != 2 { | |
27 | print "Unexpected output from check-localplt:", $0 > "/dev/stderr"; | |
28 | result = 2; | |
29 | next | |
30 | } | |
31 | ||
32 | { | |
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; | |
40 | } | |
41 | } | |
42 | ||
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; | |
49 | } | |
50 | } | |
51 | ||
52 | exit(result); | |
53 | } |