xref: /freebsd/sys/conf/kmod_syms_prefix.awk (revision 8657387683946d0c03e09fe77029edfe309eeb20)
1# $FreeBSD$
2
3# Read global symbols from object file.
4BEGIN {
5        while ("${NM:='nm'} " ARGV[1] | getline) {
6                if (match($0, /^[^[:space:]]+ [^AU] (.*)$/)) {
7                        syms[$3] = $2
8                }
9        }
10        delete ARGV[1]
11}
12
13# Strip commons, make everything else local.
14END {
15        for (member in syms) {
16                printf("--redefine-sym=%s=%s%s\n", member, prefix, member);
17        }
18}
19