This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libsanitizer] Fix Mac OS X 10.7 bootstrap (PR sanitizer/82824)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- Cc: gcc-patches at gcc dot gnu dot org, Kostya Serebryany <kcc at google dot com>, Mike Stump <mikestump at comcast dot net>, Iain Sandoe <iain at codesourcery dot com>
- Date: Tue, 14 Nov 2017 12:02:30 +0100
- Subject: Re: [libsanitizer] Fix Mac OS X 10.7 bootstrap (PR sanitizer/82824)
- Authentication-results: sourceware.org; auth=none
- References: <yddr2t12l7x.fsf@CeBiTec.Uni-Bielefeld.DE>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Nov 14, 2017 at 11:44:34AM +0100, Rainer Orth wrote:
> 2017-11-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
>
> PR sanitizer/82824
> * configure.ac (LSAN_COMMON_SUPPORTED): New conditional. Disable
> before *-*-darwin13*.
> (WEAK_HOOKS_SUPPORT): New conditional.
> * configure: Regenerate.
> * asan/Makefile.am (DEFS) [!LSAN_COMMON_SUPPORTED]: Disable
> CAN_SANITIZE_LEAKS.
> (DEFS) [!LSAN_COMMON_SUPPORTED]: Disable
> SANITIZER_SUPPORTS_WEAK_HOOKS.
> * asan/Makefile.in: Regenerate.
> * lsan/Makefile.am (DEFS) [!LSAN_COMMON_SUPPORTED]: Disable
> CAN_SANITIZE_LEAKS.
> (DEFS) [!LSAN_COMMON_SUPPORTED]: Disable
> SANITIZER_SUPPORTS_WEAK_HOOKS.
> * lsan/Makefile.in: Regenerate.
> * lsan/lsan_common.h: Allow predefining CAN_SANITIZE_LEAKS.
> * sanitizer_common/Makefile.am (DEFS) [!LSAN_COMMON_SUPPORTED]:
> Disable SANITIZER_SUPPORTS_WEAK_HOOKS.
> * sanitizer_common/Makefile.in: Regenerate.
> --- a/libsanitizer/configure.ac
> +++ b/libsanitizer/configure.ac
> @@ -140,6 +140,24 @@ case "$host" in
> esac
> AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
>
> +# lsan_common_mac.cc needs VM_MEMORY_OS_ALLOC_ONCE which was only
> +# introduced in Mac OS X 10.9/Darwin 13.
> +case "$host" in
> + *-*-darwin[[1-9]] | *-*-darwin[[1-9]].* | *-*-darwin1[[0-2]]*)
> + LSAN_COMMON=false ;;
> + *) LSAN_COMMON=true ;;
> +esac
> +AM_CONDITIONAL(LSAN_COMMON_SUPPORTED, $LSAN_COMMON)
> +
> +# Before Xcode 4.5, the Darwin linker doesn't properly support undefined
> +# weak symbols.
> +case "$host" in
$host here and above? Shouldn't that be $target instead?
That said, I think it would be better to move this stuff except for the
AM_CONDITIONAL into configure.tgt similarly to how *_SUPPORTED is handled.
And the preexisting:
case "$host" in
*-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
*) MAC_INTERPOSE=false ;;
esac
AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
looks wrong too.
> --- a/libsanitizer/lsan/lsan_common.h
> +++ b/libsanitizer/lsan/lsan_common.h
> @@ -20,6 +20,7 @@
> #include "sanitizer_common/sanitizer_stoptheworld.h"
> #include "sanitizer_common/sanitizer_symbolizer.h"
>
> +#ifndef CAN_SANITIZE_LEAKS
Obviously better would be to move the Darwin version checks here, but if
upstream refuses to do that, we can do it this way too.
Note we already have similar thing in ubsan/ubsan_platform.h, where we
want to override CAN_SANITIZE_UB from command line and need to patch that
header for that, because upstream doesn't allow that :(.
> // LeakSanitizer relies on some Glibc's internals (e.g. TLS machinery) thus
> // supported for Linux only. Also, LSan doesn't like 32 bit architectures
> // because of "small" (4 bytes) pointer size that leads to high false negative
> @@ -42,6 +43,7 @@
> #else
> #define CAN_SANITIZE_LEAKS 0
> #endif
> +#endif // CAN_SANITIZE_LEAKS
>
> namespace __sanitizer {
> class FlagParser;
Jakub