2008-07-18 12:15:21 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
2008-10-28 00:21:37 +01:00
|
|
|
sourcedir=${0%/*}
|
|
|
|
|
2008-07-18 12:15:21 +02:00
|
|
|
# A lot of symbols are exported by the main kernel image. Find out
|
|
|
|
# more precisely which built-in.o file defines them, and fill in
|
|
|
|
# that information in Module.symvers. (The built-in.o files are
|
|
|
|
# linked together from one or more object files in a directory.)
|
|
|
|
# We use this information to better group symbols by subsystems.
|
|
|
|
#
|
|
|
|
# Usage: built-in-where < Module.symvers
|
|
|
|
|
|
|
|
unset LANG ${!LC_*}
|
|
|
|
|
|
|
|
# Create a table of all symbol export in a built-in.o file, e.g.,
|
2008-10-28 00:21:37 +01:00
|
|
|
# 0xc87c1f84 ktime_get kernel/built-in EXPORT_SYMBOL_GPL
|
2008-07-18 12:15:21 +02:00
|
|
|
built_in_exports() {
|
2008-10-28 00:21:37 +01:00
|
|
|
# a/b/c/built-in.o gets linked into a/b/built-in.o, so ensure
|
|
|
|
# that we visit sub-directories first to split up symbols as
|
|
|
|
# much as possible.
|
|
|
|
for obj in $(find -name built-in.o -printf '%d %P\n' \
|
|
|
|
| sort -r \
|
|
|
|
| awk '{ print $2 }'); do
|
2008-11-23 08:54:06 +01:00
|
|
|
$sourcedir/symsets.pl --list-exported-symbols $obj
|
2008-07-18 12:15:21 +02:00
|
|
|
done
|
2008-10-28 00:21:37 +01:00
|
|
|
|
|
|
|
# We could go through the libraries as well, but those functions
|
|
|
|
# are so unlikely to change that this wouldn't help.
|
|
|
|
# (All remaining symbols will end up in the vmlinux set.)
|
|
|
|
#for archive in $(find -name '*.a'); do
|
2008-11-23 08:54:06 +01:00
|
|
|
# $sourcedir/symsets.pl --list-exported-symbols $archive
|
2008-10-28 00:21:37 +01:00
|
|
|
#done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Filter out duplicates from a Module.symvers dump
|
|
|
|
unique_symbols() {
|
|
|
|
awk '
|
|
|
|
{ if ($2 in seen)
|
|
|
|
next
|
|
|
|
seen[$2] = 1
|
|
|
|
print
|
|
|
|
}
|
|
|
|
'
|
2008-07-18 12:15:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Join together the two tables, including all lines from the first
|
2008-10-28 00:21:37 +01:00
|
|
|
# file that don't have a match in the second.
|
|
|
|
# Finally, remove the duplicate columns.
|
|
|
|
join -t $'\t' -j 2 -a 1 \
|
|
|
|
<(sort -k2) \
|
|
|
|
<(built_in_exports | unique_symbols | sort -k2) \
|
2008-07-18 12:15:21 +02:00
|
|
|
| awk '
|
|
|
|
BEGIN { FS = "\t" ; OFS = "\t" }
|
2008-10-28 00:21:37 +01:00
|
|
|
NF == 7 { print $2, $1, $6, $4 }
|
|
|
|
NF == 4 { print $2, $1, $3, $4 }
|
2008-07-18 12:15:21 +02:00
|
|
|
'
|