From 808912e9eb4e5e942c8287ec91734540cfdea4df Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 15 Oct 1995 11:33:42 +0000 Subject: Add kernxref, a shellscript to crossreference the symbols of the LINT kernel. --- tools/tools/README | 2 ++ tools/tools/kernxref/kernxref.sh | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tools/tools/kernxref/kernxref.sh diff --git a/tools/tools/README b/tools/tools/README index 5d7c68d..2c4148c 100644 --- a/tools/tools/README +++ b/tools/tools/README @@ -4,3 +4,5 @@ A tool is something which is sometimes useful, and doesn't fit any of the other categories. Please make a subdir per program, and add a brief description to this file. + +kernxref Shellscript to cross reference symbols in the LINT kernel. diff --git a/tools/tools/kernxref/kernxref.sh b/tools/tools/kernxref/kernxref.sh new file mode 100644 index 0000000..33d6cf8 --- /dev/null +++ b/tools/tools/kernxref/kernxref.sh @@ -0,0 +1,73 @@ +: +# +# ---------------------------------------------------------------------------- +# "THE BEER-WARE LICENSE" (Revision 42): +# wrote this file. As long as you retain this notice you +# can do whatever you want with this stuff. If we meet some day, and you think +# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp +# ---------------------------------------------------------------------------- +# +# $Id$ +# +# This shellscript will make a cross reference of the symbols of the LINT +# kernell. + +cd /sys/compile/LINT +nm -gon *.o /sys/libkern/obj/*.o /lkm/* | tr : ' ' | awk ' +NF > 1 { + if (length($2) == 8) { + $2 = $3 + $3 = $4 + } + if ($2 == "t") + next + if ($2 == "F") + next + nm[$3]++ + if ($2 == "U") { + ref[$3]=ref[$3]" "$1 + } else if ($2 == "T" || $2 == "D" || $2 == "A") { + if (def[$3] != "") + def[$3]=def[$3]","$1 + else + def[$3]=$1 + } else if ($2 == "?") { + if (def[$3] == "S") + i++ + else if (def[$3] != "") + def[$3]=def[$3]",S" + else + def[$3]="S" + ref[$3]=ref[$3]" "$1 + } else if ($2 == "C") { + if (def[$3] == $2) + i++ + else if (def[$3] != "") + def[$3]=def[$3]",C" + else + def[$3]="C" + ref[$3]=ref[$3]" "$1 + } else { + print ">>>",$0 + } + } +END { + for (i in nm) { + printf "%s {%s} %s\n",i,def[i],ref[i] + } + } +' | sort | awk ' + { + if ($2 == "{S}") + $2 = "" + if ($2 == "{C}") + $2 = "" + if (length($3) == 0) { + printf "%-30s %s UNREF\n",$1,$2 + } else if ($2 == "{}") { + printf "%-30s {UNDEF}\n",$1 + } else { + printf "%-30s %s\n\t%s\n",$1,$2,$3 + } + } +' -- cgit v1.1