提交 3a55c92b 编写于 作者: R Richard Levitte

Rethink the uplink / applink story

Adding uplink and applink to some builds was done by "magic", the
configuration for "mingw" only had a macro definition, the Configure
would react to its presence by adding the uplink source files to
cpuid_asm_src, and crypto/build.info inherited dance to get it
compiled, and Makefile.shared made sure applink.o would be
appropriately linked in.  That was a lot under the hood.

To replace this, we create a few template configurations in
Configurations/00-base-templates.conf, inherit one of them in the
"mingw" configuration, the rest is just about refering to the
$target{apps_aux_src} / $target{apps_obj} in the right places.
Reviewed-by: NAndy Polyakov <appro@openssl.org>
上级 5be5e56c
......@@ -12,7 +12,7 @@
thread_cflags => "",
thread_defines => [],
apps_extra_src => "",
apps_aux_src => "",
cpuid_asm_src => "mem_clr.c",
bn_asm_src => "bn_asm.c",
ec_asm_src => "",
......@@ -34,6 +34,7 @@
unistd => "<unistd.h>",
shared_target => "",
shared_cflag => "",
shared_defines => [],
shared_ldflag => "",
shared_rcflag => "",
shared_extension => "",
......@@ -41,6 +42,28 @@
build_file => "Makefile",
},
uplink_common => {
template => 1,
apps_aux_src => add(" ","../ms/applink.c"),
cpuid_asm_src => add(" ","../ms/uplink.c"),
shared_defines => add(undef, "OPENSSL_USE_APPLINK"),
},
x86_uplink => {
inherit_from => [ "uplink_common" ],
template => 1,
cpuid_asm_src => add(" ","uplink-x86.s"),
},
x86_64_uplink => {
inherit_from => [ "uplink_common" ],
template => 1,
cpuid_asm_src => add(" ","uplink-x86_64.s"),
},
ia64_uplink => {
inherit_from => [ "uplink_common" ],
template => 1,
cpuid_asm_src => add(" ","uplink-ia64.s"),
},
x86_asm => {
template => 1,
cpuid_asm_src => "x86cpuid.s",
......
......@@ -1162,7 +1162,8 @@
#### MinGW
"mingw" => {
inherit_from => [ asm("x86_asm") ],
inherit_from => [ asm("x86_asm"),
sub { $config{no_shared} ? () : "x86_uplink" } ],
cc => "gcc",
cflags => "-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -m32 -Wall",
debug_cflags => "-g -O0",
......@@ -1174,7 +1175,7 @@
perlasm_scheme => "coff",
dso_scheme => "win32",
shared_target => "cygwin-shared",
shared_cflag => "-D_WINDLL -DOPENSSL_USE_APPLINK",
shared_cflag => add(" ", "-D_WINDLL"),
shared_ldflag => "-static-libgcc",
shared_rcflag => "--target=pe-i386",
shared_extension => ".dll",
......@@ -1200,7 +1201,7 @@
perlasm_scheme => "mingw64",
dso_scheme => "win32",
shared_target => "cygwin-shared",
shared_cflag => "-D_WINDLL",
shared_cflag => add(" ", "-D_WINDLL"),
shared_ldflag => "-static-libgcc",
shared_rcflag => "--target=pe-x86-64",
shared_extension => ".dll",
......
......@@ -1013,10 +1013,6 @@ if ($target{ranlib} eq "")
if (!$no_asm) {
$target{cpuid_asm_src}=$table{BASE}->{cpuid_asm_src} if ($config{processor} eq "386");
$target{cpuid_asm_src}.=" uplink.c uplink-x86.s"
if (grep { $_ eq "OPENSSL_USE_APPLINK"} @{$config{defines}}
or $config{cflags} =~ /(?:^|\s)-DOPENSSL_USE_APPLINK(?:\s|$)/);
$target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m}));
# bn-586 is the only one implementing bn_*_part_words
......@@ -1542,9 +1538,9 @@ EOF
# For the schemes that need it, we provide the old *_obj configs
# from the *_asm_obj ones
foreach (grep /_asm_src$/, keys %target) {
foreach (grep /_(asm|aux)_src$/, keys %target) {
my $src = $_;
(my $obj = $_) =~ s/_asm_src$/_obj/;
(my $obj = $_) =~ s/_(asm|aux)_src$/_obj/;
($target{$obj} = $target{$src}) =~ s/\.[csS]\b/.o/g;
}
......
......@@ -120,6 +120,7 @@ ASFLAG=$(CFLAG)
PROCESSOR= {- $config{processor} -}
# CPUID module collects small commonly used assembler snippets
APPS_OBJ={- $target{apps_obj} -}
CPUID_OBJ= {- $target{cpuid_obj} -}
BN_ASM= {- $target{bn_obj} -}
EC_ASM= {- $target{ec_obj} -}
......@@ -260,6 +261,7 @@ BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
LDFLAG='$(LDFLAG)' \
PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)' \
APPS_OBJ='$(APPS_OBJ)' \
CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
......
......@@ -319,10 +319,6 @@ link_a.cygwin:
$(LINK_SO_A) || exit 1; \
rm $$extras
link_app.cygwin:
@if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \
LIBDEPS="$(SRCDIR)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \
export LIBDEPS; \
fi; \
$(LINK_APP)
link_o.alpha-osf1:
......
......@@ -15,6 +15,8 @@ PLIB_LDFLAG=
EX_LIBS=
EXE_EXT=
APPS_OBJ=
SHLIB_TARGET=
CFLAGS= $(INCLUDES) $(CFLAG)
......@@ -52,7 +54,7 @@ SRC = \
s_client.c s_server.c s_time.c sess_id.c smime.c speed.c spkac.c \
srp.c ts.c verify.c version.c x509.c rehash.c
EXE_OBJ = openssl.o $(OBJ) $(EXTRA_OBJ) $(RAND_OBJ)
EXE_OBJ = openssl.o $(OBJ) $(EXTRA_OBJ) $(RAND_OBJ) $(APPS_OBJ)
EXE_SRC = openssl.c $(SRC) $(EXTRA_SRC) $(RAND_SRC)
HEADER= apps.h progs.h s_apps.h \
......
......@@ -10,7 +10,7 @@ SOURCE[openssl]=\
srp.c ts.c verify.c version.c x509.c rehash.c \
apps.c opt.c s_cb.c s_socket.c \
app_rand.c \
{- $target{apps_extra_src} -}
{- $target{apps_aux_src} -}
INCLUDE[openssl]={- rel2abs(catdir($builddir,"../include")) -} .. ../include
DEPEND[openssl]=../libssl
......
......@@ -21,12 +21,6 @@ crypto/buildinf.h : Makefile
##### APPLINK, UPLINK and CPUID assembler implementations
{- $builddir -}/applink.o: $(SRCDIR)/ms/applink.c
$(CC) $(CFLAGS) -c -o $@ $(SRCDIR)/ms/applink.c
{- $builddir -}/uplink.o: $(SRCDIR)/ms/uplink.c {- $builddir -}/applink.o
$(CC) $(CFLAGS) -c -o $@ $(SRCDIR)/ms/uplink.c
{- $builddir -}/uplink-x86.s: $(SRCDIR)/ms/uplink-x86.pl
CC="$(CC)" $(PERL) $(SRCDIR)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册