MSVC: Build ~35% faster by calling dumpbin just once per directory.
Peifeng Qiu Discussion: https://postgr.es/m/CABmtVJiKXQjast0dQD-8KAtfm8XmyYxo-4Dc7+M+fBr8JRTqkw@mail.gmail.com
This commit is contained in:
parent
726cc4242a
commit
34ff542a71
@ -1,7 +1,6 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use 5.8.0;
|
use 5.8.0;
|
||||||
use File::Spec::Functions qw(splitpath catpath);
|
|
||||||
use List::Util qw(max);
|
use List::Util qw(max);
|
||||||
|
|
||||||
my @def;
|
my @def;
|
||||||
@ -12,17 +11,6 @@ my @def;
|
|||||||
# src/tools/msvc/gendef.pl
|
# src/tools/msvc/gendef.pl
|
||||||
#
|
#
|
||||||
|
|
||||||
sub dumpsyms
|
|
||||||
{
|
|
||||||
my ($objfile, $symfile) = @_;
|
|
||||||
my ($symvol, $symdirs, $symbase) = splitpath($symfile);
|
|
||||||
my $tmpfile = catpath($symvol, $symdirs, "symbols.out");
|
|
||||||
system("dumpbin /symbols /out:$tmpfile $_ >NUL")
|
|
||||||
&& die "Could not call dumpbin";
|
|
||||||
rename($tmpfile, $symfile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Given a symbol file path, loops over its contents
|
# Given a symbol file path, loops over its contents
|
||||||
# and returns a list of symbols of interest as a dictionary
|
# and returns a list of symbols of interest as a dictionary
|
||||||
# of 'symbolname' -> symtype, where symtype is:
|
# of 'symbolname' -> symtype, where symtype is:
|
||||||
@ -177,15 +165,12 @@ print "Generating $defname.DEF from directory $ARGV[0], platform $platform\n";
|
|||||||
|
|
||||||
my %def = ();
|
my %def = ();
|
||||||
|
|
||||||
while (<$ARGV[0]/*.obj>) ## no critic (RequireGlobFunction);
|
my $symfile = "$ARGV[0]/all.sym";
|
||||||
{
|
my $tmpfile = "$ARGV[0]/tmp.sym";
|
||||||
my $objfile = $_;
|
system("dumpbin /symbols /out:$tmpfile $ARGV[0]/*.obj >NUL")
|
||||||
my $symfile = $objfile;
|
&& die "Could not call dumpbin";
|
||||||
$symfile =~ s/\.obj$/.sym/i;
|
rename($tmpfile, $symfile);
|
||||||
dumpsyms($objfile, $symfile);
|
|
||||||
print ".";
|
|
||||||
extract_syms($symfile, \%def);
|
extract_syms($symfile, \%def);
|
||||||
}
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
writedef($deffile, $platform, \%def);
|
writedef($deffile, $platform, \%def);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user