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.
12 /[^
:]+\.so\.
[0-9.
]+:[ ]+.file format .
*$
/ {
18 sub(/:$
/, "", sofullname
);
20 sub(/^.
*\
//, "", soname
);
21 sub(/\.so\.
[0-9.
]+$
/, "", soname
);
23 suppress =
((filename_regexp
!= "" && sofullname !~ filename_regexp
) \
24 || (libname_regexp
!= "" && soname !~ libname_regexp
));
32 /^
[0-9a
-fA
-F
]+ / { sub(/ /, " - ") }
35 $
4 ==
"*UND*" { next }
40 # If the target uses ST_OTHER, it will be output before the symbol name.
41 $
2 ==
"g" || $
2 ==
"w" && (NF ==
7 || NF ==
8) {
49 gsub(/[()]/, "", version
);
51 # binutils versions up through at least 2.23 have some bugs that
52 # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
53 if (NF > 7 && $
7 ==
".hidden") next;
55 if (version ==
"GLIBC_PRIVATE") next;
58 if (type ==
"D" && $
4 ==
".tbss") {
61 else if (type ==
"D" && $
4 ==
".opd") {
68 else if (type ==
"D" && NF ==
8 && $
7 ==
"0x80") {
69 # Alpha functions avoiding plt entry in users
74 else if ($
4 ==
"*ABS*") {
78 else if (type ==
"DO") {
81 else if (type ==
"DF") {
82 if (symbol ~
/^\.
/ && seen_opd
>=
0)
88 else if (type ==
"iD" && ($
4 ==
".text" || $
4 ==
".opd")) {
94 desc = symbol
" " version
" " weak
" ? " type
" " $
4 " " $
5;
97 desc = symbol
" " version
" " weak
" ? " type
" " $
4 " " $
5;
100 # Disabled -- weakness should not matter to shared library ABIs any more.
101 #if (weak == "w") type = tolower(type);
103 desc =
" " symbol
" " type size
;
106 version = soname
" " version
(combine_fullname ?
" " sofullname
: "");
108 if (version in versions
) {
109 versions
[version
] = versions
[version
] "\n" desc
;
112 versions
[version
] = desc
;
118 NF ==
0 || /DYNAMIC SYMBOL TABLE
/ || /file format
/ { next }
121 print "Don't grok this line:", $
0
125 if (!
end && (combine
|| ! parse_names
|| soname ==
""))
127 tofile = parse_names
&& !combine
;
130 for (version in versions
) {
131 if (nverslist ==
0) {
136 split(verslist
, s
, "\n");
137 if (version
< s
[1]) {
139 for (i =
1; i
<= nverslist
; ++i
) {
140 verslist = verslist
"\n" s
[i
];
145 for (i =
2; i
<= nverslist
; ++i
) {
146 if (version
< s
[i
]) break;
147 verslist = verslist
"\n" s
[i
];
149 verslist = verslist
"\n" version
;
150 for (; i
<= nverslist
; ++i
) {
151 verslist = verslist
"\n" s
[i
];
158 out = prefix soname
".symlist";
159 if (soname in outfiles
)
160 out = out
"." ++outfiles
[soname
];
162 outfiles
[soname
] =
1;
166 split(verslist
, order
, "\n");
167 for (i =
1; i
<= nverslist
; ++i
) {
171 print version
>> out
;
173 outpipe =
"sort >> " out
;
178 print prefix version
;
181 print versions
[version
] | outpipe
;
184 delete versions
[version
];
186 for (version in versions
)
187 delete versions
[version
];
190 print "wrote", out
, "for", sofullname
;