diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-11-29 13:30:36 +0100 |
---|---|---|
committer | Yury Gribov <ygribov@gcc.gnu.org> | 2013-11-29 12:30:36 +0000 |
commit | 35814b034651b543b2521f9bd028c35f1fcaac1a (patch) | |
tree | 0cc2ab434efd00fd5b66854aa66871625d4c011b /libsanitizer/configure | |
parent | 08c5a7c685a97e0870fe278a1113523763b7af5f (diff) | |
download | gcc-35814b034651b543b2521f9bd028c35f1fcaac1a.zip gcc-35814b034651b543b2521f9bd028c35f1fcaac1a.tar.gz gcc-35814b034651b543b2521f9bd028c35f1fcaac1a.tar.bz2 |
re PR sanitizer/59063 (ASAN: segfault in __interceptor_clock_gettime)
gcc/
2013-11-29 Jakub Jelinek <jakub@redhat.com>
Yury Gribov <y.gribov@samsung.com>
PR sanitizer/59063
* config/gnu-user.h: Removed old code for setting up sanitizer
libs.
* gcc.c: Using libsanitizer spec instead of explicit libs.
gcc/testsuite/
2013-11-29 Jakub Jelinek <jakub@redhat.com>
Yury Gribov <y.gribov@samsung.com>
PR sanitizer/59063
* c-c++-common/asan/pr59063-1.c: New test.
* c-c++-common/asan/pr59063-2.c: Likewise.
* lib/asan-dg.exp: Add path to libsanitizer.spec to cflags.
* lib/ubsan-dg.exp: Likewise.
libsanitizer/
2013-11-29 Jakub Jelinek <jakub@redhat.com>
Yury Gribov <y.gribov@samsung.com>
PR sanitizer/59063
* libsanitizer.spec.in: Add spec file to hold link flags for
various sanitizer libs.
* configure.ac: Check whether clock_* routines come from librt.
* asan/Makefile.am (libasan_la_LDFLAGS): Libs now come from
configure.ac.
* tsan/Makefile.am (libtsan_la_LDFLAGS): Likewise.
* ubsan/Makefile.am (libubsan_la_LDFLAGS): Likewise.
* lsan/Makefile.am (liblsan_la_LDFLAGS): Likewise.
* asan/Makefile.in: Regenerate.
* interception/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
* Makefile.in: Regenerate.
* configure: Regenerate.
Co-Authored-By: Yury Gribov <y.gribov@samsung.com>
From-SVN: r205524
Diffstat (limited to 'libsanitizer/configure')
-rwxr-xr-x | libsanitizer/configure | 94 |
1 files changed, 91 insertions, 3 deletions
diff --git a/libsanitizer/configure b/libsanitizer/configure index 22f7fee..e5c3206 100755 --- a/libsanitizer/configure +++ b/libsanitizer/configure @@ -606,6 +606,10 @@ LTLIBOBJS LIBOBJS USING_MAC_INTERPOSE_FALSE USING_MAC_INTERPOSE_TRUE +link_liblsan +link_libubsan +link_libtsan +link_libasan LSAN_SUPPORTED_FALSE LSAN_SUPPORTED_TRUE TSAN_SUPPORTED_FALSE @@ -11119,7 +11123,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11122 "configure" +#line 11126 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11225,7 +11229,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11228 "configure" +#line 11232 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14544,6 +14548,89 @@ else fi +# Check for functions needed. +for ac_func in clock_getres clock_gettime clock_settime +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# Common libraries that we need to link against for all sanitizer libs. +link_sanitizer_common='-lpthread -ldl' + +# Set up the set of additional libraries that we need to link against for libasan. +link_libasan=$link_sanitizer_common + + +# Set up the set of additional libraries that we need to link against for libtsan. +link_libtsan=$link_sanitizer_common + + +# Set up the set of additional libraries that we need to link against for libubsan. +link_libubsan=$link_sanitizer_common + + +# Set up the set of additional libraries that we need to link against for liblsan. +link_liblsan=$link_sanitizer_common + + +# At least for glibc, clock_gettime is in librt. But don't pull that +# in if it still doesn't give us the function we want. This +# test is copied from libgomp. +if test $ac_cv_func_clock_gettime = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then : + link_libasan="-lrt $link_libasan" +link_libtsan="-lrt $link_libtsan" +# Other sanitizers do not override clock_* API + +fi + +fi + case "$host" in *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;; *) MAC_INTERPOSE=false ;; @@ -14557,7 +14644,7 @@ else fi -ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile libsanitizer.spec" ac_config_files="$ac_config_files interception/Makefile sanitizer_common/Makefile lsan/Makefile asan/Makefile ubsan/Makefile" @@ -15692,6 +15779,7 @@ do "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "libsanitizer.spec") CONFIG_FILES="$CONFIG_FILES libsanitizer.spec" ;; "interception/Makefile") CONFIG_FILES="$CONFIG_FILES interception/Makefile" ;; "sanitizer_common/Makefile") CONFIG_FILES="$CONFIG_FILES sanitizer_common/Makefile" ;; "lsan/Makefile") CONFIG_FILES="$CONFIG_FILES lsan/Makefile" ;; |