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-11-14 03:59:56 +00:00
|
|
|
type = $3;
|
2002-11-24 01:54:06 +00:00
|
|
|
size = $5;
|
|
|
|
sub(/^0*/, "", size);
|
2018-11-30 15:03:29 +00:00
|
|
|
if (size == "") {
|
|
|
|
size = " 0x0";
|
|
|
|
} else {
|
|
|
|
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);
|
|
|
|
|
2014-03-18 02:14:00 +00: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 03:59:56 +00:00
|
|
|
if (version == "GLIBC_PRIVATE") next;
|
|
|
|
|
2003-03-28 11:41:52 +00:00
|
|
|
desc = "";
|
2018-11-20 22:06:30 +00:00
|
|
|
if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) {
|
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*") {
|
2018-05-04 15:46:32 +00:00
|
|
|
next;
|
2002-11-14 03:59:56 +00:00
|
|
|
}
|
2018-11-30 15:03:29 +00:00
|
|
|
else if (type == "D") {
|
|
|
|
# Accept unchanged.
|
|
|
|
}
|
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 {
|
2018-11-30 15:03:29 +00:00
|
|
|
print "ERROR: Unable to handle this type of symbol:", $0
|
2018-11-20 22:06:30 +00:00
|
|
|
exit 1
|
2003-03-03 07:11:42 +00:00
|
|
|
}
|
2002-11-14 03:59:56 +00:00
|
|
|
|
2003-03-28 11:41:52 +00:00
|
|
|
if (desc == "")
|
2015-10-29 14:33:54 +00:00
|
|
|
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 : "");
|
|
|
|
|
2015-10-29 14:33:54 +00:00
|
|
|
# Append to the string which collects the results.
|
|
|
|
descs = descs version " " desc "\n";
|
2002-11-14 03:59:56 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Header crapola.
|
|
|
|
NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
|
|
|
|
|
|
|
|
{
|
2018-11-20 22:06:30 +00:00
|
|
|
print "ERROR: Unable to interpret this line:", $0
|
|
|
|
exit 1
|
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-27 12:28:49 +00:00
|
|
|
if (tofile) {
|
|
|
|
out = prefix soname ".symlist";
|
|
|
|
if (soname in outfiles)
|
|
|
|
out = out "." ++outfiles[soname];
|
|
|
|
else
|
|
|
|
outfiles[soname] = 1;
|
2015-10-29 14:33:54 +00:00
|
|
|
outpipe = "LC_ALL=C sort -u > " out;
|
|
|
|
} else {
|
|
|
|
outpipe = "LC_ALL=C sort -u";
|
2003-03-27 12:28:49 +00:00
|
|
|
}
|
|
|
|
|
2015-10-29 14:33:54 +00:00
|
|
|
printf "%s", descs | outpipe;
|
|
|
|
|
|
|
|
descs = "";
|
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
|
|
|
}
|