Adding a separated build settings for BSD flavors
authorDavid Carlier <devnexen@gmail.com>
Sat, 19 Dec 2020 11:07:09 +0000 (11:07 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 20 Jan 2023 11:04:50 +0000 (11:04 +0000)
to avoid inheriting Linux's linker flags (ie -Wl,-z,defs)
now targetting OpenBSD.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13393)

Configurations/10-main.conf
Configurations/shared-info.pl
util/perl/OpenSSL/config.pm

index 32ef7780fb09c2f322224db85f518fabf5898260..c42902cf39f08af1523f4f60be81f110a5ecae38 100644 (file)
@@ -1168,6 +1168,81 @@ my %targets = (
         shared_target    => "bsd-gcc-shared",
         shared_cflag     => "-fPIC",
     },
+#### *BSD-nodef
+    "BSD-nodef-generic32" => {
+        # As for thread cflag. Idea is to maintain "collective" set of
+        # flags, which would cover all BSD flavors. -pthread applies
+        # to them all, but is treated differently. OpenBSD expands is
+        # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
+        # expands it as -lc_r, which has to be accompanied by explicit
+        # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
+        # expands it as -lc_r, which seems to be sufficient?
+        inherit_from     => [ "BASE_unix" ],
+        CC               => "cc",
+        CFLAGS           => picker(default => "-Wall",
+                                   debug   => "-O0 -g",
+                                   release => "-O3"),
+        cflags           => threads("-pthread"),
+        cppflags         => threads("-D_THREAD_SAFE -D_REENTRANT"),
+        ex_libs          => add(threads("-pthread")),
+        enable           => add("devcryptoeng"),
+        bn_ops           => "BN_LLONG",
+        thread_scheme    => "pthreads",
+        dso_scheme       => "dlfcn",
+        shared_target    => "bsd-gcc-nodef-shared",
+        shared_cflag     => "-fPIC",
+    },
+    "BSD-nodef-generic64" => {
+        inherit_from     => [ "BSD-nodef-generic32" ],
+        bn_ops           => "SIXTY_FOUR_BIT_LONG",
+    },
+
+    "BSD-nodef-x86" => {
+        inherit_from     => [ "BSD-nodef-generic32" ],
+        CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
+        lib_cppflags     => add("-DL_ENDIAN"),
+        bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => "a.out",
+    },
+    "BSD-nodef-x86-elf" => {
+        inherit_from     => [ "BSD-nodef-x86" ],
+        perlasm_scheme   => "elf",
+    },
+
+    "BSD-nodef-sparcv8" => {
+        inherit_from     => [ "BSD-nodef-generic32" ],
+        cflags           => add("-mcpu=v8"),
+        lib_cppflags     => add("-DB_ENDIAN"),
+        asm_arch         => 'sparcv8',
+        perlasm_scheme   => 'void',
+    },
+    "BSD-nodef-sparc64" => {
+        # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
+        # simply *happens* to work around a compiler bug in gcc 3.3.3,
+        # triggered by RIPEMD160 code.
+        inherit_from     => [ "BSD-nodef-generic64" ],
+        lib_cppflags     => add("-DB_ENDIAN -DMD32_REG_T=int"),
+        bn_ops           => "BN_LLONG",
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
+    },
+
+    "BSD-nodef-ia64" => {
+        inherit_from     => [ "BSD-nodef-generic64" ],
+        lib_cppflags     => add("-DL_ENDIAN"),
+        bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
+    },
+
+    "BSD-nodef-x86_64" => {
+        inherit_from     => [ "BSD-nodef-generic64" ],
+        lib_cppflags     => add("-DL_ENDIAN"),
+        bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
+        perlasm_scheme   => "elf",
+    },
 
 #### SCO/Caldera targets.
 #
index edd16f405594a7e0d25d479e7e04272679bf8061..0bded76d89bdf85ea49acd8e36a118af02302676 100644 (file)
@@ -40,6 +40,12 @@ my %shared_info;
         };
     },
     'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
+    'bsd-gcc-nodef-shared' => sub { 
+        return {
+            %{$shared_info{'gnu-shared'}},
+            shared_defflags     => '-Wl,--version-script=',
+        };
+    },
     'darwin-shared' => {
         module_ldflags        => '-bundle',
         shared_ldflag         => '-dynamiclib -current_version $(SHLIB_VERSION_NUMBER) -compatibility_version $(SHLIB_VERSION_NUMBER)',
index 159bac199aab71b01e78ce6d4574c4c40a66bbc9..02b930a0a7e6b7921b7d3bfbeb926e9bb832b4a5 100755 (executable)
@@ -780,8 +780,10 @@ EOF
       [ 'powerpc64le-.*-.*bsd.*', { target => "BSD-ppc64le" } ],
       [ 'riscv64-.*-.*bsd.*',     { target => "BSD-riscv64" } ],
       [ 'sparc64-.*-.*bsd.*',     { target => "BSD-sparc64" } ],
+      [ 'ia64-.*-openbsd.*',      { target => "BSD-nodef-ia64" } ],
       [ 'ia64-.*-.*bsd.*',        { target => "BSD-ia64" } ],
       [ 'x86_64-.*-dragonfly.*',  { target => "BSD-x86_64" } ],
+      [ 'amd64-.*-openbsd.*',     { target => "BSD-nodef-x86_64" } ],
       [ 'amd64-.*-.*bsd.*',       { target => "BSD-x86_64" } ],
       [ 'arm64-.*-.*bsd.*',       { target => "BSD-aarch64" } ],
       [ 'armv6-.*-.*bsd.*',       { target => "BSD-armv4" } ],
@@ -803,6 +805,7 @@ EOF
                      disable => [ 'sse2' ] };
         }
       ],
+      [ '.*-.*-openbsd.*',        { target => "BSD-nodef-generic32" } ],
       [ '.*-.*-.*bsd.*',          { target => "BSD-generic32" } ],
       [ 'x86_64-.*-haiku',        { target => "haiku-x86_64" } ],
       [ '.*-.*-haiku',            { target => "haiku-x86" } ],