Adding a separated build settings for BSD flavors

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)
This commit is contained in:
David Carlier 2020-12-19 11:07:09 +00:00 committed by Hugo Landau
parent c9466f38e0
commit c3bd630df0
3 changed files with 84 additions and 0 deletions

View 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.
#

View 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)',

View File

@ -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" } ],