[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Mon Mar 7 17:26:09 UTC 2016


The branch master has been updated
       via  6bd7a4d96c47068c63cbd2ca93f501816dc453c1 (commit)
       via  8a67946e5bf1cd0fe0020e0f28cbf84642ec4132 (commit)
       via  66ddf178b4eaac6d65f8ba56821f69b598556cec (commit)
       via  ae4c7450754ea13265edd69e6ff74d87c89401cd (commit)
      from  667867cced0013c1cfd8d7a9efa43b8f2cebc942 (commit)


- Log -----------------------------------------------------------------
commit 6bd7a4d96c47068c63cbd2ca93f501816dc453c1
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Mar 7 15:41:33 2016 +0100

    Unified - adapt the generation of bignum assembler to use GENERATE
    
    This gets rid of the BEGINRAW..ENDRAW sections in crypto/bn/build.info.
    
    This also moves the assembler generating perl scripts to take the
    output file name as last command line argument, where necessary.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 8a67946e5bf1cd0fe0020e0f28cbf84642ec4132
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Mar 7 14:50:37 2016 +0100

    Unified - Add the build.info command OVERRIDE, to avoid build file clashes
    
    Should it be needed because the recipes within a RAW section might
    clash with those generated by Configure, it's possible to tell it
    not to generate them with the use of OVERRIDES, for example:
    
        SOURCE[libfoo]=foo.c bar.c
    
        OVERRIDES=bar.o
        BEGINRAW[Makefile(unix)]
        bar.o: bar.c
            $(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
        ENDRAW[Makefile(unix)]
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 66ddf178b4eaac6d65f8ba56821f69b598556cec
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Mar 7 14:38:54 2016 +0100

    Unified - Adapt the Unix and VMS templates to support GENERATE
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit ae4c7450754ea13265edd69e6ff74d87c89401cd
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Mar 7 14:37:00 2016 +0100

    Unified - Add the build.info command GENERATE, to generate source files
    
    In some cases, one might want to generate some source files from
    others, that's done as follows:
    
        GENERATE[foo.s]=asm/something.pl $(CFLAGS)
        GENERATE[bar.s]=asm/bar.S
    
    The value of each GENERATE line is a command line or part of it.
    Configure places no rules on the command line, except the the first
    item muct be the generator file.  It is, however, entirely up to the
    build file template to define exactly how those command lines should
    be handled, how the output is captured and so on.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configurations/README             |  50 +++++++++++++++-
 Configurations/README.design      |  16 ++---
 Configurations/common.tmpl        |  25 +++++++-
 Configurations/descrip.mms.tmpl   |  15 +++++
 Configurations/unix-Makefile.tmpl |  37 ++++++++++++
 Configure                         |  29 ++++++++-
 crypto/bn/Makefile.in             |  34 +++++------
 crypto/bn/asm/alpha-mont.pl       |   3 +
 crypto/bn/asm/bn-586.pl           |   6 +-
 crypto/bn/asm/co-586.pl           |   5 ++
 crypto/bn/asm/ia64-mont.pl        |   4 +-
 crypto/bn/asm/sparct4-mont.pl     |   3 +
 crypto/bn/asm/sparcv9-gf2m.pl     |   3 +
 crypto/bn/asm/sparcv9-mont.pl     |   3 +
 crypto/bn/asm/sparcv9a-mont.pl    |   3 +
 crypto/bn/asm/via-mont.pl         |   5 ++
 crypto/bn/asm/vis3-mont.pl        |   3 +
 crypto/bn/asm/x86-gf2m.pl         |   5 ++
 crypto/bn/asm/x86-mont.pl         |   5 ++
 crypto/bn/asm/x86.pl              |   4 ++
 crypto/bn/build.info              | 120 +++++++++++++++-----------------------
 21 files changed, 272 insertions(+), 106 deletions(-)

diff --git a/Configurations/README b/Configurations/README
index afc6004..5665d24 100644
--- a/Configurations/README
+++ b/Configurations/README
@@ -363,8 +363,22 @@ include paths the build of their source files should use:
 
     INCLUDE[foo]=include
 
-It's possible to have raw build file lines, between BEGINRAW and
-ENDRAW lines as follows:
+In some cases, one might want to generate some source files from
+others, that's done as follows:
+
+    GENERATE[foo.s]=asm/something.pl $(CFLAGS)
+    GENERATE[bar.s]=asm/bar.S
+
+The value of each GENERATE line is a command line or part of it.
+Configure places no rules on the command line, except the the first
+item muct be the generator file.  It is, however, entirely up to the
+build file template to define exactly how those command lines should
+be handled, how the output is captured and so on.
+
+NOTE: GENERATE lines are limited to one command only per GENERATE.
+
+As a last resort, it's possible to have raw build file lines, between
+BEGINRAW and ENDRAW lines as follows:
 
     BEGINRAW[Makefile(unix)]
     haha.h: {- $builddir -}/Makefile
@@ -390,6 +404,18 @@ configuration items:
    build hoho.h: echo "/* hoho */" > hoho.h
    ENDRAW[build.ninja(unix)]
 
+Should it be needed because the recipes within a RAW section might
+clash with those generated by Configure, it's possible to tell it
+not to generate them with the use of OVERRIDES, for example:
+
+    SOURCE[libfoo]=foo.c bar.c
+    
+    OVERRIDES=bar.o
+    BEGINRAW[Makefile(unix)]
+    bar.o: bar.c
+    	$(CC) $(CFLAGS) -DSPECIAL -c -o $@ $<
+    ENDRAW[Makefile(unix)]
+
 See the documentation further up for more information on configuration
 items.
 
@@ -461,6 +487,26 @@ The build-file template is expected to define at least the following
 perl functions in a perl code fragment enclosed with "{-" and "-}".
 They are all expected to return a string with the lines they produce.
 
+    generatesrc - function that produces build file lines to generate
+                  a source file from some input.
+
+                  It's called like this:
+
+                        generatesrc(src => "PATH/TO/tobegenerated",
+                                    generator => [ "generatingfile", ... ]
+                                    deps => [ "dep1", ... ],
+                                    intent => one of "libs", "dso", "bin" );
+
+                  'src' has the name of the file to be generated.
+                  'generator' is the command or part of command to
+                  generate the file, of which the first item is
+                  expected to be the file to generate from.
+                  generatesrc() is expected to analyse and figure out
+                  exactly how to apply that file and how to capture
+                  the result.  'deps' is a list of explicit
+                  dependencies.  'intent' indicates what the generated
+                  file is going to be used for.
+
     src2obj     - function that produces build file lines to build an
                   object file from source files and associated data.
 
diff --git a/Configurations/README.design b/Configurations/README.design
index 5a28ef3..5065960 100644
--- a/Configurations/README.design
+++ b/Configurations/README.design
@@ -89,11 +89,8 @@ depends on the library 'libssl' to function properly.
     SOURCE[../libcrypto]=aes.c evp.c cversion.c
     DEPEND[cversion.o]=buildinf.h
     
-    BEGINRAW[Makefile(unix)]
-    crypto/buildinf.h : Makefile
-    	perl util/mkbuildinf.h "$(CC) $(CFLAGS)" "$(PLATFORM)" \
-    	    > crypto/buildinf.h
-    ENDRAW[Makefile(unix)]
+    GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
+    DEPEND[buildinf.h]=../Makefile
 
 This is the build.info file in 'crypto', and it tells us a little more
 about what's needed to produce 'libcrypto'.  LIBS is used again to
@@ -161,11 +158,8 @@ information comes down to this:
     DEPEND[engines/libossltest]=libcrypto
     INCLUDE[engines/libossltest]=include
     
-    BEGINRAW[Makefile(unix)]
-    crypto/buildinf.h : Makefile
-    	perl util/mkbuildinf.h "$(CC) $(CFLAGS)" "$(PLATFORM)" \
-    	    > crypto/buildinf.h
-    ENDRAW[Makefile(unix)]
+    GENERATE[crypto/buildinf.h]=util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)"
+    DEPEND[crypto/buildinf.h]=Makefile
 
 
 A few notes worth mentioning:
@@ -180,7 +174,7 @@ The indexes for SOURCE, INCLUDE and ORDINALS must only be end product
 files, such as libraries, programs or engines.  The values of SOURCE
 variables must only be source files (possibly generated)
 
-DEPEND shows a relationship between different end product files, such
+DEPEND shows a relationship between different produced files, such
 as a program depending on a library, or between an object file and
 some extra source file.
 
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index 7e452dd..c2362d0 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -32,6 +32,22 @@
      @newlist;
  }
 
