2002-11-14 11:59:56 +08: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 19:54:09 +08:00
|
|
|
BEGIN {
|
2003-03-28 19:41:52 +08:00
|
|
|
if (combine_fullname)
|
|
|
|
combine = 1;
|
|
|
|
if (combine)
|
|
|
|
parse_names = 1;
|
2003-03-27 19:54:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Per-file header.
|
2003-04-02 12:00:03 +08:00
|
|
|
/[^ :]+\.so\.[0-9.]+:[ ]+.file format .*$/ {
|
2003-03-29 06:25:57 +08:00
|
|
|
emit(0);
|
2003-03-27 19:54:09 +08:00
|
|
|
|
2003-03-31 06:17:05 +08:00
|
|
|
seen_opd = 0;
|
|
|
|
|
2003-03-27 19:54:09 +08:00
|
|
|
sofullname = $1;
|
|
|
|
sub(/:$/, "", sofullname);
|
|
|
|
soname = sofullname;
|
|
|
|
sub(/^.*\//, "", soname);
|
2003-04-02 12:00:03 +08:00
|
|
|
sub(/\.so\.[0-9.]+$/, "", soname);
|
2003-03-27 19:54:09 +08:00
|
|
|
|
2003-03-29 06:25:57 +08:00
|
|
|
suppress = ((filename_regexp != "" && sofullname !~ filename_regexp) \
|
|
|
|
|| (libname_regexp != "" && soname !~ libname_regexp));
|
|
|
|
|
2003-03-27 19:54:09 +08:00
|
|
|
next
|
|
|
|
}
|
|
|
|
|
2003-03-29 06:25:57 +08:00
|
|
|
suppress { next }
|
|
|
|
|
2002-11-14 11:59:56 +08:00
|
|
|
# Normalize columns.
|
|
|
|
/^[0-9a-fA-F]+ / { sub(/ /, " - ") }
|
|
|
|
|
|
|
|
# Skip undefineds.
|
|
|
|
$4 == "*UND*" { next }
|
|
|
|
|
|
|
|
# Skip locals.
|
|
|
|
$2 == "l" { next }
|
|
|
|
|
2012-05-31 02:02:44 +08: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 19:17:18 +08:00
|
|
|
weak = $2;
|
2002-11-14 11:59:56 +08:00
|
|
|
type = $3;
|
2002-11-24 09:54:06 +08:00
|
|
|
size = $5;
|
|
|
|
sub(/^0*/, "", size);
|
2002-12-23 19:17:18 +08:00
|
|
|
size = " 0x" size;
|
2002-11-14 11:59:56 +08:00
|
|
|
version = $6;
|
2012-05-31 02:02:44 +08:00
|
|
|
symbol = $NF;
|
2002-11-14 11:59:56 +08:00
|
|
|
gsub(/[()]/, "", version);
|
|
|
|
|
2014-03-18 10:14:00 +08:00
|
|
|
# binutils versions up through at least 2.23 have some bugs that
|
|
|
|
# caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
|
|
|
|
if (NF > 7 && $7 == ".hidden") next;
|
|
|
|
|
2002-11-14 11:59:56 +08:00
|
|
|
if (version == "GLIBC_PRIVATE") next;
|
|
|
|
|
2003-03-28 19:41:52 +08:00
|
|
|
desc = "";
|
2002-11-14 11:59:56 +08:00
|
|
|
if (type == "D" && $4 == ".tbss") {
|
2002-12-23 19:17:18 +08:00
|
|
|
type = "T";
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
2002-11-21 11:41:31 +08:00
|
|
|
else if (type == "D" && $4 == ".opd") {
|
2003-03-31 06:17:05 +08:00
|
|
|
type = "F";
|
2002-12-23 19:17:18 +08:00
|
|
|
size = "";
|
2003-03-31 06:17:05 +08:00
|
|
|
if (seen_opd < 0)
|
|
|
|
type = "O";
|
|
|
|
seen_opd = 1;
|
2002-11-21 11:41:31 +08:00
|
|
|
}
|
2012-05-31 02:02:44 +08: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 19:41:52 +08:00
|
|
|
else if ($4 == "*ABS*") {
|
2002-12-23 19:17:18 +08:00
|
|
|
type = "A";
|
|
|
|
size = "";
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
|
|
|
else if (type == "DO") {
|
2002-12-23 19:17:18 +08:00
|
|
|
type = "D";
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
|
|
|
else if (type == "DF") {
|
2003-03-31 06:17:05 +08:00
|
|
|
if (symbol ~ /^\./ && seen_opd >= 0)
|
|
|
|
next;
|
|
|
|
seen_opd = -1;
|
2002-12-23 19:17:18 +08:00
|
|
|
type = "F";
|
|
|
|
size = "";
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
2012-11-28 17:24:06 +08:00
|
|
|
else if (type == "iD" && ($4 == ".text" || $4 == ".opd")) {
|
2012-01-08 08:23:45 +08:00
|
|
|
# Indirect functions.
|
|
|
|
type = "F";
|
|
|
|
size = "";
|
|
|
|
}
|
2002-11-14 11:59:56 +08:00
|
|
|
else {
|
2003-03-28 19:41:52 +08:00
|
|
|
desc = symbol " " version " " weak " ? " type " " $4 " " $5;
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
2003-03-03 15:11:42 +08:00
|
|
|
if (size == " 0x") {
|
2003-03-28 19:41:52 +08:00
|
|
|
desc = symbol " " version " " weak " ? " type " " $4 " " $5;
|
2003-03-03 15:11:42 +08:00
|
|
|
}
|
2002-11-14 11:59:56 +08:00
|
|
|
|
2003-03-03 10:38:21 +08:00
|
|
|
# Disabled -- weakness should not matter to shared library ABIs any more.
|
|
|
|
#if (weak == "w") type = tolower(type);
|
2003-03-28 19:41:52 +08:00
|
|
|
if (desc == "")
|
2015-10-29 22:33:54 +08:00
|
|
|
desc = symbol " " type size;
|
2002-12-23 19:17:18 +08:00
|
|
|
|
2003-03-29 06:25:57 +08:00
|
|
|
if (combine)
|
|
|
|
version = soname " " version (combine_fullname ? " " sofullname : "");
|
|
|
|
|
2015-10-29 22:33:54 +08:00
|
|
|
# Append to the string which collects the results.
|
|
|
|
descs = descs version " " desc "\n";
|
2002-11-14 11:59:56 +08:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Header crapola.
|
|
|
|
NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
|
|
|
|
|
|
|
|
{
|
2003-03-28 19:41:52 +08:00
|
|
|
print "Don't grok this line:", $0
|
2002-11-14 11:59:56 +08:00
|
|
|
}
|
2002-12-23 19:17:18 +08:00
|
|
|
|
2003-03-29 06:25:57 +08:00
|
|
|
function emit(end) {
|
2003-04-02 12:00:03 +08:00
|
|
|
if (!end && (combine || ! parse_names || soname == ""))
|
2003-03-29 06:25:57 +08:00
|
|
|
return;
|
2003-04-02 12:00:03 +08:00
|
|
|
tofile = parse_names && !combine;
|
2003-03-29 06:25:57 +08:00
|
|
|
|
2003-03-27 20:28:49 +08:00
|
|
|
if (tofile) {
|
|
|
|
out = prefix soname ".symlist";
|
|
|
|
if (soname in outfiles)
|
|
|
|
out = out "." ++outfiles[soname];
|
|
|
|
else
|
|
|
|
outfiles[soname] = 1;
|
2015-10-29 22:33:54 +08:00
|
|
|
outpipe = "LC_ALL=C sort -u > " out;
|
|
|
|
} else {
|
|
|
|
outpipe = "LC_ALL=C sort -u";
|
2003-03-27 20:28:49 +08:00
|
|
|
}
|
|
|
|
|
2015-10-29 22:33:54 +08:00
|
|
|
printf "%s", descs | outpipe;
|
|
|
|
|
|
|
|
descs = "";
|
2003-03-27 19:54:09 +08:00
|
|
|
|
|
|
|
if (tofile)
|
|
|
|
print "wrote", out, "for", sofullname;
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
2003-03-29 06:25:57 +08:00
|
|
|
emit(1);
|
2002-12-23 19:17:18 +08:00
|
|
|
}
|