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
This commit is contained in:
Jakub Jelinek 2013-11-29 13:30:36 +01:00 committed by Yury Gribov
parent 08c5a7c685
commit 35814b0346
24 changed files with 318 additions and 75 deletions

View File

@ -1,3 +1,11 @@
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.
2013-11-29 Ilya Enkovich <ilya.enkovich@intel.com>
Reverted:

View File

@ -126,19 +126,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
#endif
/* Additional libraries needed by -static-libasan. */
#undef STATIC_LIBASAN_LIBS
#define STATIC_LIBASAN_LIBS "-ldl -lpthread"
/* Additional libraries needed by -static-libtsan. */
#undef STATIC_LIBTSAN_LIBS
#define STATIC_LIBTSAN_LIBS "-ldl -lpthread"
/* Additional libraries needed by -static-liblsan. */
#undef STATIC_LIBLSAN_LIBS
#define STATIC_LIBLSAN_LIBS "-ldl -lpthread"
/* Additional libraries needed by -static-libubsan. */
#undef STATIC_LIBUBSAN_LIBS
#define STATIC_LIBUBSAN_LIBS "-ldl -lpthread"

View File

@ -535,20 +535,16 @@ proper position among the other output files. */
#define STACK_SPLIT_SPEC " %{fsplit-stack: --wrap=pthread_create}"
#ifndef LIBASAN_SPEC
#ifdef STATIC_LIBASAN_LIBS
#define ADD_STATIC_LIBASAN_LIBS \
" %{static-libasan:" STATIC_LIBASAN_LIBS "}"
#else
#define ADD_STATIC_LIBASAN_LIBS
#endif
#define STATIC_LIBASAN_LIBS \
" %{static-libasan:%:include(libsanitizer.spec)%(link_libasan)}"
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC ADD_STATIC_LIBASAN_LIBS
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
"} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
ADD_STATIC_LIBASAN_LIBS
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" ADD_STATIC_LIBASAN_LIBS
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
#endif
#endif
@ -557,20 +553,16 @@ proper position among the other output files. */
#endif
#ifndef LIBTSAN_SPEC
#ifdef STATIC_LIBTSAN_LIBS
#define ADD_STATIC_LIBTSAN_LIBS \
" %{static-libtsan:" STATIC_LIBTSAN_LIBS "}"
#else
#define ADD_STATIC_LIBTSAN_LIBS
#endif
#define STATIC_LIBTSAN_LIBS \
" %{static-libtsan:%:include(libsanitizer.spec)%(link_libtsan)}"
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC ADD_STATIC_LIBTSAN_LIBS
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
"} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
ADD_STATIC_LIBTSAN_LIBS
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" ADD_STATIC_LIBTSAN_LIBS
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
#endif
#endif
@ -579,34 +571,26 @@ proper position among the other output files. */
#endif
#ifndef LIBLSAN_SPEC
#ifdef STATIC_LIBLSAN_LIBS
#define ADD_STATIC_LIBLSAN_LIBS \
" %{static-liblsan:" STATIC_LIBLSAN_LIBS "}"
#else
#define ADD_STATIC_LIBLSAN_LIBS
#endif
#define STATIC_LIBLSAN_LIBS \
" %{static-liblsan:%:include(libsanitizer.spec)%(link_liblsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBLSAN_SPEC "%{!shared:%{static-liblsan:" LD_STATIC_OPTION \
"} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
ADD_STATIC_LIBLSAN_LIBS "}"
STATIC_LIBLSAN_LIBS "}"
#else
#define LIBLSAN_SPEC "%{!shared:-llsan" ADD_STATIC_LIBLSAN_LIBS "}"
#define LIBLSAN_SPEC "%{!shared:-llsan" STATIC_LIBLSAN_LIBS "}"
#endif
#endif
#ifndef LIBUBSAN_SPEC
#ifdef STATIC_LIBUBSAN_LIBS
#define ADD_STATIC_LIBUBSAN_LIBS \
" %{static-libubsan:" STATIC_LIBUBSAN_LIBS "}"
#else
#define ADD_STATIC_LIBUBSAN_LIBS
#endif
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
"} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
ADD_STATIC_LIBUBSAN_LIBS
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" ADD_STATIC_LIBUBSAN_LIBS
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
#endif
#endif

View File

@ -1,3 +1,12 @@
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.
2013-11-29 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt29.ad[sb]: New test.

View File

@ -0,0 +1,11 @@
/* { dg-do run } */
#include <time.h>
static int weak_gettime (clockid_t clk_id, struct timespec *tp)
__attribute__((__weakref__("clock_gettime")));
int main() {
if (!clock_gettime)
return 0;
struct timespec ts;
return weak_gettime(CLOCK_MONOTONIC, &ts);
}

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-static-libasan" } */
#include <time.h>
static int weak_gettime (clockid_t clk_id, struct timespec *tp)
__attribute__((__weakref__("clock_gettime")));
int main() {
if (!clock_gettime)
return 0;
struct timespec ts;
return weak_gettime(CLOCK_MONOTONIC, &ts);
}

View File

@ -39,9 +39,9 @@ proc asan_link_flags { paths } {
set shlib_ext [get_shlib_extension]
if { $gccpath != "" } {
append flags " -B${gccpath}/libsanitizer/asan/ "
if { [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.a"]
|| [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/asan/ "
append flags " -L${gccpath}/libsanitizer/asan/.libs "
append ld_library_path ":${gccpath}/libsanitizer/asan/.libs"
}

View File

@ -30,9 +30,9 @@ proc ubsan_link_flags { paths } {
set shlib_ext [get_shlib_extension]
if { $gccpath != "" } {
append flags " -B${gccpath}/libsanitizer/ubsan/ "
if { [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.a"]
|| [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.${shlib_ext}"] } {
append flags " -B${gccpath}/libsanitizer/ubsan/ "
append flags " -L${gccpath}/libsanitizer/ubsan/.libs"
append ld_library_path ":${gccpath}/libsanitizer/ubsan/.libs"
}

View File

@ -1,3 +1,24 @@
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.
2013-11-28 Jakub Jelinek <jakub@redhat.com>
Yury Gribov <y.gribov@samsung.com>

View File

@ -50,5 +50,7 @@ AM_MAKEFLAGS = \
MAKEOVERRIDES=
nodist_toolexeclib_HEADERS = libsanitizer.spec
## ################################################################

View File

@ -14,6 +14,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -37,7 +38,7 @@ target_triplet = @target@
subdir = .
DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/../mkinstalldirs
$(srcdir)/../mkinstalldirs $(srcdir)/libsanitizer.spec.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
@ -54,7 +55,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = libsanitizer.spec
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
MULTISRCTOP =
@ -70,6 +71,29 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
HEADERS = $(nodist_toolexeclib_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@ -183,6 +207,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
@ -252,6 +280,7 @@ AM_MAKEFLAGS = \
"DESTDIR=$(DESTDIR)"
MAKEOVERRIDES =
nodist_toolexeclib_HEADERS = libsanitizer.spec
all: all-recursive
.SUFFIXES:
@ -289,6 +318,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
libsanitizer.spec: $(top_builddir)/config.status $(srcdir)/libsanitizer.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
@ -315,6 +346,26 @@ distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
done
uninstall-nodist_toolexeclibHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(toolexeclibdir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@ -452,9 +503,12 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-am: all-am
check: check-recursive
all-am: Makefile all-multi
all-am: Makefile all-multi $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
@ -508,7 +562,7 @@ install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-multi
install-exec-am: install-multi install-nodist_toolexeclibHEADERS
install-html: install-html-recursive
@ -548,7 +602,7 @@ ps: ps-recursive
ps-am:
uninstall-am:
uninstall-am: uninstall-nodist_toolexeclibHEADERS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all-multi \
clean-multi ctags-recursive distclean-multi install-am \
@ -563,12 +617,14 @@ uninstall-am:
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-multi install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-multi mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-multi pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
install-multi install-nodist_toolexeclibHEADERS install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic \
maintainer-clean-multi mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-multi pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am \
uninstall-nodist_toolexeclibHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -43,7 +43,7 @@ libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(to
endif
libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
libasan_preinit.o: asan_preinit.o
cp $< $@

View File

@ -224,6 +224,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
@ -289,7 +293,7 @@ libasan_la_SOURCES = $(asan_files)
@USING_MAC_INTERPOSE_TRUE@libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la \
@USING_MAC_INTERPOSE_TRUE@ $(top_builddir)/lsan/libsanitizer_lsan.la \
@USING_MAC_INTERPOSE_TRUE@ $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libasan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libasan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and

View File

@ -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" ;;

View File

@ -83,13 +83,46 @@ unset LSAN_SUPPORTED
AM_CONDITIONAL(TSAN_SUPPORTED, [test "x$TSAN_SUPPORTED" = "xyes"])
AM_CONDITIONAL(LSAN_SUPPORTED, [test "x$LSAN_SUPPORTED" = "xyes"])
# Check for functions needed.
AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)
# 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
AC_SUBST(link_libasan)
# Set up the set of additional libraries that we need to link against for libtsan.
link_libtsan=$link_sanitizer_common
AC_SUBST(link_libtsan)
# Set up the set of additional libraries that we need to link against for libubsan.
link_libubsan=$link_sanitizer_common
AC_SUBST(link_libubsan)
# Set up the set of additional libraries that we need to link against for liblsan.
link_liblsan=$link_sanitizer_common
AC_SUBST(link_liblsan)
# 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
AC_CHECK_LIB(rt, clock_gettime,
[link_libasan="-lrt $link_libasan"
link_libtsan="-lrt $link_libtsan"
# Other sanitizers do not override clock_* API
])
fi
case "$host" in
*-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
*) MAC_INTERPOSE=false ;;
esac
AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile libsanitizer.spec])
AC_CONFIG_FILES(AC_FOREACH([DIR], [interception sanitizer_common lsan asan ubsan], [DIR/Makefile ]),
[cat > vpsed$$ << \_EOF

View File

@ -181,6 +181,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@

View File

@ -0,0 +1,11 @@
# This spec file is read by gcc when linking. It is used to specify the
# standard libraries we need in order to link with various sanitizer libs.
*link_libasan: @link_libasan@
*link_libtsan: @link_libtsan@
*link_libubsan: @link_libubsan@
*link_liblsan: @link_liblsan@

View File

@ -28,7 +28,7 @@ libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
liblsan_la_SOURCES = $(lsan_files)
liblsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDFLAGS)
liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and

View File

@ -215,6 +215,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
@ -265,7 +269,7 @@ lsan_files = \
libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
liblsan_la_SOURCES = $(lsan_files)
liblsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDFLAGS)
liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and

View File

@ -192,6 +192,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@

View File

@ -39,7 +39,7 @@ tsan_files = \
libtsan_la_SOURCES = $(tsan_files)
libtsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and

View File

@ -231,6 +231,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
@ -295,7 +299,7 @@ tsan_files = \
libtsan_la_SOURCES = $(tsan_files)
libtsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libtsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libtsan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and

View File

@ -23,7 +23,7 @@ if !USING_MAC_INTERPOSE
libubsan_la_LIBADD += $(top_builddir)/interception/libinterception.la
endif
libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
# Use special rules for files that require RTTI support.
ubsan_handlers_cxx.% ubsan_type_hash.% : AM_CXXFLAGS += -frtti

View File

@ -210,6 +210,10 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
link_libasan = @link_libasan@
link_liblsan = @link_liblsan@
link_libtsan = @link_libtsan@
link_libubsan = @link_libubsan@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
@ -256,7 +260,7 @@ libubsan_la_SOURCES = $(ubsan_files)
libubsan_la_LIBADD = \
$(top_builddir)/sanitizer_common/libsanitizer_common.la \
$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_libubsan)
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and