summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1995-10-15 11:33:42 +0000
committerphk <phk@FreeBSD.org>1995-10-15 11:33:42 +0000
commit808912e9eb4e5e942c8287ec91734540cfdea4df (patch)
tree41a808a828b8c82d35cf2371a1be4d0a0adba023
parent0f2fa11e9b1b63b883ff22a05ce8239cdc89cba0 (diff)
downloadFreeBSD-src-808912e9eb4e5e942c8287ec91734540cfdea4df.zip
FreeBSD-src-808912e9eb4e5e942c8287ec91734540cfdea4df.tar.gz
Add kernxref, a shellscript to crossreference the symbols of the LINT kernel.
-rw-r--r--tools/tools/README2
-rw-r--r--tools/tools/kernxref/kernxref.sh73
2 files changed, 75 insertions, 0 deletions
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):
+# <phk@login.dknet.dk> 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 = "<Linker set>"
+ if ($2 == "{C}")
+ $2 = "<Common symbol>"
+ 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
+ }
+ }
+'
OpenPOWER on IntegriCloud