189180Smsmith# $FreeBSD$
289180Smsmith
389180Smsmith# Read global symbols from object file.
489180SmsmithBEGIN {
595034Smarcel        while ("${NM:='nm'} -g " ARGV[1] | getline) {
689180Smsmith                if (match($0, /^[^[:space:]]+ [^AU] (.*)$/)) {
789180Smsmith                        syms[$3] = $2
889180Smsmith                }
989180Smsmith        }
10101438Siedowse        delete ARGV[1]
1189180Smsmith}
1289180Smsmith
1389180Smsmith# De-list symbols from the export list.
1493161Sobrien{
1589180Smsmith        delete syms[$0]
1689180Smsmith}
1789180Smsmith
1889180Smsmith# Strip commons, make everything else local.
1989180SmsmithEND {
2089180Smsmith        for (member in syms) {
2189180Smsmith                if (syms[member] == "C")
2289180Smsmith                        print "-N" member
2389180Smsmith                else
2489180Smsmith                        print "-L" member
2589180Smsmith        }
2689180Smsmith}
27