Don't use '-z defs' with Clang's sanitizers

The clang documentation in all sanitizers we currently use says this:

    When linking shared libraries, the {flavor}Sanitizer run-time is
    not linked, so -Wl,-z,defs may cause link errors (don’t use it
    with {flavor}Sanitizer)

(in our case, {flavor} is one of Address, Memory, or UndefinedBehavior)

Therefore, we turn off that particular flag specifically when using
the sanitizers.

Fixes #8735

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8749)
This commit is contained in:
Richard Levitte 2019-04-15 10:40:18 +02:00
parent f2dbb71cb6
commit 72eb100f8a

View file

@ -32,7 +32,10 @@ my %shared_info;
return { return {
%{$shared_info{'gnu-shared'}}, %{$shared_info{'gnu-shared'}},
shared_defflag => '-Wl,--version-script=', shared_defflag => '-Wl,--version-script=',
dso_ldflags => '-z defs', dso_ldflags =>
$disabled{asan} && $disabled{msan} && $disabled{ubsan}
? '-z defs'
: '',
}; };
}, },
'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; }, 'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },