re PR sanitizer/82595 (bootstrap fails in libsanitizer on powerpc64-unknown-linux...
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Oct 2017 07:32:35 +0000 (09:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Oct 2017 07:32:35 +0000 (09:32 +0200)
PR sanitizer/82595
* config/gnu-user.h (LIBTSAN_EARLY_SPEC): Add libtsan_preinit.o
for -fsanitize=thread link of executables.
(LIBLSAN_EARLY_SPEC): Add liblsan_preinit.o for -fsanitize=leak
link of executables.

* lsan/lsan.h (__lsan_init): Add SANITIZER_INTERFACE_ATTRIBUTE.
* lsan/Makefile.am (nodist_toolexeclib_HEADERS): Add
liblsan_preinit.o.
(lsan_files): Remove lsan_preinit.cc.
(liblsan_preinit.o): New rule.
* lsan/Makefile.in: Regenerated.

From-SVN: r253925

gcc/ChangeLog
gcc/config/gnu-user.h
libsanitizer/ChangeLog
libsanitizer/lsan/Makefile.am
libsanitizer/lsan/Makefile.in
libsanitizer/lsan/lsan.h

index feb665f68cf7c185fc37f85eb8a532659c1378e1..f28e70a37766fc1a8b384b14f4aa1ec6df210697 100644 (file)
@@ -1,5 +1,11 @@
 2017-10-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/82595
+       * config/gnu-user.h (LIBTSAN_EARLY_SPEC): Add libtsan_preinit.o
+       for -fsanitize=thread link of executables.
+       (LIBLSAN_EARLY_SPEC): Add liblsan_preinit.o for -fsanitize=leak
+       link of executables.
+
        PR target/82370
        * config/i386/sse.md (VI248_AVX2, VI248_AVX512BW, VI248_AVX512BW_2):
        New mode iterators.
index a967b69a3500a94736c32c5541c77ec2bcc729ab..df17b18090696641d23b4bb157a49963e211e31d 100644 (file)
@@ -162,11 +162,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
   LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
 #undef LIBTSAN_EARLY_SPEC
-#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
+#define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
+  "%{static-libtsan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
   LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
 #undef LIBLSAN_EARLY_SPEC
-#define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
+#define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
+  "%{static-liblsan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
   LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
 #endif
index 1cd9a1bf32089fd22204992a1965fbe7fb854648..63e71317cbfb979af5efb1962270a3c34b440f85 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR sanitizer/82595
+       * lsan/lsan.h (__lsan_init): Add SANITIZER_INTERFACE_ATTRIBUTE.
+       * lsan/Makefile.am (nodist_toolexeclib_HEADERS): Add
+       liblsan_preinit.o.
+       (lsan_files): Remove lsan_preinit.cc.
+       (liblsan_preinit.o): New rule.
+       * lsan/Makefile.in: Regenerated.
+
 2017-10-19  Jakub Jelinek  <jakub@redhat.com>
 
        * All source files: Merge from upstream 315899.
index 9638f30da1aaf3f20cab6dfe8d7e1a66da39969d..700d15fce57c3a2fe55cfcf555947010bc7ed0e8 100644 (file)
@@ -12,6 +12,7 @@ ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libsanitizer_lsan.la
 if LSAN_SUPPORTED
 toolexeclib_LTLIBRARIES = liblsan.la
+nodist_toolexeclib_HEADERS = liblsan_preinit.o
 endif
 
 sanitizer_lsan_files = \
@@ -27,7 +28,6 @@ lsan_files = \
        lsan_malloc_mac.cc \
        lsan_allocator.cc \
        lsan_interceptors.cc \
-       lsan_preinit.cc \
        lsan_thread.cc
 
 libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
@@ -40,6 +40,9 @@ endif
 liblsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
 liblsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(link_liblsan)
 
+liblsan_preinit.o: lsan_preinit.o
+       cp $< $@
+
 # 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
 # friends when we are called from the top level Makefile.
index f0d1e0f37da4a60c65310e4d6d3a534fae8b0fd1..85502500728bb14d67a644b663920a5468382b98 100644 (file)
@@ -15,6 +15,7 @@
 
 @SET_MAKE@
 
+
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
@@ -100,7 +101,8 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
+       "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 liblsan_la_DEPENDENCIES =  \
@@ -110,7 +112,7 @@ liblsan_la_DEPENDENCIES =  \
 am__objects_1 = lsan_common.lo lsan_common_linux.lo lsan_common_mac.lo
 am__objects_2 = $(am__objects_1) lsan.lo lsan_linux.lo lsan_mac.lo \
        lsan_malloc_mac.lo lsan_allocator.lo lsan_interceptors.lo \
-       lsan_preinit.lo lsan_thread.lo
+       lsan_thread.lo
 am_liblsan_la_OBJECTS = $(am__objects_2)
 liblsan_la_OBJECTS = $(am_liblsan_la_OBJECTS)
 liblsan_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -139,6 +141,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+HEADERS = $(nodist_toolexeclib_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 ACLOCAL = @ACLOCAL@
@@ -298,6 +301,7 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
 ACLOCAL_AMFLAGS = -I m4
 noinst_LTLIBRARIES = libsanitizer_lsan.la
 @LSAN_SUPPORTED_TRUE@toolexeclib_LTLIBRARIES = liblsan.la
+@LSAN_SUPPORTED_TRUE@nodist_toolexeclib_HEADERS = liblsan_preinit.o
 sanitizer_lsan_files = \
        lsan_common.cc \
        lsan_common_linux.cc \
@@ -311,7 +315,6 @@ lsan_files = \
        lsan_malloc_mac.cc \
        lsan_allocator.cc \
        lsan_interceptors.cc \
-       lsan_preinit.cc \
        lsan_thread.cc
 
 libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
@@ -456,7 +459,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_linux.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_mac.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_malloc_mac.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_preinit.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_thread.Plo@am__quote@
 
 .cc.o:
@@ -485,6 +487,27 @@ mostlyclean-libtool:
 
 clean-libtool:
        -rm -rf .libs _libs
+install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
+       @$(NORMAL_INSTALL)
+       @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+       fi; \
+       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|^.*/||'`; \
+       dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -539,9 +562,9 @@ distclean-tags:
        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
-       for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+       for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -603,7 +626,8 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-nodist_toolexeclibHEADERS \
+       install-toolexeclibLTLIBRARIES
 
 install-html: install-html-am
 
@@ -643,7 +667,8 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-nodist_toolexeclibHEADERS \
+       uninstall-toolexeclibLTLIBRARIES
 
 .MAKE: install-am install-strip
 
@@ -654,14 +679,19 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
        html html-am info info-am install 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-pdf install-pdf-am \
-       install-ps install-ps-am install-strip \
-       install-toolexeclibLTLIBRARIES installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
-       uninstall-am uninstall-toolexeclibLTLIBRARIES
-
+       install-info-am install-man install-nodist_toolexeclibHEADERS \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip install-toolexeclibLTLIBRARIES installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am \
+       uninstall-nodist_toolexeclibHEADERS \
+       uninstall-toolexeclibLTLIBRARIES
+
+
+liblsan_preinit.o: lsan_preinit.o
+       cp $< $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
index 1cd1c36dbc4da3c9acec7eb830468275b81ff950..42d4214ed0fda15607b4e417ab03de10e427da86 100644 (file)
@@ -64,4 +64,4 @@ void GetStackTraceWithPcBpAndContext(__sanitizer::BufferedStackTrace *stack,
 extern bool lsan_inited;
 extern bool lsan_init_is_running;
 
-extern "C" void __lsan_init();
+extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __lsan_init();