+ sub dogenerate {
+     my $src = shift;
+     return "" if $cache{$src};
+     my %opts = @_;
+     if ($unified_info{generate}->{$src}) {
+         $OUT .= generatesrc(src => $src,
+                             generator => $unified_info{generate}->{$src},
+                             deps => $unified_info{depends}->{$src},
+                             %opts);
+         foreach (@{$unified_info{depends}->{$src}}) {
+             dogenerate($_, %opts);
+         }
+     }
+     $cache{$src} = 1;
+ }
+
  # doobj is responsible for producing all the recipes that build
  # object files as well as dependency files.
  sub doobj {
@@ -43,10 +59,14 @@
      if (@{$unified_info{sources}->{$obj}}) {
          $OUT .= src2obj(obj => $obj_no_o,
                          srcs => $unified_info{sources}->{$obj},
-                         deps => [ reducedepends(resolvedepends($obj)) ],
+                         deps => $unified_info{depends}->{$obj},
                          incs => [ @{$unified_info{includes}->{$bin}},
                                    @{$unified_info{includes}->{$obj}} ],
                          %opts);
+         foreach ((@{$unified_info{sources}->{$obj}},
+                   @{$unified_info{depends}->{$obj}})) {
+             dogenerate($_, %opts);
+         }
      }
      $cache{$obj} = 1;
  }
