xref: /freebsd/sys/conf/kmod_syms.awk (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2# Read global symbols from object file.
3BEGIN {
4	modname = ARGV[1]
5        while ("${NM:='nm'} -g " ARGV[1] | getline) {
6                if (match($0, /^[^[:space:]]+ [^AU] (.*)$/)) {
7                        syms[$3] = $2
8                }
9        }
10        delete ARGV[1]
11}
12
13# De-list symbols from the export list.
14{
15	smbl = $0
16	if (!(smbl in syms)) {
17		printf "Symbol %s is not present in %s\n",	\
18		    smbl, modname > "/dev/stderr"
19	}
20	delete syms[smbl]
21}
22
23# Strip commons, make everything else local.
24END {
25        for (member in syms) {
26                if (syms[member] == "C")
27                        print "-N" member
28                else
29                        print "-L" member
30        }
31}
32