Commit 3a55c92b authored by Richard Levitte's avatar Richard Levitte
Browse files

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: default avatarAndy Polyakov <appro@openssl.org>
parent 5be5e56c
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -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",
+4 −3
Original line number Diff line number Diff line
@@ -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",
+2 −6
Original line number Diff line number Diff line
@@ -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;
}

+2 −0
Original line number Diff line number Diff line
@@ -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)'	\
+0 −4
Original line number Diff line number Diff line
@@ -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:
Loading