(open_socket): Use SOCK_CLOEXEC and SOCK_NONBLOCK if possible.
[glibc/history.git] / scripts / abilist.awk
bloba042ce71130432bd548777393e8f6237cbe520bb
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.
4 BEGIN {
5 if (combine_fullname)
6 combine = 1;
7 if (combine)
8 parse_names = 1;
11 # Per-file header.
12 /[^ :]+\.so\.[0-9.]+:[ ]+.file format .*$/ {
13 emit(0);
15 seen_opd = 0;
17 sofullname = $1;
18 sub(/:$/, "", sofullname);
19 soname = sofullname;
20 sub(/^.*\//, "", soname);
21 sub(/\.so\.[0-9.]+$/, "", soname);
23 suppress = ((filename_regexp != "" && sofullname !~ filename_regexp) \
24 || (libname_regexp != "" && soname !~ libname_regexp));
26 next
29 suppress { next }
31 # Normalize columns.
32 /^[0-9a-fA-F]+ / { sub(/ /, " - ") }
34 # Skip undefineds.
35 $4 == "*UND*" { next }
37 # Skip locals.
38 $2 == "l" { next }
40 $2 == "g" || $2 == "w" && NF == 7 {
41 weak = $2;
42 type = $3;
43 size = $5;
44 sub(/^0*/, "", size);
45 size = " 0x" size;
46 version = $6;
47 symbol = $7;
48 gsub(/[()]/, "", version);
50 if (version == "GLIBC_PRIVATE") next;
52 desc = "";
53 if (type == "D" && $4 == ".tbss") {
54 type = "T";
56 else if (type == "D" && $4 == ".opd") {
57 type = "F";
58 size = "";
59 if (seen_opd < 0)
60 type = "O";
61 seen_opd = 1;
63 else if ($4 == "*ABS*") {
64 type = "A";
65 size = "";
67 else if (type == "DO") {
68 type = "D";
70 else if (type == "DF") {
71 if (symbol ~ /^\./ && seen_opd >= 0)
72 next;
73 seen_opd = -1;
74 type = "F";
75 size = "";
77 else {
78 desc = symbol " " version " " weak " ? " type " " $4 " " $5;
80 if (size == " 0x") {
81 desc = symbol " " version " " weak " ? " type " " $4 " " $5;
84 # Disabled -- weakness should not matter to shared library ABIs any more.
85 #if (weak == "w") type = tolower(type);
86 if (desc == "")
87 desc = " " symbol " " type size;
89 if (combine)
90 version = soname " " version (combine_fullname ? " " sofullname : "");
92 if (version in versions) {
93 versions[version] = versions[version] "\n" desc;
95 else {
96 versions[version] = desc;
98 next;
101 # Header crapola.
102 NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
105 print "Don't grok this line:", $0
108 function emit(end) {
109 if (!end && (combine || ! parse_names || soname == ""))
110 return;
111 tofile = parse_names && !combine;
113 nverslist = 0;
114 for (version in versions) {
115 if (nverslist == 0) {
116 verslist = version;
117 nverslist = 1;
118 continue;
120 split(verslist, s, "\n");
121 if (version < s[1]) {
122 verslist = version;
123 for (i = 1; i <= nverslist; ++i) {
124 verslist = verslist "\n" s[i];
127 else {
128 verslist = s[1];
129 for (i = 2; i <= nverslist; ++i) {
130 if (version < s[i]) break;
131 verslist = verslist "\n" s[i];
133 verslist = verslist "\n" version;
134 for (; i <= nverslist; ++i) {
135 verslist = verslist "\n" s[i];
138 ++nverslist;
141 if (tofile) {
142 out = prefix soname ".symlist";
143 if (soname in outfiles)
144 out = out "." ++outfiles[soname];
145 else
146 outfiles[soname] = 1;
147 printf "" > out;
150 split(verslist, order, "\n");
151 for (i = 1; i <= nverslist; ++i) {
152 version = order[i];
154 if (tofile) {
155 print version >> out;
156 close(out);
157 outpipe = "sort >> " out;
159 else {
160 if (combine)
161 print "";
162 print prefix version;
163 outpipe = "sort";
165 print versions[version] | outpipe;
166 close(outpipe);
168 delete versions[version];
170 for (version in versions)
171 delete versions[version];
173 if (tofile)
174 print "wrote", out, "for", sofullname;
177 END {
178 emit(1);