mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 19:51:09 +01:00
0d7a6199b6
Print some warning when export is requested for non-existing symbol. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32878
33 lines
714 B
Awk
33 lines
714 B
Awk
# $FreeBSD$
|
|
|
|
# Read global symbols from object file.
|
|
BEGIN {
|
|
modname = ARGV[1]
|
|
while ("${NM:='nm'} -g " ARGV[1] | getline) {
|
|
if (match($0, /^[^[:space:]]+ [^AU] (.*)$/)) {
|
|
syms[$3] = $2
|
|
}
|
|
}
|
|
delete ARGV[1]
|
|
}
|
|
|
|
# De-list symbols from the export list.
|
|
{
|
|
smbl = $0
|
|
if (!(smbl in syms)) {
|
|
printf "Symbol %s is not present in %s\n", \
|
|
smbl, modname > "/dev/stderr"
|
|
}
|
|
delete syms[smbl]
|
|
}
|
|
|
|
# Strip commons, make everything else local.
|
|
END {
|
|
for (member in syms) {
|
|
if (syms[member] == "C")
|
|
print "-N" member
|
|
else
|
|
print "-L" member
|
|
}
|
|
}
|