alpha: Don't symbol_version syscalls outside libc
[glibc.git] / scripts / localplt.awk
blob2265b026f0793f9ea756eb6eadb9b99e17417b36
1 # This awk script expects to get command-line files that are each
2 # the output of 'readelf -WSdr' on a single shared object, and named
3 # .../NAME.jmprel where NAME is the unadorned file name of the shared object.
4 # It writes "NAME: SYMBOL" for each PLT entry in NAME that refers to a
5 # symbol defined in the same object.
7 BEGIN { result = 0 }
9 FILENAME != lastfile {
10 if (lastfile && jmprel_offset == 0) {
11 print FILENAME ": *** failed to find expected output (readelf -WSdr)";
12 result = 2;
14 lastfile = FILENAME;
15 jmprel_offset = 0;
16 delete section_offset_by_address;
19 /^Section Headers:/ { in_shdrs = 1; next }
20 in_shdrs && !/^ +\[/ { in_shdrs = 0 }
22 in_shdrs && /^ +\[/ { sub(/\[ +/, "[") }
23 in_shdrs {
24 address = strtonum("0x" $4);
25 offset = strtonum("0x" $5);
26 section_offset_by_address[address] = offset;
29 in_shdrs { next }
31 $1 == "Offset" && $2 == "Info" { in_relocs = 1; next }
32 NF == 0 { in_relocs = 0 }
34 in_relocs && relocs_offset == jmprel_offset && NF >= 5 {
35 symval = strtonum("0x" $4);
36 if (symval != 0)
37 print whatfile, $5
40 in_relocs { next }
42 $1 == "Relocation" && $2 == "section" && $5 == "offset" {
43 relocs_offset = strtonum($6);
44 whatfile = gensub(/^.*\/([^/]+)\.jmprel$/, "\\1:", 1, FILENAME);
45 next
48 $2 == "(JMPREL)" {
49 jmprel_addr = strtonum($3);
50 if (jmprel_addr in section_offset_by_address) {
51 jmprel_offset = section_offset_by_address[jmprel_addr];
52 } else {
53 print FILENAME ": *** DT_JMPREL does not match any section's address";
54 result = 2;
56 next
59 END { exit(result) }