[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Fri Oct 5 06:23:01 UTC 2018


The branch master has been updated
       via  36d3acb91d5d2f0308ab93be9ce5609f784f95a2 (commit)
       via  05a72c28b20c665206a6c6793cbcc10b8d74a526 (commit)
       via  66a24ab86816c240279d238aca41c68d57ead35c (commit)
       via  ed57d89bd18f6f4b3db52567f9a718c31d717aa8 (commit)
       via  97624638b02f056ac49517db93bb349b614cc810 (commit)
      from  52d78cc5ebc1d4fc021cabbcb09f4efb4c6ae82d (commit)


- Log -----------------------------------------------------------------
commit 36d3acb91d5d2f0308ab93be9ce5609f784f95a2
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Oct 5 00:10:35 2018 +0200

    util/mkdef.pl: for VMS, allow generation of case insensitive symbol vector
    
    Some modules are built with case insensitive (uppercase) symbols on
    VMS.  This needs to be reflected in the export symbol vector.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7347)

commit 05a72c28b20c665206a6c6793cbcc10b8d74a526
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Oct 4 17:41:51 2018 +0200

    Configure: use correct variable to infer the .ld file location
    
    We didn't notice the error because it all happened in the top directory.
    Now that we use .ld files in subdirectories, the bug became apparent.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7347)

commit 66a24ab86816c240279d238aca41c68d57ead35c
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Oct 4 17:41:12 2018 +0200

    Add build file support for generic symbol exports with DSOs
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7347)

commit ed57d89bd18f6f4b3db52567f9a718c31d717aa8
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Oct 4 17:40:33 2018 +0200

    Change the build of engines to use ordinal files for symbol export
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7347)

commit 97624638b02f056ac49517db93bb349b614cc810
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Oct 4 17:14:13 2018 +0200

    util/mkdef.pl: Produce version scripts from unversioned symbols
    
    This allows setting up export maps for DSOs as well in a uniform way.
    This also means that util/mkdef.pl no longer picks up the target
    version from configdata.pm, and it has to be given on the command line
    instead.  This may be used to give modules separate versions as well,
    if desirable.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7347)

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

Summary of changes:
 Configurations/common.tmpl           |   9 ++-
 Configurations/descrip.mms.tmpl      |  31 +++++---
 Configurations/unix-Makefile.tmpl    |  17 +++--
 Configurations/windows-makefile.tmpl |  25 ++++---
 Configure                            |   2 +-
 engines/build.info                   |  20 ++++++
 util/engines.num                     |   2 +
 util/mkdef.pl                        | 134 ++++++++++++++++++++++-------------
 8 files changed, 164 insertions(+), 76 deletions(-)
 create mode 100644 util/engines.num

diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index dffa513..c1c96a2 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -78,6 +78,7 @@
              if ref $unified_info{generate}->{$src} eq "";
          my $script = $unified_info{generate}->{$src}->[0];
          $OUT .= generatesrc(src => $src,
+                             product => $bin,
                              generator => $unified_info{generate}->{$src},
                              generator_incs => $unified_info{includes}->{$script},
                              generator_deps => $unified_info{depends}->{$script},
@@ -159,7 +160,13 @@
                      deps => [ resolvedepends($lib) ],
                      installed => is_installed($lib));
      foreach (@{$unified_info{shared_sources}->{$lib}}) {
-         doobj($_, $lib, intent => "dso", installed => is_installed($lib));
+         # If this is somehow a compiled object, take care of it that way
+         # Otherwise, it might simply be generated
+         if (defined $unified_info{sources}->{$_}) {
+             doobj($_, $lib, intent => "dso", installed => is_installed($lib));
+         } else {
+             dogenerate($_, undef, $lib, intent => "dso");
+         }
      }
      $cache{$lib} = 1;
  }
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index c5dee22..44b22ed 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -758,9 +758,15 @@ reconfigure reconf :
       if ($args{src} =~ /\.ld$/) {
           (my $target = $args{src}) =~ s/\.ld$/.OPT/;
           my $mkdef = sourcefile('util', 'mkdef.pl');
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_name =
+              $args{generator}->[1] || basename($args{product}, '.EXE');
+          my $case_insensitive =
+              $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
+              ? '' : ' --case-insensitive';
           return <<"EOF";
-$target : $args{generator}->[0] $deps
-	\$(PERL) $mkdef --ordinals $args{generator}->[0] --name $args{generator}->[1] "--OS" "VMS" > $target
+$target : $args{generator}->[0] $deps $mkdef
+	\$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
 EOF
       } elsif ($target !~ /\.[sS]$/) {
           my $target = $args{src};
@@ -925,7 +931,7 @@ EOF
                  grep { $_ =~ m|\.o$| }
                  @{$args{objs}};
       my @defs = map { (my $x = $_) =~ s|\.ld$|.OPT|; $x }
-                 grep { $_ =~ /\.ld$/ }
+                 grep { $_ =~ m|\.ld$| }
                  @{$args{objs}};
       my @deps = compute_lib_depends(@{$args{deps}});
       die "More than one symbol vector" if scalar @defs > 1;
@@ -971,13 +977,16 @@ EOF
       my $libd = dirname($lib);
       my $libn = basename($lib);
       (my $libn_nolib = $libn) =~ s/^lib//;
-      my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
+      my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
+                 grep { $_ =~ m|\.o$| }
+                 @{$args{objs}};
+      my @defs = map { (my $x = $_) =~ s|\.ld$|.OPT|; $x }
+                 grep { $_ =~ m|\.ld$| }
+                 @{$args{objs}};
       my @deps = compute_lib_depends(@{$args{deps}});
-      my $deps = join(", -\n\t\t", @objs, @deps);
+      my $deps = join(", -\n\t\t", @objs, @defs, @deps);
+      die "More than one symbol vector" if scalar @defs > 1;
       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
-      my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
-                                               "VMS", "engine.opt")),
-                               rel2abs($config{builddir}));
       # The "[]" hack is because in .OPT files, each line inherits the
       # previous line's file spec as default, so if no directory spec
       # is present in the current line and the previous line has one that
@@ -994,12 +1003,12 @@ EOF
           || "\@ !";
       return <<"EOF"
 $lib.EXE : $deps
-        OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
-        TYPE $engine_opt /OUTPUT=OPT_FILE:
+        OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
         $write_opt1
         $write_opt2
         CLOSE OPT_FILE
-        LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(DSO_EX_LIBS)
+        LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
+		$lib-components.OPT/OPT \$(DSO_EX_LIBS)
         - PURGE $lib.EXE,$lib.OPT,$lib.MAP
 EOF
         . ($config{target} =~ m|alpha| ? "" : <<"EOF"
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 662fb05..3f76c59 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -1001,9 +1001,12 @@ reconfigure reconf:
       if ($args{src} =~ /\.ld$/) {
           (my $target = $args{src}) =~ s/\.ld$/${defext}/;
           (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_name =
+              $args{generator}->[1] || basename($args{product}, $dsoext);
           return <<"EOF";
-$target: $args{generator}->[0] $deps
-	\$(PERL) \$(SRCDIR)/util/mkdef.pl --ordinals $args{generator}->[0] --name $args{generator}->[1] --OS $mkdef_os > $target
+$target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
+	\$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0]  --name $ord_name --OS $mkdef_os > $target
 EOF
       } elsif ($args{src} !~ /\.[sS]$/) {
           if ($args{generator}->[0] =~ m|^.*\.in$|) {
@@ -1222,14 +1225,18 @@ EOF
       my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" }
                  grep { $_ !~ m/\.ld$/ }
                  @{$args{objs}};
+      my @defs = map { (my $x = $_) =~ s|\.ld$||; "$x$defext" }
+                 grep { $_ =~ /\.ld$/ }
+                 @{$args{objs}};
       my @deps = compute_lib_depends(@{$args{deps}});
       my $objs = join(" ", @objs);
-      my $deps = join(" ", @deps);
+      my $deps = join(" ", @objs, @defs, @deps);
       my $target = dso($dso);
+      my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
       return <<"EOF";
-$target: $objs $deps
+$target: $deps
 	\$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
-		-o $target $objs \\
+		-o $target$shared_def $objs \\
                 $linklibs \$(DSO_EX_LIBS)
 EOF
   }
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 46f564d..6ab298e 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -512,9 +512,12 @@ reconfigure reconf:
           my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
                                               "util", "mkdef.pl")),
                               rel2abs($config{builddir}));
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_name =
+              $args{generator}->[1] || basename($args{product}, $dsoext);
           return <<"EOF";
