]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR sanitizer/59063 (ASAN: segfault in __interceptor_clock_gettime)
authorJakub Jelinek <jakub@redhat.com>
Fri, 29 Nov 2013 12:30:36 +0000 (13:30 +0100)
committerYury Gribov <ygribov@gcc.gnu.org>
Fri, 29 Nov 2013 12:30:36 +0000 (12:30 +0000)
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

24 files changed:
gcc/ChangeLog
gcc/config/gnu-user.h
gcc/gcc.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/pr59063-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/asan/pr59063-2.c [new file with mode: 0644]
gcc/testsuite/lib/asan-dg.exp
gcc/testsuite/lib/ubsan-dg.exp
libsanitizer/ChangeLog
libsanitizer/Makefile.am
libsanitizer/Makefile.in
libsanitizer/asan/Makefile.am
libsanitizer/asan/Makefile.in
libsanitizer/configure
libsanitizer/configure.ac
libsanitizer/interception/Makefile.in
libsanitizer/libsanitizer.spec.in [new file with mode: 0644]
libsanitizer/lsan/Makefile.am
libsanitizer/lsan/Makefile.in
libsanitizer/sanitizer_common/Makefile.in
libsanitizer/tsan/Makefile.am
libsanitizer/tsan/Makefile.in
libsanitizer/ubsan/Makefile.am
libsanitizer/ubsan/Makefile.in

index b40ff365aea6feff402cc1acf53fd07fff55262c..33fa1590e647bb6e182b4c443b6a8a28a96def76 100644 (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:
index 157e147b188d89c87c9404c3f3204d857cfd87a6..60eb30dd1279768bff5821260139eea4cbfbcc9b 100644 (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"
index 4edf6771c4f92a0478d805dab2c608cfc962779a..b895f226ad0e497052e0e5de0744d621913babc1 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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
 
index 713980f5328406126515a6dcb772706fe0f25991..75ccd0138089042074a3dfb073e60a740fb33ffe 100644 (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.
diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-1.c b/gcc/testsuite/c-c++-common/asan/pr59063-1.c
new file mode 100644 (file)
index 0000000..a4e01f7
--- /dev/null
@@ -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);
+}
diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-2.c b/gcc/testsuite/c-c++-common/asan/pr59063-2.c
new file mode 100644 (file)
index 0000000..64354ea
--- /dev/null
@@ -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);
+}
index e0bf2da2e783a0a92751b0c05b8dbd7924e81b97..823265ccb84a1b57b66c8716c1dc3d3efdbeefce 100644 (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"
       }
index 4ec5fdfad67150b6689c01612a20e411dff734bc..2e6b272822dbaa30edf5d5fff13a152331eca5af 100644 (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"
       }
index 028c52122dfb159dba38c66341ccfc48fe32f11b..8404d51a053f5d5eae00dea95558c76397e17b48 100644 (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>
 
index 15c11ecb2d72cf55d2fd7220afabd97d3757db13..6c3e5b053a2dd2365efb6e9e4c363cf20e1de547 100644 (file)
@@ -50,5 +50,7 @@ AM_MAKEFLAGS = \
 
 MAKEOVERRIDES=
 
+nodist_toolexeclib_HEADERS = libsanitizer.spec
+
 ## ################################################################
 
index 47a8771c7831caa347430d7b74aea8070425e2a0..9424c59fe3741c154ca4e9cfcc616ed9f7fce453 100644 (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.
index 0e1ee111a79f79f3883dc946624e7e1c6915bdcc..58defae04b719068b977714803be18af3b489adc 100644 (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 $< $@
index c6044744e1ddf56384fc65532af1424ed9b83bb8..e86d7b5b34bdd231537940898706e3546c7442ed 100644 (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
index 22f7fee91560360b7034c96639f5937303468531..e5c320604d3eeee23e81259ee23f99e5ea14314e 100755 (executable)
@@ -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" ;;
index f769fdb030c1e0f15fbe9efc8d76ab74894c1be8..7f9327904dae44bb7d77b10c70e417817e44a5cf 100644 (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
index f3a2f41c033bcd943b79d1d1886a5d62c0677d3a..52a06d6345882d9fb46fa48cfe5f8c3e51fba2c9 100644 (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@
diff --git a/libsanitizer/libsanitizer.spec.in b/libsanitizer/libsanitizer.spec.in
new file mode 100644 (file)
index 0000000..a4fa87d
--- /dev/null
@@ -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@
+
index a312c1c262e02e2077b7570966a096ac1386707e..36fd6058841ce62867bf0fd1cf186aa6620024bb 100644 (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
index f0946618eb2c642536d97e943621b2f7a39f06cf..9296b7048abe024cb6e5e121ebfe484e8a28355c 100644 (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
index b54465388ce7b073cb13f136199e94710dac61b0..9bbdfd6acfe7fea38fb44e184d5815fb6ddce1ed 100644 (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@
index 6fc4d0ea0ff1507036f1c4fec948ce544d8c2d9a..9b039d229d77f1864ccfc2fc9023087cd97705d1 100644 (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
index bac430be35d50c328a697a799c6d1e2ffbff241a..eb5c7e7a84b090f79168bea990ee6a6321210c5e 100644 (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
index ce94eaacbde1382955f4aa77c498cbb169c43abc..24e405bd146e2e397409be15f80a5f28db8ae39d 100644 (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
index 314835885ff3de537be89055b591416b29c127e9..dcb04c72d4dae444c86a15bbde1a49a85735ac4a 100644 (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