Build libasn1 as a DLL

In addition to building libasn1 as a DLL also add a build target
so that a list of exports can be generated and used to check with
the .def file whether any exports are being left out.
This commit is contained in:
Asanka Herath
2009-09-01 16:30:29 -04:00
committed by Love Hornquist Astrand
parent 2df5c26c00
commit 9072a62729
3 changed files with 1601 additions and 4 deletions

View File

@@ -0,0 +1,77 @@
my $show_module_name = 1;
my $use_indent = 1;
my $strip_leading_underscore = 0;
# Dump all symbols for the given object file that are defined and have
# external scope.
sub dump_symbols_for_file($)
{
$fn = shift;
print STDERR "Opening dump of object [$fn]\n";
open(SP, '-|', "dumpbin /symbols \"".$fn."\"") or die "Can't open pipe for $fn";
LINE:
while (<SP>) {
# 008 00000000 SECT3 notype () External | _encode_AccessDescription
/^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+\(\)\s+(\w+)\s+\|\s+(\w+)$/ && do {
my ($section, $visibility, $symbol) = ($1, $2, $3);
if ($section ne "UNDEF" && $visibility eq "External") {
print $fn if $show_module_name;
print "\t" if $use_indent || $show_module_name;
if ($strip_leading_underscore && $symbol =~ /_(.*)/) {
$symbol = $1;
}
print $symbol;
print "\n";
}
};
}
close SP;
}
sub use_response_file($)
{
$fn = shift;
open (RF, '<', $fn) or die "Can't open response file $fn";
while (<RF>) {
/(\S+)/ && do {
dump_symbols_for_file($1);
}
}
close RF;
}
for (@ARGV) {
ARG: {
/-q/ && do {
$show_module_name = 0;
last ARG;
};
/-1/ && do {
$use_indent = 0;
last ARG;
};
/-u/ && do {
$strip_leading_underscore = 1;
last ARG;
};
/@(.*)/ && do {
use_response_file($1);
last ARG;
};
dump_symbols_for_file($_);
}
}

View File

@@ -470,7 +470,7 @@ gen_files_kx509 = \
$(OBJ)\asn1_Kx509Response.x \
$(OBJ)\asn1_Kx509Request.x
asn1_binaries = \
ASN1_BINARIES = \
$(BINDIR)\asn1_compile.exe \
$(BINDIR)\asn1_print.exe \
$(BINDIR)\asn1_gen.exe
@@ -517,7 +517,7 @@ $(BINDIR)\asn1_gen.exe: $(OBJ)\asn1_gen.obj $(LIBASN1)
$(_VC_MANIFEST_CLEAN)
$(_CODESIGN)
$(LIBASN1): \
LIBASN1_OBJS= \
$(OBJ)\der.obj \
$(OBJ)\der_get.obj \
$(OBJ)\der_put.obj \
@@ -538,13 +538,35 @@ $(LIBASN1): \
$(gen_files_digest:.x=.obj) \
$(gen_files_kx509:.x=.obj) \
$(OBJ)\asn1_err.obj
$(LIBCON_C) /OUT:$@ @<<
LIBASN1_LIBS=\
$(LIBROKEN) \
$(LIBCOMERR)
$(LIBASN1): $(BINDIR)\libasn1.dll
$(BINDIR)\libasn1.dll: $(LIBASN1_OBJS)
$(DLLGUILINK_C) /OUT:$@ /DEF:libasn1-exports.def /IMPLIB:$(LIBASN1) $(LIBASN1_LIBS) @<<
$(**: =
)
<<
$(DLLPREP)
clean::
-$(RM) $(LIBASN1)
-$(RM) $(BINDIR)\libasn1.dll
#
# Generate list of exports
#
# This target is only used during development to generate a list of
# symbols that are exported from all the object files in LIBASN1_OBJS.
#
exports-list.txt: $(LIBASN1_OBJS)
$(PERL) ..\..\cf\w32-list-externs-from-objs.pl -q -u @<< > $@
$(**: =
)
<<
$(gen_files_k5:.x=.c) : $$(@R).x
@@ -681,7 +703,7 @@ $(OBJ)\der-protos.h: $(libasn1_SOURCES:der-protos.h=)
clean::
-$(RM) $(INCDIR)\der-protos.h
all:: $(INCFILES) $(GENINCFILES) $(LIBASN1) $(asn1_binaries)
all:: $(INCFILES) $(ASN1_BINARIES) $(GENINCFILES) $(LIBASN1)
TEST_BINARIES=\
$(OBJ)\check-der.exe \

1498
lib/asn1/libasn1-exports.def Normal file

File diff suppressed because it is too large Load Diff