File list-exported-symbols of Package kernel-source (Revision 0d54b63c449d1f20839786d7c71243b9)
Currently displaying revision 0d54b63c449d1f20839786d7c71243b9, show latest
1
#! /bin/sh
2
3
# Generate a Module.symvers-like list of symbols a module exports.
4
5
usage() {
6
echo "USAGE: ${0##*/} [-n name] objfile" >&2
7
exit 1
8
}
9
10
options=`getopt -o n: -- "$@"`
11
[ $? -eq 0 ] || usage
12
13
eval set -- "$options"
14
while :; do
15
case "$1" in
16
-n)
17
opt_n=$2
18
shift
19
;;
20
--)
21
shift
22
break
23
;;
24
esac
25
shift
26
done
27
28
[ $# -eq 1 ] || usage
29
30
if [ -z "$opt_n" ]; then
31
opt_n=${1%.ko}
32
opt_n=${opt_n#*/kernel/}
33
fi
34
35
objdump -t "$1" | awk '
36
BEGIN { known_types["__ksymtab"] = "EXPORT_SYMBOL"
37
known_types["__ksymtab_unused"] = "EXPORT_UNUSED_SYMBOL"
38
known_types["__ksymtab_gpl"] = "EXPORT_SYMBOL_GPL"
39
known_types["__ksymtab_unused_gpl"] = "EXPORT_UNUSED_SYMBOL_GPL"
40
known_types["__ksymtab_gpl_future"] = "EXPORT_SYMBOL_GPL_FUTURE"
41
}
42
{ if (NF < 3)
43
next
44
if (substr($0, index($0, " ") + 6, 1) == "d")
45
next # debug symbol
46
if (gsub(/^__crc_/, "", $NF))
47
crcs[$NF] = gensub(/^00000000(.+)/, "\\1", "", $1)
48
else if (gsub(/^__ksymtab_/, "", $NF) &&
49
($(NF-2) in known_types))
50
types[$NF] = known_types[$(NF-2)]
51
}
52
END { for (sym in types) {
53
crc = (sym in crcs ? crcs[sym] : "00000000")
54
print "0x" crc "\t" sym "\t" module "\t" types[sym]
55
}
56
}
57
' module="$opt_n"
58