]> git.ipfire.org Git - thirdparty/glibc.git/blame - scripts/abilist.awk
sparc (64bit): Regenerate ulps
[thirdparty/glibc.git] / scripts / abilist.awk
CommitLineData
6e3d59bc
RM
1# This awk script processes the output of objdump --dynamic-syms
2# into a simple format that should not change when the ABI is not changing.
3
15a686af 4BEGIN {
7e30918b
RM
5 if (combine_fullname)
6 combine = 1;
7 if (combine)
8 parse_names = 1;
15a686af
RM
9}
10
11# Per-file header.
a9448c54 12/[^ :]+\.so\.[0-9.]+:[ ]+.file format .*$/ {
f0248ca5 13 emit(0);
15a686af 14
d692f3f8
RM
15 seen_opd = 0;
16
15a686af
RM
17 sofullname = $1;
18 sub(/:$/, "", sofullname);
19 soname = sofullname;
20 sub(/^.*\//, "", soname);
a9448c54 21 sub(/\.so\.[0-9.]+$/, "", soname);
15a686af 22
f0248ca5
RM
23 suppress = ((filename_regexp != "" && sofullname !~ filename_regexp) \
24 || (libname_regexp != "" && soname !~ libname_regexp));
25
15a686af
RM
26 next
27}
28
f0248ca5
RM
29suppress { next }
30
6e3d59bc
RM
31# Normalize columns.
32/^[0-9a-fA-F]+ / { sub(/ /, " - ") }
33
34# Skip undefineds.
35$4 == "*UND*" { next }
36
37# Skip locals.
38$2 == "l" { next }
39
63f1549e
RH
40# If the target uses ST_OTHER, it will be output before the symbol name.
41$2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
6e3d59bc 42 type = $3;
56c71d45
RM
43 size = $5;
44 sub(/^0*/, "", size);
5e63c240
FW
45 if (size == "") {
46 size = " 0x0";
47 } else {
48 size = " 0x" size;
49 }
6e3d59bc 50 version = $6;
63f1549e 51 symbol = $NF;
6e3d59bc
RM
52 gsub(/[()]/, "", version);
53
c8f8fa15
RM
54 # binutils versions up through at least 2.23 have some bugs that
55 # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
56 if (NF > 7 && $7 == ".hidden") next;
57
57292f57
L
58 if (version ~ /^GLIBC_ABI_/ && !include_abi_version) next;
59
36406545 60 if (version == "GLIBC_PRIVATE" && !include_private) next;
6e3d59bc 61
7e30918b 62 desc = "";
ce035c6e 63 if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) {
c823a4d2 64 type = "T";
6e3d59bc 65 }
5d0bbaaf 66 else if (type == "D" && $4 == ".opd") {
d692f3f8 67 type = "F";
c823a4d2 68 size = "";
d692f3f8
RM
69 if (seen_opd < 0)
70 type = "O";
71 seen_opd = 1;
5d0bbaaf 72 }
63f1549e
RH
73 else if (type == "D" && NF == 8 && $7 == "0x80") {
74 # Alpha functions avoiding plt entry in users
75 type = "F";
76 size = "";
77 seen_opd = -1;
78 }
7e30918b 79 else if ($4 == "*ABS*") {
b289cd9d 80 next;
6e3d59bc 81 }
5e63c240
FW
82 else if (type == "D") {
83 # Accept unchanged.
84 }
6e3d59bc 85 else if (type == "DO") {
c823a4d2 86 type = "D";
6e3d59bc
RM
87 }
88 else if (type == "DF") {
d692f3f8
RM
89 if (symbol ~ /^\./ && seen_opd >= 0)
90 next;
91 seen_opd = -1;
c823a4d2
RM
92 type = "F";
93 size = "";
6e3d59bc 94 }
e3c6aa3a 95 else if (type == "iD" && ($4 == ".text" || $4 == ".opd")) {
00bbd29b
UD
96 # Indirect functions.
97 type = "F";
98 size = "";
99 }
6e3d59bc 100 else {
5e63c240 101 print "ERROR: Unable to handle this type of symbol:", $0
ce035c6e 102 exit 1
620656a3 103 }
6e3d59bc 104
7e30918b 105 if (desc == "")
8c77b6ad 106 desc = symbol " " type size;
c823a4d2 107
f0248ca5
RM
108 if (combine)
109 version = soname " " version (combine_fullname ? " " sofullname : "");
110
8c77b6ad
FW
111 # Append to the string which collects the results.
112 descs = descs version " " desc "\n";
6e3d59bc
RM
113 next;
114}
115
116# Header crapola.
117NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
118
119{
ce035c6e
CD
120 print "ERROR: Unable to interpret this line:", $0
121 exit 1
6e3d59bc 122}
c823a4d2 123
f0248ca5 124function emit(end) {
a9448c54 125 if (!end && (combine || ! parse_names || soname == ""))
f0248ca5 126 return;
a9448c54 127 tofile = parse_names && !combine;
f0248ca5 128
374d9002
RM
129 if (tofile) {
130 out = prefix soname ".symlist";
131 if (soname in outfiles)
132 out = out "." ++outfiles[soname];
133 else
134 outfiles[soname] = 1;
8c77b6ad
FW
135 outpipe = "LC_ALL=C sort -u > " out;
136 } else {
137 outpipe = "LC_ALL=C sort -u";
374d9002
RM
138 }
139
8c77b6ad
FW
140 printf "%s", descs | outpipe;
141
142 descs = "";
15a686af
RM
143
144 if (tofile)
145 print "wrote", out, "for", sofullname;
146}
147
148END {
f0248ca5 149 emit(1);
c823a4d2 150}