Include <ucred.h> if we have getpeerucred()
[heimdal.git] / cf / w32-list-externs-from-objs.pl
blob882801a229048172a51637efebe9cb5d87443230
1 my $show_module_name = 1;
2 my $use_indent = 1;
3 my $strip_leading_underscore = 0;
5 # Dump all symbols for the given object file that are defined and have
6 # external scope.
8 sub dump_symbols_for_file($)
10 $fn = shift;
12 print STDERR "Opening dump of object [$fn]\n";
14 open(SP, '-|', "dumpbin /symbols \"".$fn."\"") or die "Can't open pipe for $fn";
16 LINE:
17 while (<SP>) {
18 # 008 00000000 SECT3 notype () External | _encode_AccessDescription
20 /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+(\(\)| )\s+(\w+)\s+\|\s+([0-9a-zA-Z\@\_]+)$/ && do {
21 my ($section, $type, $visibility, $symbol) = ($1, $2, $3, $4);
23 if ($section ne "UNDEF" && $visibility eq "External") {
24 print $fn if $show_module_name;
25 print "\t" if $use_indent || $show_module_name;
27 if ($strip_leading_underscore && $symbol =~ /_(.*)/) {
28 $symbol = $1;
30 if ($strip_leading_underscore && $symbol =~ /(.*)\@.*$/) {
31 $symbol = $1;
33 print $symbol;
34 if ($type ne "()") {
35 print "\tDATA";
37 print "\n";
42 close SP;
45 sub use_response_file($)
47 $fn = shift;
49 open (RF, '<', $fn) or die "Can't open response file $fn";
51 while (<RF>) {
52 /(\S+)/ && do {
53 dump_symbols_for_file($1);
56 close RF;
59 for (@ARGV) {
60 ARG: {
61 /-q/ && do {
62 $show_module_name = 0;
63 last ARG;
66 /-1/ && do {
67 $use_indent = 0;
68 last ARG;
71 /-u/ && do {
72 $strip_leading_underscore = 1;
73 last ARG;
76 /@(.*)/ && do {
77 use_response_file($1);
78 last ARG;
81 dump_symbols_for_file($_);