Logoj0ke.net Open Build Service > Projects > GFS > kernel-source > built-in-where
Sign Up | Log In

File built-in-where of Package kernel-source (Revision 087b3efd29f4527d1d360319e73714c9)

Currently displaying revision 087b3efd29f4527d1d360319e73714c9, show latest

 
1
#! /bin/bash
2
3
sourcedir=${0%/*}
4
5
# A lot of symbols are exported by the main kernel image. Find out
6
# more precisely which built-in.o file defines them, and fill in
7
# that information in Module.symvers. (The built-in.o files are
8
# linked together from one or more object files in a directory.)
9
#   We use this information to better group symbols by subsystems.
10
#
11
# Usage: built-in-where < Module.symvers
12
13
unset LANG ${!LC_*}
14
15
# Create a table of all symbol export in a built-in.o file, e.g.,
16
# 0xc87c1f84   ktime_get   kernel/built-in   EXPORT_SYMBOL_GPL
17
built_in_exports() {
18
    # a/b/c/built-in.o gets linked into a/b/built-in.o, so ensure
19
    # that we visit sub-directories first to split up symbols as
20
    # much as possible.
21
    for obj in $(find -name built-in.o -printf '%d %P\n' \
22
        | sort -r \
23
        | awk '{ print $2 }'); do
24
    $sourcedir/list-exported-symbols -n ${obj%.o} $obj
25
    done
26
27
    # We could go through the libraries as well, but those functions
28
    # are so unlikely to change that this wouldn't help.
29
    # (All remaining symbols will end up in the vmlinux set.)
30
    #for archive in $(find -name '*.a'); do
31
    #   $sourcedir/list-exported-symbols -n ${archive%.a} $archive
32
    #done
33
}
34
35
# Filter out duplicates from a Module.symvers dump
36
unique_symbols() {
37
    awk '
38
      { if ($2 in seen)
39
      next
40
    seen[$2] = 1
41
    print
42
      }
43
    '
44
}
45
46
# Join together the two tables, including all lines from the first
47
# file that don't have a match in the second.
48
# Finally, remove the duplicate columns.
49
join -t $'\t' -j 2 -a 1 \
50
    <(sort -k2) \
51
    <(built_in_exports | unique_symbols | sort -k2) \
52
| awk '
53
BEGIN   { FS = "\t" ; OFS = "\t" }
54
NF == 7 { print $2, $1, $6, $4 }
55
NF == 4 { print $2, $1, $3, $4 }
56
'
57