-$target: $args{generator}->[0] $deps
-	\$(PERL) $mkdef --ordinals $args{generator}->[0] --name $args{generator}->[1] --OS windows > $target
+$target: $args{generator}->[0] $deps $mkdef
+	\$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS windows > $target
 EOF
       } elsif ($args{src} !~ /\.[sS]$/) {
           my $target = $args{src};
@@ -670,20 +673,22 @@ EOF
      my %args = @_;
      my $dso = $args{lib};
      my $dso_n = basename($dso);
-     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
+                grep { $_ =~ m/\.(?:o|res)$/ }
+                @{$args{objs}};
+     my @defs = map { (my $x = $_) =~ s|\.ld$|$defext|; $x }
+                grep { $_ =~ /\.ld$/ }
+                @{$args{objs}};
      my @deps = compute_lib_depends(@{$args{deps}});
      my $objs = join("\n", @objs);
      my $linklibs = join("", map { "$_\n" } @deps);
-     my $deps = join(" ", @objs, @deps);
+     my $deps = join(" ", @objs, @defs, @deps);
+     my $shared_def = join("", map { " /def:$_" } @defs);
      return <<"EOF";
 $dso$dsoext: $deps
 	IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
-	\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<<
-LIBRARY         $dso_n
-EXPORTS
-    bind_engine		@1
-    v_check		@2
-<<
+	\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \\
+		\$(LDOUTFLAG)$dso$dsoext$shared_def @<< || (DEL /Q \$(\@B).* $dso.* && EXIT 1)
 $objs
 $linklibs \$(DSO_EX_LIBS)
 <<
diff --git a/Configure b/Configure
index de4ca68..2e81640 100755
--- a/Configure
+++ b/Configure
@@ -2079,7 +2079,7 @@ EOF
                 } elsif ($s =~ /\.ld$/) {
                     # We also recognise linker scripts (or corresponding)
                     # We know they are generated files
-                    my $ld = cleanfile($buildd, $s, $blddir);
+                    my $ld = cleanfile($buildd, $_, $blddir);
                     $unified_info{shared_sources}->{$ddest}->{$ld} = 1;
                 } else {
                     die "unrecognised source file type for shared library: $s\n";
diff --git a/engines/build.info b/engines/build.info
index df173ea..5373006 100644
--- a/engines/build.info
+++ b/engines/build.info
@@ -15,26 +15,46 @@ IF[{- !$disabled{"engine"} -}]
     SOURCE[padlock]=e_padlock.c {- $target{padlock_asm_src} -}
     DEPEND[padlock]=../libcrypto
     INCLUDE[padlock]=../include
+    IF[{- defined $target{shared_defflag} -}]
+      SHARED_SOURCE[padlock]=padlock.ld
+      GENERATE[padlock.ld]=../util/engines.num
+    ENDIF
     IF[{- !$disabled{capieng} -}]
       ENGINES=capi
       SOURCE[capi]=e_capi.c
       DEPEND[capi]=../libcrypto
       INCLUDE[capi]=../include
+      IF[{- defined $target{shared_defflag} -}]
+        SHARED_SOURCE[capi]=capi.ld
+        GENERATE[capi.ld]=../util/engines.num
+      ENDIF
     ENDIF
     IF[{- !$disabled{afalgeng} -}]
       ENGINES=afalg
       SOURCE[afalg]=e_afalg.c
       DEPEND[afalg]=../libcrypto
       INCLUDE[afalg]= ../include
+      IF[{- defined $target{shared_defflag} -}]
+        SHARED_SOURCE[afalg]=afalg.ld
+        GENERATE[afalg.ld]=../util/engines.num
+      ENDIF
     ENDIF
 
     ENGINES_NO_INST=ossltest dasync
     SOURCE[dasync]=e_dasync.c
     DEPEND[dasync]=../libcrypto
     INCLUDE[dasync]=../include
+    IF[{- defined $target{shared_defflag} -}]
+      SHARED_SOURCE[dasync]=dasync.ld
+      GENERATE[dasync.ld]=../util/engines.num
+    ENDIF
     SOURCE[ossltest]=e_ossltest.c
     DEPEND[ossltest]=../libcrypto
     INCLUDE[ossltest]=../include
+    IF[{- defined $target{shared_defflag} -}]
+      SHARED_SOURCE[ossltest]=ossltest.ld
+      GENERATE[ossltest.ld]=../util/engines.num
+    ENDIF
   ENDIF
 
   GENERATE[e_padlock-x86.s]=asm/e_padlock-x86.pl \
diff --git a/util/engines.num b/util/engines.num
new file mode 100644
index 0000000..4fc4e00
--- /dev/null
+++ b/util/engines.num
@@ -0,0 +1,2 @@
+bind_engine                            1	*	EXIST::FUNCTION:
+v_check                                2	*	EXIST::FUNCTION:
diff --git a/util/mkdef.pl b/util/mkdef.pl
index 959a13d..635e3e9 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -23,15 +23,22 @@ use configdata;
 
 my $name = undef;               # internal library/module name
 my $ordinals_file = undef;      # the ordinals file to use
+my $version = undef;            # the version to use for the library
 my $OS = undef;                 # the operating system family
 my $verbose = 0;
 my $ctest = 0;
 
+# For VMS, some modules may have case insensitive names
+my $case_insensitive = 0;
+
 GetOptions('name=s'     => \$name,
            'ordinals=s' => \$ordinals_file,
+           'version=s'  => \$version,
            'OS=s'       => \$OS,
            'ctest'      => \$ctest,
-           'verbose'    => \$verbose)
+           'verbose'    => \$verbose,
+           # For VMS
+           'case-insensitive' => \$case_insensitive)
     or die "Error in command line arguments\n";
 
 die "Please supply arguments\n"