@@ -114,6 +134,9 @@
      $cache{$script} = 1;
  }
 
+ # Start with populating the cache with all the overrides
+ %cache = map { $_ => 1 } @{$unified_info{overrides}};
+
  # Build all known libraries, engines, programs and scripts.
  # Everything else will be handled as a consequence.
  map { dolib($_) } @{$unified_info{libraries}};
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index ef59d42..157ebb5 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -407,6 +407,21 @@ configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), s
 {-
   use File::Basename;
   use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
+
+  sub generatesrc {
+      my %args = @_;
+      my $generator = join(" ", @{$args{generator}});
+
+      if ($args{src} !~ /\.[sS]$/) {
+          return <<"EOF";
+$args{src} : $args{generator}->[0]
+	\$(PERL) $generator > \$@
+EOF
+      } else {
+          die "No method to generate assembler source present.\n";
+      }
+  }
+
   sub src2obj {
       my %args = @_;
       my $obj = $args{obj};
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 50dafd2..226f5bd 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -816,6 +816,43 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/commo
       return map { shlib_simple($_) } @_;
   }
 
+  sub generatesrc {
+      my %args = @_;
+      my $generator = join(" ", @{$args{generator}});
+
+      if ($args{src} !~ /\.[sS]$/) {
+          return <<"EOF";
+$args{src}: $args{generator}->[0]
+	\$(PERL) $generator > \$@
+EOF
+      } else {
+          if ($args{generator}->[0] =~ /\.[sS]$/) {
+              return <<"EOF";
+$args{src}: $args{generator}->[0]
+	\$(CC) \$(CFLAGS) -E \$< > \$@
+EOF
+          } elsif ($args{generator}->[0] =~ /\.pl$/) {
+             return <<"EOF";
+$args{src}: $args{generator}->[0]
+	( trap "rm -f \$@.S" INT; \\
+	  CC="\$(CC)" \$(PERL) $generator \$@.S; \\
+	  if grep '^#' \$@.S >/dev/null; then \\
+	      \$(CC) -E -P \$@.S > \$@ && rm -f \$@.S; \\
+	  else \\
+	      mv \$@.S \$@; \\
+	  fi )
+EOF
+          } elsif ($args{generator}->[0] =~ /\.m4$/) {
+              return <<"EOF";
+$args{src}: $args{generator}->[0]
+	m4 -B 8192 $generator > \$@
+EOF
+          } else {
+              die "Generator type for $args{src} unknown: $args{generator}\n";
+          }
+      }
+  }
+
   sub src2obj {
       my %args = @_;
       my $obj = $args{obj};
diff --git a/Configure b/Configure
index 174fe15..34926ab 100755
--- a/Configure
+++ b/Configure
@@ -1274,6 +1274,7 @@ if ($builder eq "unified") {
         my @engines = ();
         my @scripts = ();
         my @extra = ();
+        my @overrides = ();
         my @intermediates = ();
         my @rawlines = ();
 
@@ -1283,6 +1284,7 @@ if ($builder eq "unified") {
         my %depends = ();
         my %renames = ();
         my %sharednames = ();
+        my %generate = ();
 
         push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
         my $template = Text::Template->new(TYPE => 'FILE',
@@ -1341,6 +1343,9 @@ if ($builder eq "unified") {
             qr/^\s*EXTRA\s*=\s*(.*)\s*$/
             => sub { push @extra, split(/\s+/, $1)
                          if !@skip || $skip[$#skip] > 0 },
+            qr/^\s*OVERRIDES\s*=\s*(.*)\s*$/
+            => sub { push @overrides, split(/\s+/, $1)
+                         if !@skip || $skip[$#skip] > 0 },
 
             qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
             => sub { push @{$ordinals{$1}}, split(/\s+/, $2)
@@ -1354,6 +1359,9 @@ if ($builder eq "unified") {
             qr/^\s*DEPEND\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
             => sub { push @{$depends{$1}}, split(/\s+/, $2)
                          if !@skip || $skip[$#skip] > 0 },
+            qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
+            => sub { push @{$generate{$1}}, $2
+                         if !@skip || $skip[$#skip] > 0 },
             qr/^\s*RENAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
             => sub { push @{$renames{$1}}, split(/\s+/, $2)
                          if !@skip || $skip[$#skip] > 0 },
@@ -1436,6 +1444,11 @@ EOF
             $unified_info{extra}->{$extra} = 1;
         }
 
+        foreach (@overrides) {
+            my $override = cleanfile($buildd, $_, $blddir);
+            $unified_info{overrides}->{$override} = 1;
+        }
+
         push @{$unified_info{rawlines}}, @rawlines;
 
         unless ($disabled{shared}) {
@@ -1514,6 +1527,20 @@ EOF
             }
         }
 
+        foreach (keys %generate) {
+            my $dest = $_;
+            my $ddest = cleanfile($buildd, $_, $blddir);
+            if ($unified_info{rename}->{$ddest}) {
+                $ddest = $unified_info{rename}->{$ddest};
+            }
+            die "more than one generator for $dest: "
+                    ,join(" ", @{$generate{$_}}),"\n"
+                    if scalar @{$generate{$_}} > 1;
+            my @generator = split /\s+/, $generate{$dest}->[0];
+            $generator[0] = cleanfile($sourced, $generator[0], $blddir),
+            $unified_info{generate}->{$ddest} = [ @generator ];
+        }
+
         foreach (keys %depends) {
             my $dest = $_;
             my $ddest = cleanfile($buildd, $_, $blddir);
@@ -1565,7 +1592,7 @@ EOF
 
     ### Make unified_info a bit more efficient
     # One level structures
-    foreach (("programs", "libraries", "engines", "scripts", "extra")) {
+    foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {
         $unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
     }
     # Two level structures
diff --git a/crypto/bn/Makefile.in b/crypto/bn/Makefile.in
index b14301a..594667f 100644
--- a/crypto/bn/Makefile.in
+++ b/crypto/bn/Makefile.in
@@ -58,28 +58,28 @@ lib:	$(LIBOBJ)
 	@touch lib
 
 bn-586.s:	asm/bn-586.pl ../perlasm/x86asm.pl
-	$(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+	$(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 co-586.s:	asm/co-586.pl ../perlasm/x86asm.pl
-	$(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+	$(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 x86-mont.s:	asm/x86-mont.pl ../perlasm/x86asm.pl
-	$(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+	$(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 x86-gf2m.s:	asm/x86-gf2m.pl ../perlasm/x86asm.pl
-	$(PERL) asm/x86-gf2m.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+	$(PERL) asm/x86-gf2m.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 
 sparcv8.o:	asm/sparcv8.S
 	$(CC) $(CFLAGS) -c asm/sparcv8.S
 bn-sparcv9.o:	asm/sparcv8plus.S
 	$(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S
 sparcv9a-mont.s:	asm/sparcv9a-mont.pl
-	$(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@
+	$(PERL) asm/sparcv9a-mont.pl $(CFLAGS) $@
 sparcv9-mont.s:		asm/sparcv9-mont.pl
-	$(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@
+	$(PERL) asm/sparcv9-mont.pl $(CFLAGS) $@
 vis3-mont.s:		asm/vis3-mont.pl
-	$(PERL) asm/vis3-mont.pl $(CFLAGS) > $@
+	$(PERL) asm/vis3-mont.pl $(CFLAGS) $@
 sparct4-mont.S:	asm/sparct4-mont.pl
-	$(PERL) asm/sparct4-mont.pl $(CFLAGS) > $@
+	$(PERL) asm/sparct4-mont.pl $(CFLAGS) $@
 sparcv9-gf2m.S:	asm/sparcv9-gf2m.pl
-	$(PERL) asm/sparcv9-gf2m.pl $(CFLAGS) > $@
+	$(PERL) asm/sparcv9-gf2m.pl $(CFLAGS) $@
 
 bn-mips.s:	asm/mips.pl
 	$(PERL) asm/mips.pl $(PERLASM_SCHEME) $@
@@ -94,20 +94,20 @@ s390x-gf2m.s:	asm/s390x-gf2m.pl
 x86_64-gcc.o:	asm/x86_64-gcc.c
 	$(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c
 x86_64-mont.s:	asm/x86_64-mont.pl
-	$(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) $@
 x86_64-mont5.s:	asm/x86_64-mont5.pl
-	$(PERL) asm/x86_64-mont5.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/x86_64-mont5.pl $(PERLASM_SCHEME) $@
 x86_64-gf2m.s:	asm/x86_64-gf2m.pl
-	$(PERL) asm/x86_64-gf2m.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/x86_64-gf2m.pl $(PERLASM_SCHEME) $@
 rsaz-x86_64.s:	asm/rsaz-x86_64.pl
-	$(PERL) asm/rsaz-x86_64.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/rsaz-x86_64.pl $(PERLASM_SCHEME) $@
 rsaz-avx2.s:	asm/rsaz-avx2.pl 
-	$(PERL) asm/rsaz-avx2.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/rsaz-avx2.pl $(PERLASM_SCHEME) $@
 
 bn-ia64.s:	asm/ia64.S
-	$(CC) $(CFLAGS) -E asm/ia64.S > $@
+	$(CC) $(CFLAGS) -E asm/ia64.S $@
 ia64-mont.s:	asm/ia64-mont.pl
-	$(PERL) asm/ia64-mont.pl $@ $(CFLAGS)
+	$(PERL) asm/ia64-mont.pl $(CFLAGS) $@
 
 parisc-mont.s:	asm/parisc-mont.pl
 	$(PERL) asm/parisc-mont.pl $(PERLASM_SCHEME) $@
@@ -119,7 +119,7 @@ ppc64-mont.s:	asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@
 
 alpha-mont.s:	asm/alpha-mont.pl
 	(preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
-	$(PERL) asm/alpha-mont.pl > $$preproc && \
+	$(PERL) asm/alpha-mont.pl $$preproc && \
 	$(CC) -E -P $$preproc > $@ && rm $$preproc)
 
 # GNU make "catch all"
diff --git a/crypto/bn/asm/alpha-mont.pl b/crypto/bn/asm/alpha-mont.pl
index 03596e2..2ac3532 100644
--- a/crypto/bn/asm/alpha-mont.pl
+++ b/crypto/bn/asm/alpha-mont.pl
@@ -15,6 +15,9 @@
 # I.e. if you compare 1GHz 21264 and 2GHz Opteron, you'll observe ~2x
 # difference.
 
+$output=pop;
+open STDOUT,">$output";
+
 # int bn_mul_mont(
 $rp="a0";	# BN_ULONG *rp,
 $ap="a1";	# const BN_ULONG *ap,
diff --git a/crypto/bn/asm/bn-586.pl b/crypto/bn/asm/bn-586.pl
index 332ef3e..3f34abe 100644
--- a/crypto/bn/asm/bn-586.pl
+++ b/crypto/bn/asm/bn-586.pl
@@ -4,6 +4,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],$0);
 
 $sse2=0;
@@ -21,6 +24,8 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
 
 &asm_finish();
 
+close STDOUT;
+
 sub bn_mul_add_words
 	{
 	local($name)=@_;
@@ -771,4 +776,3 @@ sub bn_sub_part_words
 
 	&function_end($name);
 	}
-
diff --git a/crypto/bn/asm/co-586.pl b/crypto/bn/asm/co-586.pl
index 57101a6..ec3ea34 100644
--- a/crypto/bn/asm/co-586.pl
+++ b/crypto/bn/asm/co-586.pl
@@ -4,6 +4,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],$0);
 
 &bn_mul_comba("bn_mul_comba8",8);
@@ -13,6 +16,8 @@ require "x86asm.pl";
 
 &asm_finish();
 
+close STDOUT;
+
 sub mul_add_c
 	{
 	local($a,$ai,$b,$bi,$c0,$c1,$c2,$pos,$i,$na,$nb)=@_;
diff --git a/crypto/bn/asm/ia64-mont.pl b/crypto/bn/asm/ia64-mont.pl
index e258658..710ca3c 100644
--- a/crypto/bn/asm/ia64-mont.pl
+++ b/crypto/bn/asm/ia64-mont.pl
@@ -60,6 +60,8 @@
 # hereafter less for longer keys, while verify - by 74-13%.
 # DSA performance improves by 115-30%.
 
+$output=pop;
+
 if ($^O eq "hpux") {
     $ADDP="addp4";
     for (@ARGV) { $ADDP="add" if (/[\+DD|\-mlp]64/); }
@@ -846,6 +848,6 @@ copyright:
 stringz	"Montgomery multiplication for IA-64, CRYPTOGAMS by <appro\@openssl.org>"
 ___
 
-$output=shift and open STDOUT,">$output";
+open STDOUT,">$output" if $output;
 print $code;
 close STDOUT;
diff --git a/crypto/bn/asm/sparct4-mont.pl b/crypto/bn/asm/sparct4-mont.pl
index 71b4500..7ec83c2 100755
--- a/crypto/bn/asm/sparct4-mont.pl
+++ b/crypto/bn/asm/sparct4-mont.pl
@@ -76,6 +76,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "sparcv9_modes.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 $code.=<<___;
 #include "sparc_arch.h"
 
diff --git a/crypto/bn/asm/sparcv9-gf2m.pl b/crypto/bn/asm/sparcv9-gf2m.pl
index ab94cd9..c7bf9f2 100644
--- a/crypto/bn/asm/sparcv9-gf2m.pl
+++ b/crypto/bn/asm/sparcv9-gf2m.pl
@@ -18,6 +18,9 @@
 # ~100-230% faster than gcc-generated code and ~35-90% faster than
 # the pure SPARCv9 code path.
 
+$output = pop;
+open STDOUT,">$output";
+
 $locals=16*8;
 
 $tab="%l0";
diff --git a/crypto/bn/asm/sparcv9-mont.pl b/crypto/bn/asm/sparcv9-mont.pl
index b8fb1e8..c08d822 100644
--- a/crypto/bn/asm/sparcv9-mont.pl
+++ b/crypto/bn/asm/sparcv9-mont.pl
@@ -42,6 +42,9 @@
 # module still have hidden potential [see TODO list there], which is
 # estimated to be larger than 20%...
 
+$output = pop;
+open STDOUT,">$output";
+
 # int bn_mul_mont(
 $rp="%i0";	# BN_ULONG *rp,
 $ap="%i1";	# const BN_ULONG *ap,
diff --git a/crypto/bn/asm/sparcv9a-mont.pl b/crypto/bn/asm/sparcv9a-mont.pl
index 4cde041..433ec9e 100755
--- a/crypto/bn/asm/sparcv9a-mont.pl
+++ b/crypto/bn/asm/sparcv9a-mont.pl
@@ -55,6 +55,9 @@
 # key length, more for longer keys] on USI&II cores and 30-80% - on
 # USIII&IV.
 
+$output = pop;
+open STDOUT,">$output";
+
 $fname="bn_mul_mont_fpu";
 $bits=32;
 for (@ARGV) { $bits=64 if (/\-m64/ || /\-xarch\=v9/); }
diff --git a/crypto/bn/asm/via-mont.pl b/crypto/bn/asm/via-mont.pl
index c046a51..8cf4dde 100644
--- a/crypto/bn/asm/via-mont.pl
+++ b/crypto/bn/asm/via-mont.pl
@@ -81,6 +81,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],"via-mont.pl");
 
 # int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
@@ -240,3 +243,5 @@ $sp=&DWP(28,"esp");
 &asciz("Padlock Montgomery Multiplication, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;
diff --git a/crypto/bn/asm/vis3-mont.pl b/crypto/bn/asm/vis3-mont.pl
index 1d8dc9e..8bab5a1 100644
--- a/crypto/bn/asm/vis3-mont.pl
+++ b/crypto/bn/asm/vis3-mont.pl
@@ -18,6 +18,9 @@
 # for reference purposes, because T4 has dedicated Montgomery
 # multiplication and squaring *instructions* that deliver even more.
 
+$output = pop;
+open STDOUT,">$output";
+
 $bits=32;
 for (@ARGV)     { $bits=64 if (/\-m64/ || /\-xarch\=v9/); }
 if ($bits==64)  { $bias=2047; $frame=192; }
diff --git a/crypto/bn/asm/x86-gf2m.pl b/crypto/bn/asm/x86-gf2m.pl
index b579530..0292178 100644
--- a/crypto/bn/asm/x86-gf2m.pl
+++ b/crypto/bn/asm/x86-gf2m.pl
@@ -36,6 +36,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],$0,$x86only = $ARGV[$#ARGV] eq "386");
 
 $sse2=0;
@@ -311,3 +314,5 @@ if ($sse2) {
 &asciz	("GF(2^m) Multiplication for x86, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;
diff --git a/crypto/bn/asm/x86-mont.pl b/crypto/bn/asm/x86-mont.pl
index 89f4de6..972de26 100755
--- a/crypto/bn/asm/x86-mont.pl
+++ b/crypto/bn/asm/x86-mont.pl
@@ -30,6 +30,9 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open STDOUT,">$output";
+ 
 &asm_init($ARGV[0],$0);
 
 $sse2=0;
@@ -606,3 +609,5 @@ $sbit=$num;
 &asciz("Montgomery Multiplication for x86, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;
diff --git a/crypto/bn/asm/x86.pl b/crypto/bn/asm/x86.pl
index 1bc4f1b..c1cab72 100644
--- a/crypto/bn/asm/x86.pl
+++ b/crypto/bn/asm/x86.pl
@@ -11,6 +11,9 @@ require("x86/add.pl");
 require("x86/sub.pl");
 require("x86/comba.pl");
 
+$output = pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],$0);
 
 &bn_mul_add_words("bn_mul_add_words");
@@ -26,3 +29,4 @@ require("x86/comba.pl");
 
 &asm_finish();
 
+close STDOUT;
diff --git a/crypto/bn/build.info b/crypto/bn/build.info
index a6b94c4..e9cde75 100644
--- a/crypto/bn/build.info
+++ b/crypto/bn/build.info
@@ -9,32 +9,56 @@ SOURCE[../../libcrypto]=\
         bn_depr.c bn_const.c bn_x931p.c bn_intern.c bn_dh.c bn_srp.c
 INCLUDE[../../libcrypto]={- rel2abs(catdir($builddir,"..","..","crypto","include")) -}
 
-BEGINRAW[Makefile]
-##### BN assembler implementations
+GENERATE[bn-586.s]=asm/bn-586.pl \
+	$(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[bn-586.s]=../perlasm/x86asm.pl
+GENERATE[co-586.s]=asm/co-586.pl \
+	$(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[co-586.s]=../perlasm/x86asm.pl
+GENERATE[x86-mont.s]=asm/x86-mont.pl \
+	$(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[x86-mont.s]=../perlasm/x86asm.pl
+GENERATE[x86-gf2m.s]=asm/x86-gf2m.pl \
+	$(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[x86-gf2m.s]=../perlasm/x86asm.pl
+
+GENERATE[sparcv9a-mont.s]=asm/sparcv9a-mont.pl $(CFLAGS)
+GENERATE[sparcv9-mont.s]=asm/sparcv9-mont.pl $(CFLAGS)
+GENERATE[vis3-mont.s]=asm/vis3-mont.pl $(CFLAGS)
+GENERATE[sparct4-mont.S]=asm/sparct4-mont.pl $(CFLAGS)
+GENERATE[sparcv9-gf2m.S]=asm/sparcv9-gf2m.pl $(CFLAGS)
+
+GENERATE[bn-mips.s]=asm/mips.pl $(PERLASM_SCHEME)
+GENERATE[mips-mont.s]=asm/mips-mont.pl $(PERLASM_SCHEME)
+
+GENERATE[s390x-mont.S]=asm/s390x-mont.pl $(PERLASM_SCHEME)
+GENERATE[s390x-gf2m.s]=asm/s390x-gf2m.pl $(PERLASM_SCHEME)
+
+GENERATE[x86_64-mont.s]=asm/x86_64-mont.pl $(PERLASM_SCHEME)
+GENERATE[x86_64-mont5.s]=asm/x86_64-mont5.pl $(PERLASM_SCHEME)
+GENERATE[x86_64-gf2m.s]=asm/x86_64-gf2m.pl $(PERLASM_SCHEME)
+GENERATE[rsaz-x86_64.s]=asm/rsaz-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[rsaz-avx2.s]=asm/rsaz-avx2.pl $(PERLASM_SCHEME)
+
+GENERATE[bn-ia64.s]=asm/ia64.S
+GENERATE[ia64-mont.s]=asm/ia64-mont.pl $(CFLAGS)
+
+GENERATE[parisc-mont.s]=asm/parisc-mont.pl $(PERLASM_SCHEME)
+
+# ppc - AIX, Linux, MacOS X...
+GENERATE[bn-ppc.s]=asm/ppc.pl $(PERLASM_SCHEME)
+GENERATE[ppc-mont.s]=asm/ppc-mont.pl $(PERLASM_SCHEME)
+GENERATE[ppc64-mont.s]=asm/ppc64-mont.pl $(PERLASM_SCHEME)
+
+GENERATE[alpha-mont.s]=asm/alpha-mont.pl
 
-{- $builddir -}/bn-586.s:	{- $sourcedir -}/asm/bn-586.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-{- $builddir -}/co-586.s:	{- $sourcedir -}/asm/co-586.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-{- $builddir -}/x86-mont.s:	{- $sourcedir -}/asm/x86-mont.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-{- $builddir -}/x86-gf2m.s:	{- $sourcedir -}/asm/x86-gf2m.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/x86-gf2m.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+GENERATE[armv4-mont.S]=asm/armv4-mont.pl $(PERLASM_SCHEME)
+GENERATE[armv4-gf2m.S]=asm/armv4-gf2m.pl $(PERLASM_SCHEME)
+GENERATE[armv8-mont.S]=asm/armv8-mont.pl $(PERLASM_SCHEME)
 
-{- $builddir -}/sparcv8.o:	{- $sourcedir -}/asm/sparcv8.S
-	$(CC) $(CFLAGS) -c {- $sourcedir -}/asm/sparcv8.S
-{- $builddir -}/bn-sparcv9.o:	{- $sourcedir -}/asm/sparcv8plus.S
-	$(CC) $(CFLAGS) -c -o $@ {- $sourcedir -}/asm/sparcv8plus.S
-{- $builddir -}/sparcv9a-mont.s:	{- $sourcedir -}/asm/sparcv9a-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sparcv9a-mont.pl $(CFLAGS) > $@
-{- $builddir -}/sparcv9-mont.s:		{- $sourcedir -}/asm/sparcv9-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sparcv9-mont.pl $(CFLAGS) > $@
-{- $builddir -}/vis3-mont.s:		{- $sourcedir -}/asm/vis3-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/vis3-mont.pl $(CFLAGS) > $@
-{- $builddir -}/sparct4-mont.S:	{- $sourcedir -}/asm/sparct4-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sparct4-mont.pl $(CFLAGS) > $@
-{- $builddir -}/sparcv9-gf2m.S:	{- $sourcedir -}/asm/sparcv9-gf2m.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/sparcv9-gf2m.pl $(CFLAGS) > $@
+OVERRIDES=bn-mips3.o pa-risc2W.o pa-risc2.c
+BEGINRAW[Makefile]
+##### BN assembler implementations
 
 {- $builddir -}/bn-mips3.o:	{- $sourcedir -}/asm/mips3.s
 	@if [ "$(CC)" = "gcc" ]; then \
@@ -42,32 +66,6 @@ BEGINRAW[Makefile]
 		as -$$ABI -O -o $@ {- $sourcedir -}/asm/mips3.s; \
 	else	$(CC) -c $(CFLAGS) -o $@ {- $sourcedir -}/asm/mips3.s; fi
 
-{- $builddir -}/bn-mips.s:	{- $sourcedir -}/asm/mips.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/mips.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/mips-mont.s:	{- $sourcedir -}/asm/mips-mont.pl
-	CC="$(CC)" $(PERL)	{- $sourcedir -}/asm/mips-mont.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/bn-s390x.o:	{- $sourcedir -}/asm/s390x.S
-	$(CC) $(CFLAGS) -c -o $@ {- $sourcedir -}/asm/s390x.S
-{- $builddir -}/s390x-gf2m.s:	{- $sourcedir -}/asm/s390x-gf2m.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/s390x-gf2m.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/x86_64-mont.s:	{- $sourcedir -}/asm/x86_64-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/x86_64-mont5.s:	{- $sourcedir -}/asm/x86_64-mont5.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/x86_64-mont5.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/x86_64-gf2m.s:	{- $sourcedir -}/asm/x86_64-gf2m.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/x86_64-gf2m.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/rsaz-x86_64.s:	{- $sourcedir -}/asm/rsaz-x86_64.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rsaz-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/rsaz-avx2.s:	{- $sourcedir -}/asm/rsaz-avx2.pl 
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rsaz-avx2.pl $(PERLASM_SCHEME) > $@
-
-{- $builddir -}/bn-ia64.s:	{- $sourcedir -}/asm/ia64.S
-	$(CC) $(CFLAGS) -E {- $sourcedir -}/asm/ia64.S > $@
-{- $builddir -}/ia64-mont.s:	{- $sourcedir -}/asm/ia64-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ia64-mont.pl $@ $(CFLAGS)
-
 # GNU assembler fails to compile PA-RISC2 modules, insist on calling
 # vendor assembler...
 {- $builddir -}/pa-risc2W.o: {- $sourcedir -}/asm/pa-risc2W.s
@@ -75,26 +73,4 @@ BEGINRAW[Makefile]
 {- $builddir -}/pa-risc2.o: {- $sourcedir -}/asm/pa-risc2.s
 	CC="$(CC)" $(PERL) $(SRCDIR)/util/fipsas.pl $(SRCDIR) $< /usr/ccs/bin/as -o pa-risc2.o {- $sourcedir -}/asm/pa-risc2.s
 
-{- $builddir -}/parisc-mont.s:	{- $sourcedir -}/asm/parisc-mont.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/parisc-mont.pl $(PERLASM_SCHEME) $@
-
-# ppc - AIX, Linux, MacOS X...
-{- $builddir -}/bn-ppc.s:	{- $sourcedir -}/asm/ppc.pl;	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ppc.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/ppc-mont.s:	{- $sourcedir -}/asm/ppc-mont.pl;CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ppc-mont.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/ppc64-mont.s:	{- $sourcedir -}/asm/ppc64-mont.pl;CC="$(CC)" $(PERL) {- $sourcedir -}/asm/ppc64-mont.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/alpha-mont.s:	{- $sourcedir -}/asm/alpha-mont.pl
-	(preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/alpha-mont.pl > $$preproc && \
-	$(CC) -E -P $$preproc > $@ && rm $$preproc)
-
-# GNU make "catch all"
-{- $builddir -}/%-mont.S:	{- $sourcedir -}/asm/%-mont.pl
-	CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@
-{- $builddir -}/%-gf2m.S:	{- $sourcedir -}/asm/%-gf2m.pl
-	CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@
-
-{- $builddir -}/armv4-mont.o:	{- $builddir -}/armv4-mont.S
-{- $builddir -}/armv4-gf2m.o:	{- $builddir -}/armv4-gf2m.S
-{- $builddir -}/armv8-mont.o:	{- $builddir -}/armv8-mont.S
 ENDRAW[Makefile]


More information about the openssl-commits mailing list