2002-11-14 03:59:56 +00:00
|
|
|
# This awk script processes the output of objdump --dynamic-syms
|
|
|
|
# into a simple format that should not change when the ABI is not changing.
|
|
|
|
|
2003-03-27 11:54:09 +00:00
|
|
|
BEGIN {
|
2003-03-28 11:41:52 +00:00
|
|
|
if (combine_fullname)
|
|
|
|
combine = 1;
|
|
|
|
if (combine)
|
|
|
|
parse_names = 1;
|
2003-03-27 11:54:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Per-file header.
|
2003-04-02 04:00:03 +00:00
|
|
|
/[^ :]+\.so\.[0-9.]+:[ ]+.file format .*$/ {
|
2003-03-28 22:25:57 +00:00
|
|
|
emit(0);
|
2003-03-27 11:54:09 +00:00
|
|
|
|
2003-03-30 22:17:05 +00:00
|
|
|
seen_opd = 0;
|
|
|
|
|
2003-03-27 11:54:09 +00:00
|
|
|
sofullname = $1;
|
|
|
|
sub(/:$/, "", sofullname);
|
|
|
|
soname = sofullname;
|
|
|
|
sub(/^.*\//, "", soname);
|
2003-04-02 04:00:03 +00:00
|
|
|
sub(/\.so\.[0-9.]+$/, "", soname);
|
2003-03-27 11:54:09 +00:00
|
|
|
|
2003-03-28 22:25:57 +00:00
|
|
|
suppress = ((filename_regexp != "" && sofullname !~ filename_regexp) \
|
|
|
|
|| (libname_regexp != "" && soname !~ libname_regexp));
|
|
|
|
|
2003-03-27 11:54:09 +00:00
|
|
|
next
|
|
|
|
}
|
|
|
|
|
2003-03-28 22:25:57 +00:00
|
|
|
suppress { next }
|
|
|
|
|
2002-11-14 03:59:56 +00:00
|
|
|
# Normalize columns.
|
|
|
|
/^[0-9a-fA-F]+ / { sub(/ /, " - ") }
|
|
|
|
|
|
|
|
# Skip undefineds.
|
|
|
|
$4 == "*UND*" { next }
|
|
|
|
|
|
|
|
# Skip locals.
|
|
|
|
$2 == "l" { next }
|
|
|
|
|
2012-05-30 18:02:44 +00:00
|
|
|
# If the target uses ST_OTHER, it will be output before the symbol name.
|
|
|
|
$2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
|
2002-12-23 11:17:18 +00:00
|
|
|
weak = $2;
|
2002-11-14 03:59:56 +00:00
|
|
|
type = $3;
|
2002-11-24 01:54:06 +00:00
|
|
|
size = $5;
|
|
|
|
sub(/^0*/, "", size);
|
2002-12-23 11:17:18 +00:00
|
|
|
size = " 0x" size;
|
2002-11-14 03:59:56 +00:00
|
|
|
version = $6;
|
2012-05-30 18:02:44 +00:00
|
|
|
symbol = $NF;
|
2002-11-14 03:59:56 +00:00
|
|
|
gsub(/[()]/, "", version);
|
|
|
|
|
|
|
|
if (version == "GLIBC_PRIVATE") next;
|
|
|
|
|
2003-03-28 11:41:52 +00:00
|
|
|
desc = "";
|
2002-11-14 03:59:56 +00:00
|
|
|
if (type == "D" && $4 == ".tbss") {
|
2002-12-23 11:17:18 +00:00
|
|
|
type = "T";
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
2002-11-21 03:41:31 +00:00
|
|
|
else if (type == "D" && $4 == ".opd") {
|
2003-03-30 22:17:05 +00:00
|
|
|
type = "F";
|
2002-12-23 11:17:18 +00:00
|
|
|
size = "";
|
2003-03-30 22:17:05 +00:00
|
|
|
if (seen_opd < 0)
|
|
|
|
type = "O";
|
|
|
|
seen_opd = 1;
|
2002-11-21 03:41:31 +00:00
|
|
|
}
|
2012-05-30 18:02:44 +00:00
|
|
|
else if (type == "D" && NF == 8 && $7 == "0x80") {
|
|
|
|
# Alpha functions avoiding plt entry in users
|
|
|
|
type = "F";
|
|
|
|
size = "";
|
|
|
|
seen_opd = -1;
|
|
|
|
}
|
2003-03-28 11:41:52 +00:00
|
|
|
else if ($4 == "*ABS*") {
|
2002-12-23 11:17:18 +00:00
|
|
|
type = "A";
|
|
|
|
size = "";
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
|
|
|
else if (type == "DO") {
|
2002-12-23 11:17:18 +00:00
|
|
|
type = "D";
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
|
|
|
else if (type == "DF") {
|
2003-03-30 22:17:05 +00:00
|
|
|
if (symbol ~ /^\./ && seen_opd >= 0)
|
|
|
|
next;
|
|
|
|
seen_opd = -1;
|
2002-12-23 11:17:18 +00:00
|
|
|
type = "F";
|
|
|
|
size = "";
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
2012-11-28 09:24:06 +00:00
|
|
|
else if (type == "iD" && ($4 == ".text" || $4 == ".opd")) {
|
2012-01-08 00:23:45 +00:00
|
|
|
# Indirect functions.
|
|
|
|
type = "F";
|
|
|
|
size = "";
|
|
|
|
}
|
2002-11-14 03:59:56 +00:00
|
|
|
else {
|
2003-03-28 11:41:52 +00:00
|
|
|
desc = symbol " " version " " weak " ? " type " " $4 " " $5;
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
2003-03-03 07:11:42 +00:00
|
|
|
if (size == " 0x") {
|
2003-03-28 11:41:52 +00:00
|
|
|
desc = symbol " " version " " weak " ? " type " " $4 " " $5;
|
2003-03-03 07:11:42 +00:00
|
|
|
}
|
2002-11-14 03:59:56 +00:00
|
|
|
|
2003-03-03 02:38:21 +00:00
|
|
|
# Disabled -- weakness should not matter to shared library ABIs any more.
|
|
|
|
#if (weak == "w") type = tolower(type);
|
2003-03-28 11:41:52 +00:00
|
|
|
if (desc == "")
|
|
|
|
desc = " " symbol " " type size;
|
2002-12-23 11:17:18 +00:00
|
|
|
|
2003-03-28 22:25:57 +00:00
|
|
|
if (combine)
|
|
|
|
version = soname " " version (combine_fullname ? " " sofullname : "");
|
|
|
|
|
2002-12-23 11:17:18 +00:00
|
|
|
if (version in versions) {
|
|
|
|
versions[version] = versions[version] "\n" desc;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
versions[version] = desc;
|
|
|
|
}
|
2002-11-14 03:59:56 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Header crapola.
|
|
|
|
NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
|
|
|
|
|
|
|
|
{
|
2003-03-28 11:41:52 +00:00
|
|
|
print "Don't grok this line:", $0
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
2002-12-23 11:17:18 +00:00
|
|
|
|
2003-03-28 22:25:57 +00:00
|
|
|
function emit(end) {
|
2003-04-02 04:00:03 +00:00
|
|
|
if (!end && (combine || ! parse_names || soname == ""))
|
2003-03-28 22:25:57 +00:00
|
|
|
return;
|
2003-04-02 04:00:03 +00:00
|
|
|
tofile = parse_names && !combine;
|
2003-03-28 22:25:57 +00:00
|
|
|
|
2003-03-28 11:41:52 +00:00
|
|
|
nverslist = 0;
|
2002-12-23 11:17:18 +00:00
|
|
|
for (version in versions) {
|
|
|
|
if (nverslist == 0) {
|
|
|
|
verslist = version;
|
|
|
|
nverslist = 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
split(verslist, s, "\n");
|
|
|
|
if (version < s[1]) {
|
|
|
|
verslist = version;
|
|
|
|
for (i = 1; i <= nverslist; ++i) {
|
|
|
|
verslist = verslist "\n" s[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
verslist = s[1];
|
|
|
|
for (i = 2; i <= nverslist; ++i) {
|
|
|
|
if (version < s[i]) break;
|
|
|
|
verslist = verslist "\n" s[i];
|
|
|
|
}
|
|
|
|
verslist = verslist "\n" version;
|
|
|
|
for (; i <= nverslist; ++i) {
|
|
|
|
verslist = verslist "\n" s[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++nverslist;
|
|
|
|
}
|
|
|
|
|
2003-03-27 12:28:49 +00:00
|
|
|
if (tofile) {
|
|
|
|
out = prefix soname ".symlist";
|
|
|
|
if (soname in outfiles)
|
|
|
|
out = out "." ++outfiles[soname];
|
|
|
|
else
|
|
|
|
outfiles[soname] = 1;
|
|
|
|
printf "" > out;
|
|
|
|
}
|
|
|
|
|
2002-12-23 11:17:18 +00:00
|
|
|
split(verslist, order, "\n");
|
|
|
|
for (i = 1; i <= nverslist; ++i) {
|
|
|
|
version = order[i];
|
|
|
|
|
2003-03-27 12:28:49 +00:00
|
|
|
if (tofile) {
|
|
|
|
print version >> out;
|
|
|
|
close(out);
|
|
|
|
outpipe = "sort >> " out;
|
|
|
|
}
|
2003-03-28 11:41:52 +00:00
|
|
|
else {
|
2003-03-28 22:25:57 +00:00
|
|
|
if (combine)
|
|
|
|
print "";
|
|
|
|
print prefix version;
|
2003-03-27 12:28:49 +00:00
|
|
|
outpipe = "sort";
|
2003-03-28 11:41:52 +00:00
|
|
|
}
|
2002-12-23 11:17:18 +00:00
|
|
|
print versions[version] | outpipe;
|
|
|
|
close(outpipe);
|
2003-03-27 11:54:09 +00:00
|
|
|
|
|
|
|
delete versions[version];
|
|
|
|
}
|
2003-03-27 12:28:49 +00:00
|
|
|
for (version in versions)
|
|
|
|
delete versions[version];
|
2003-03-27 11:54:09 +00:00
|
|
|
|
|
|
|
if (tofile)
|
|
|
|
print "wrote", out, "for", sofullname;
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
2003-03-28 22:25:57 +00:00
|
|
|
emit(1);
|
2002-12-23 11:17:18 +00:00
|
|
|
}
|