* [PATCH] Fix for PR57316 (avoid building sanitizer on old kernels)
@ 2014-01-23 12:33 Yury Gribov
2014-01-23 12:59 ` Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Yury Gribov @ 2014-01-23 12:33 UTC (permalink / raw)
To: GCC Patches; +Cc: Jakub Jelinek, PHHargrove, skunk, Viacheslav Garbuzov
[-- Attachment #1: Type: text/plain, Size: 249 bytes --]
Hi,
Attached patch disables libsanitizer on older Linux distribs which lack
necessary syscalls (see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57316 for more details).
Bootstrapped/regtested on x64.
Ok to commit?
--
Best regards,
Yury Gribov
[-- Attachment #2: detect_nofutex_4.diff --]
[-- Type: text/x-diff, Size: 5708 bytes --]
2014-01-22 ygribov <ygribov@samsung.com>
sanitizer/PR57316
* configure.ac: Check for missing syscalls.
* Makefile.am: Likewise.
* configure: Regenerate.
* Makefile.in: Regenerate.
diff --git a/libsanitizer/Makefile.am b/libsanitizer/Makefile.am
index a17f7b6..b0dc582 100644
--- a/libsanitizer/Makefile.am
+++ b/libsanitizer/Makefile.am
@@ -1,5 +1,6 @@
ACLOCAL_AMFLAGS = -I .. -I ../config
+if SANITIZER_SUPPORTED
SUBDIRS = sanitizer_common
if !USING_MAC_INTERPOSE
SUBDIRS += interception
@@ -11,6 +12,7 @@ SUBDIRS += lsan asan ubsan
if TSAN_SUPPORTED
SUBDIRS += tsan
endif
+endif
## May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in
index 5a33e0e..60cbe2e 100644
--- a/libsanitizer/Makefile.in
+++ b/libsanitizer/Makefile.in
@@ -35,9 +35,9 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@USING_MAC_INTERPOSE_FALSE@am__append_1 = interception
-@LIBBACKTRACE_SUPPORTED_TRUE@am__append_2 = libbacktrace
-@TSAN_SUPPORTED_TRUE@am__append_3 = tsan
+@SANITIZER_SUPPORTED_TRUE@@USING_MAC_INTERPOSE_FALSE@am__append_1 = interception
+@LIBBACKTRACE_SUPPORTED_TRUE@@SANITIZER_SUPPORTED_TRUE@am__append_2 = libbacktrace
+@SANITIZER_SUPPORTED_TRUE@@TSAN_SUPPORTED_TRUE@am__append_3 = tsan
subdir = .
DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
@@ -250,8 +250,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I .. -I ../config
-SUBDIRS = sanitizer_common $(am__append_1) $(am__append_2) lsan asan \
- ubsan $(am__append_3)
+@SANITIZER_SUPPORTED_TRUE@SUBDIRS = sanitizer_common $(am__append_1) \
+@SANITIZER_SUPPORTED_TRUE@ $(am__append_2) lsan asan ubsan \
+@SANITIZER_SUPPORTED_TRUE@ $(am__append_3)
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
diff --git a/libsanitizer/configure b/libsanitizer/configure
index c207359..5e4840f 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -612,6 +612,8 @@ ALLOC_FILE
VIEW_FILE
BACKTRACE_SUPPORTED
FORMAT_FILE
+SANITIZER_SUPPORTED_FALSE
+SANITIZER_SUPPORTED_TRUE
USING_MAC_INTERPOSE_FALSE
USING_MAC_INTERPOSE_TRUE
link_liblsan
@@ -12017,7 +12019,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12020 "configure"
+#line 12022 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12123,7 +12125,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12126 "configure"
+#line 12128 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15586,6 +15588,47 @@ fi
backtrace_supported=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for necessary platform features" >&5
+$as_echo_n "checking for necessary platform features... " >&6; }
+case "$target" in
+ *-*-linux*)
+ # Some old Linux distributions miss required syscalls.
+ sanitizer_supported=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/syscall.h>
+int
+main ()
+{
+
+ syscall (__NR_gettid);
+ syscall (__NR_futex);
+ syscall (__NR_exit_group);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ sanitizer_supported=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+ *)
+ sanitizer_supported=yes
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sanitizer_supported" >&5
+$as_echo "$sanitizer_supported" >&6; }
+ if test "$sanitizer_supported" = yes; then
+ SANITIZER_SUPPORTED_TRUE=
+ SANITIZER_SUPPORTED_FALSE='#'
+else
+ SANITIZER_SUPPORTED_TRUE='#'
+ SANITIZER_SUPPORTED_FALSE=
+fi
+
+
# Test for __sync support.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __sync extensions" >&5
$as_echo_n "checking __sync extensions... " >&6; }
@@ -16456,6 +16499,10 @@ if test -z "${USING_MAC_INTERPOSE_TRUE}" && test -z "${USING_MAC_INTERPOSE_FALSE
as_fn_error "conditional \"USING_MAC_INTERPOSE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${SANITIZER_SUPPORTED_TRUE}" && test -z "${SANITIZER_SUPPORTED_FALSE}"; then
+ as_fn_error "conditional \"SANITIZER_SUPPORTED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${LIBBACKTRACE_SUPPORTED_TRUE}" && test -z "${LIBBACKTRACE_SUPPORTED_FALSE}"; then
as_fn_error "conditional \"LIBBACKTRACE_SUPPORTED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index c4641d4..e672131 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -132,6 +132,24 @@ AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
backtrace_supported=yes
+AC_MSG_CHECKING([for necessary platform features])
+case "$target" in
+ *-*-linux*)
+ # Some old Linux distributions miss required syscalls.
+ sanitizer_supported=no
+ AC_TRY_COMPILE([#include <sys/syscall.h>],[
+ syscall (__NR_gettid);
+ syscall (__NR_futex);
+ syscall (__NR_exit_group);
+ ], [sanitizer_supported=yes])
+ ;;
+ *)
+ sanitizer_supported=yes
+ ;;
+esac
+AC_MSG_RESULT($sanitizer_supported)
+AM_CONDITIONAL(SANITIZER_SUPPORTED, test "$sanitizer_supported" = yes)
+
# Test for __sync support.
AC_CACHE_CHECK([__sync extensions],
[libsanitizer_cv_sys_sync],
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for PR57316 (avoid building sanitizer on old kernels)
2014-01-23 12:33 [PATCH] Fix for PR57316 (avoid building sanitizer on old kernels) Yury Gribov
@ 2014-01-23 12:59 ` Jakub Jelinek
2014-01-23 14:33 ` Yury Gribov
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2014-01-23 12:59 UTC (permalink / raw)
To: Yury Gribov; +Cc: GCC Patches, PHHargrove, skunk, Viacheslav Garbuzov
On Thu, Jan 23, 2014 at 04:33:28PM +0400, Yury Gribov wrote:
> Attached patch disables libsanitizer on older Linux distribs which
> lack necessary syscalls (see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57316 for more details).
>
> Bootstrapped/regtested on x64.
>
> Ok to commit?
Ok, thanks, but:
> 2014-01-22 ygribov <ygribov@samsung.com>
Put your real name here instead.
> sanitizer/PR57316
PR sanitizer/57316
> * configure.ac: Check for missing syscalls.
> * Makefile.am: Likewise.
> * configure: Regenerate.
> * Makefile.in: Regenerate.
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for PR57316 (avoid building sanitizer on old kernels)
2014-01-23 12:59 ` Jakub Jelinek
@ 2014-01-23 14:33 ` Yury Gribov
0 siblings, 0 replies; 3+ messages in thread
From: Yury Gribov @ 2014-01-23 14:33 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches, PHHargrove, skunk, Viacheslav Garbuzov
Jakub wrote:
>> Ok to commit?
>
> Ok, thanks, but:
Done, r206966.
> Put your real name here instead.
> PR sanitizer/57316
Oh my, fixed.
-Y
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-23 14:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 12:33 [PATCH] Fix for PR57316 (avoid building sanitizer on old kernels) Yury Gribov
2014-01-23 12:59 ` Jakub Jelinek
2014-01-23 14:33 ` Yury Gribov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).