@@ -231,20 +238,29 @@ sub sorter_linux {
 
 sub writer_linux {
     my $thisversion = '';
-    my $prevversion = '';
+    my $currversion_s = '';
+    my $prevversion_s = '';
+    my $indent = 0;
 
     for (@_) {
         if ($thisversion && $_->version() ne $thisversion) {
+            die "$ordinals_file: It doesn't make sense to have both versioned ",
+                "and unversioned symbols"
+                if $thisversion eq '*';
             print <<"_____";
-}$prevversion;
+}${prevversion_s};
 _____
-            $prevversion = " OPENSSL${SO_VARIANT}_$thisversion";
+            $prevversion_s = " OPENSSL${SO_VARIANT}_$thisversion";
             $thisversion = '';  # Trigger start of next section
         }
         unless ($thisversion) {
+            $indent = 0;
             $thisversion = $_->version();
+            $currversion_s = '';
+            $currversion_s = "OPENSSL${SO_VARIANT}_$thisversion "
+                if $thisversion ne '*';
             print <<"_____";
-OPENSSL${SO_VARIANT}_$thisversion {
+${currversion_s}{
     global:
 _____
         }
@@ -253,7 +269,7 @@ _____
 
     print <<"_____";
     local: *;
-}$prevversion;
+}${prevversion_s};
 _____
 }
 
@@ -278,36 +294,51 @@ _____
     }
 }
 
+sub collect_VMS_mixedcase {
+    return [ 'SPARE', 'SPARE' ] unless @_;
+
+    my $s = shift;
+    my $s_uc = uc($s);
+    my $type = shift;
+
+    return [ "$s=$type", 'SPARE' ] if $s_uc eq $s;
+    return [ "$s_uc/$s=$type", "$s=$type" ];
+}
+
+sub collect_VMS_uppercase {
+    return [ 'SPARE' ] unless @_;
+
+    my $s = shift;
+    my $s_uc = uc($s);
+    my $type = shift;
+
+    return [ "$s_uc=$type" ];
+}
+
 sub writer_VMS {
     my @slot_collection = ();
-    my $write_vector_slot_pair =
-        sub {
-            my $slot1 = shift;
-            my $slot2 = shift;
-            my $slotpair_text = " $slot1, -\n  $slot2, -\n"
-        };
+    my $collector =
+        $case_insensitive ? \&collect_VMS_uppercase : \&collect_VMS_mixedcase;
 
     my $last_num = 0;
     foreach (@_) {
         while (++$last_num < $_->number()) {
-            push @slot_collection, [ 'SPARE', 'SPARE' ];
+            push @slot_collection, $collector->(); # Just occupy a slot
         }
         my $type = {
             FUNCTION    => 'PROCEDURE',
             VARIABLE    => 'DATA'
            } -> {$_->type()};
-        my $s = $_->name();
-        my $s_uc = uc($s);
-        if ($s_uc eq $s) {
-            push @slot_collection, [ "$s=$type", 'SPARE' ];
-        } else {
-            push @slot_collection, [ "$s_uc/$s=$type", "$s=$type" ];
-        }
+        push @slot_collection, $collector->($_->name(), $type);
     }
 
-    print <<"_____";
-IDENTIFICATION=$config{version}
+    print <<"_____" if defined $version;
+IDENTIFICATION=$version
+_____
+    print <<"_____" unless $case_insensitive;
 CASE_SENSITIVE=YES
+_____
+    print <<"_____";
 SYMBOL_VECTOR=(-
 _____
     # It's uncertain how long aggregated lines the linker can handle,
@@ -317,18 +348,19 @@ _____
     # can have more than one of those...
     my $symvtextcount = 16;     # The length of "SYMBOL_VECTOR=("
     while (@slot_collection) {
-        my $pair = shift @slot_collection;
-        my $pairtextlength =
-            2                   # one space indentation and comma
-            + length($pair->[0])
-            + 1                 # postdent
-            + 3                 # two space indentation and comma
-            + length($pair->[1])
-            + 1                 # postdent
-            ;
+        my $set = shift @slot_collection;
+        my $settextlength = 0;
+        foreach (@$set) {
+            $settextlength +=
+                + 3             # two space indentation and comma
+                + length($_)
+                + 1             # postdent
+                ;
+        }
+        $settextlength--;       # only one space indentation on the first one
         my $firstcomma = ',';
 
-        if ($symvtextcount + $pairtextlength > 1024) {
+        if ($symvtextcount + $settextlength > 1024) {
             print <<"_____";
 )
 SYMBOL_VECTOR=(-
@@ -338,30 +370,36 @@ _____
         if ($symvtextcount == 16) {
             $firstcomma = '';
         }
-        print <<"_____";
- $firstcomma$pair->[0] -
-  ,$pair->[1] -
+
+        my $indent = ' '.$firstcomma;
+        foreach (@$set) {
+            print <<"_____";
+$indent$_ -
 _____
-        $symvtextcount += $pairtextlength;
+            $symvtextcount += length($indent) + length($_) + 1;
+            $indent = '  ,';
+        }
     }
     print <<"_____";
 )
 _____
 
-    my ($libvmajor, $libvminor, $libvedit, $libvpatch) =
-        $config{version} =~ /^(\d+)_(\d+)_(\d+)([a-z]{0,2})-.*$/;
-    my $libvpatchnum = 0;
-    for (split '', $libvpatch // '') {
-        $libvpatchnum += ord(lc($_)) - 96;
-        # To compensate because the letter 'z' is always followed by another,
-        # i.e. doesn't add any value on its own
-        $libvpatchnum-- if lc($_) eq 'z';
-    }
-    my $match1 = $libvmajor * 100 + $libvminor;
-    my $match2 = $libvedit * 100 + $libvpatchnum;
-    print <<"_____";
+    if (defined $version) {
+        my ($libvmajor, $libvminor, $libvedit, $libvpatch) =
+            $version =~ /^(\d+)_(\d+)_(\d+)([a-z]{0,2})(?:-.*)?$/;
+        my $libvpatchnum = 0;
+        for (split '', $libvpatch // '') {
+            $libvpatchnum += ord(lc($_)) - 96;
+            # To compensate because the letter 'z' is always followed by
+            # another, i.e. doesn't add any value on its own
+            $libvpatchnum-- if lc($_) eq 'z';
+        }
+        my $match1 = $libvmajor * 100 + $libvminor;
+        my $match2 = $libvedit * 100 + $libvpatchnum;
+        print <<"_____";
 GSMATCH=LEQUAL,$match1,$match2
 _____
+    }
 }
 
 sub writer_ctest {


More information about the openssl-commits mailing list