public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [asan] migrate runtime from llvm
@ 2012-10-16  6:40 Wei Mi
  2012-10-16  6:40 ` Andrew Pinski
  0 siblings, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-16  6:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Diego Novillo, David Li

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

Hi,

I create a patch to migrate llvm runtime to asan branch. The
configure.ac is a preliminary version and almost doesn't contain any
portability check. I build it and test my own small case only and it
works. Just send it out to ask for a preliminary review. The patch is
zipped to keep it smaller than 400K (required by sourceware.org).
Because I am a fresh man to gcc, please forgive me to send out a patch
with many errors.

Thanks,
Wei.

gcc/ChangeLog:
2012-10-15   Wei Mi  <wmi@google.com>

migrate llvm runtime to asan branch
* configure.ac: Add libasan to target_libraries
* Makefile.def: Ditto
* configure: Regenerate
* Makefile.in: Regenerate
* gcc/gcc.c: Add -lasan -lpthread ... to link command if -fasan is on
* libasan: New directory for asan runtime

[-- Attachment #2: patch.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 125926 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16  6:40 [asan] migrate runtime from llvm Wei Mi
@ 2012-10-16  6:40 ` Andrew Pinski
  2012-10-16  6:45   ` Wei Mi
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Pinski @ 2012-10-16  6:40 UTC (permalink / raw)
  To: Wei Mi; +Cc: gcc-patches, Diego Novillo, David Li

On Mon, Oct 15, 2012 at 11:25 PM, Wei Mi <wmi@google.com> wrote:
> Hi,
>
> I create a patch to migrate llvm runtime to asan branch. The
> configure.ac is a preliminary version and almost doesn't contain any
> portability check. I build it and test my own small case only and it
> works. Just send it out to ask for a preliminary review. The patch is
> zipped to keep it smaller than 400K (required by sourceware.org).
> Because I am a fresh man to gcc, please forgive me to send out a patch
> with many errors.

This is a good start.  Can you send a patch out without including
libasan so at least the toplevel parts can be reviewed easier?
Also the changelog entry for gcc.c go under the gcc/ChangeLog rather
than the toplevel one.

Thanks,
Andrew Pinski

>
> Thanks,
> Wei.
>
> gcc/ChangeLog:
> 2012-10-15   Wei Mi  <wmi@google.com>
>
> migrate llvm runtime to asan branch
> * configure.ac: Add libasan to target_libraries
> * Makefile.def: Ditto
> * configure: Regenerate
> * Makefile.in: Regenerate
> * gcc/gcc.c: Add -lasan -lpthread ... to link command if -fasan is on
> * libasan: New directory for asan runtime

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16  6:40 ` Andrew Pinski
@ 2012-10-16  6:45   ` Wei Mi
  2012-10-16  7:47     ` Andrew Pinski
  2012-10-16 15:27     ` Jakub Jelinek
  0 siblings, 2 replies; 31+ messages in thread
From: Wei Mi @ 2012-10-16  6:45 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches, Diego Novillo, David Li

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

>
> This is a good start.  Can you send a patch out without including
> libasan so at least the toplevel parts can be reviewed easier?
> Also the changelog entry for gcc.c go under the gcc/ChangeLog rather
> than the toplevel one.
>
> Thanks,
> Andrew Pinski

Sure, I attach it. Thanks for pointing out the changelog error.

Thanks,
Wei.

[-- Attachment #2: patch.wo.libasan.txt --]
[-- Type: text/plain, Size: 26972 bytes --]

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 192487)
+++ Makefile.in	(working copy)
@@ -575,7 +575,7 @@ all:
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libasan)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
 
 @if target-libstdc++-v3
 TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
@@ -585,6 +585,10 @@ TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TAR
 TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
 @endif target-libmudflap
 
+@if target-libasan
+TARGET_LIB_PATH_libasan = $$r/$(TARGET_SUBDIR)/libasan/.libs:
+@endif target-libasan
+
 @if target-libssp
 TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
 @endif target-libssp
@@ -914,6 +918,7 @@ configure-host:  \
 configure-target:  \
     maybe-configure-target-libstdc++-v3 \
     maybe-configure-target-libmudflap \
+    maybe-configure-target-libasan \
     maybe-configure-target-libssp \
     maybe-configure-target-newlib \
     maybe-configure-target-libgcc \
@@ -1062,6 +1067,7 @@ all-host: maybe-all-lto-plugin
 all-target: maybe-all-target-libstdc++-v3
 @endif target-libstdc++-v3-no-bootstrap
 all-target: maybe-all-target-libmudflap
+all-target: maybe-all-target-libasan
 all-target: maybe-all-target-libssp
 all-target: maybe-all-target-newlib
 @if target-libgcc-no-bootstrap
@@ -1152,6 +1158,7 @@ info-host: maybe-info-lto-plugin
 
 info-target: maybe-info-target-libstdc++-v3
 info-target: maybe-info-target-libmudflap
+info-target: maybe-info-target-libasan
 info-target: maybe-info-target-libssp
 info-target: maybe-info-target-newlib
 info-target: maybe-info-target-libgcc
@@ -1233,6 +1240,7 @@ dvi-host: maybe-dvi-lto-plugin
 
 dvi-target: maybe-dvi-target-libstdc++-v3
 dvi-target: maybe-dvi-target-libmudflap
+dvi-target: maybe-dvi-target-libasan
 dvi-target: maybe-dvi-target-libssp
 dvi-target: maybe-dvi-target-newlib
 dvi-target: maybe-dvi-target-libgcc
@@ -1314,6 +1322,7 @@ pdf-host: maybe-pdf-lto-plugin
 
 pdf-target: maybe-pdf-target-libstdc++-v3
 pdf-target: maybe-pdf-target-libmudflap
+pdf-target: maybe-pdf-target-libasan
 pdf-target: maybe-pdf-target-libssp
 pdf-target: maybe-pdf-target-newlib
 pdf-target: maybe-pdf-target-libgcc
@@ -1395,6 +1404,7 @@ html-host: maybe-html-lto-plugin
 
 html-target: maybe-html-target-libstdc++-v3
 html-target: maybe-html-target-libmudflap
+html-target: maybe-html-target-libasan
 html-target: maybe-html-target-libssp
 html-target: maybe-html-target-newlib
 html-target: maybe-html-target-libgcc
@@ -1476,6 +1486,7 @@ TAGS-host: maybe-TAGS-lto-plugin
 
 TAGS-target: maybe-TAGS-target-libstdc++-v3
 TAGS-target: maybe-TAGS-target-libmudflap
+TAGS-target: maybe-TAGS-target-libasan
 TAGS-target: maybe-TAGS-target-libssp
 TAGS-target: maybe-TAGS-target-newlib
 TAGS-target: maybe-TAGS-target-libgcc
@@ -1557,6 +1568,7 @@ install-info-host: maybe-install-info-lt
 
 install-info-target: maybe-install-info-target-libstdc++-v3
 install-info-target: maybe-install-info-target-libmudflap
+install-info-target: maybe-install-info-target-libasan
 install-info-target: maybe-install-info-target-libssp
 install-info-target: maybe-install-info-target-newlib
 install-info-target: maybe-install-info-target-libgcc
@@ -1638,6 +1650,7 @@ install-pdf-host: maybe-install-pdf-lto-
 
 install-pdf-target: maybe-install-pdf-target-libstdc++-v3
 install-pdf-target: maybe-install-pdf-target-libmudflap
+install-pdf-target: maybe-install-pdf-target-libasan
 install-pdf-target: maybe-install-pdf-target-libssp
 install-pdf-target: maybe-install-pdf-target-newlib
 install-pdf-target: maybe-install-pdf-target-libgcc
@@ -1719,6 +1732,7 @@ install-html-host: maybe-install-html-lt
 
 install-html-target: maybe-install-html-target-libstdc++-v3
 install-html-target: maybe-install-html-target-libmudflap
+install-html-target: maybe-install-html-target-libasan
 install-html-target: maybe-install-html-target-libssp
 install-html-target: maybe-install-html-target-newlib
 install-html-target: maybe-install-html-target-libgcc
@@ -1800,6 +1814,7 @@ installcheck-host: maybe-installcheck-lt
 
 installcheck-target: maybe-installcheck-target-libstdc++-v3
 installcheck-target: maybe-installcheck-target-libmudflap
+installcheck-target: maybe-installcheck-target-libasan
 installcheck-target: maybe-installcheck-target-libssp
 installcheck-target: maybe-installcheck-target-newlib
 installcheck-target: maybe-installcheck-target-libgcc
@@ -1881,6 +1896,7 @@ mostlyclean-host: maybe-mostlyclean-lto-
 
 mostlyclean-target: maybe-mostlyclean-target-libstdc++-v3
 mostlyclean-target: maybe-mostlyclean-target-libmudflap
+mostlyclean-target: maybe-mostlyclean-target-libasan
 mostlyclean-target: maybe-mostlyclean-target-libssp
 mostlyclean-target: maybe-mostlyclean-target-newlib
 mostlyclean-target: maybe-mostlyclean-target-libgcc
@@ -1962,6 +1978,7 @@ clean-host: maybe-clean-lto-plugin
 
 clean-target: maybe-clean-target-libstdc++-v3
 clean-target: maybe-clean-target-libmudflap
+clean-target: maybe-clean-target-libasan
 clean-target: maybe-clean-target-libssp
 clean-target: maybe-clean-target-newlib
 clean-target: maybe-clean-target-libgcc
@@ -2043,6 +2060,7 @@ distclean-host: maybe-distclean-lto-plug
 
 distclean-target: maybe-distclean-target-libstdc++-v3
 distclean-target: maybe-distclean-target-libmudflap
+distclean-target: maybe-distclean-target-libasan
 distclean-target: maybe-distclean-target-libssp
 distclean-target: maybe-distclean-target-newlib
 distclean-target: maybe-distclean-target-libgcc
@@ -2124,6 +2142,7 @@ maintainer-clean-host: maybe-maintainer-
 
 maintainer-clean-target: maybe-maintainer-clean-target-libstdc++-v3
 maintainer-clean-target: maybe-maintainer-clean-target-libmudflap
+maintainer-clean-target: maybe-maintainer-clean-target-libasan
 maintainer-clean-target: maybe-maintainer-clean-target-libssp
 maintainer-clean-target: maybe-maintainer-clean-target-newlib
 maintainer-clean-target: maybe-maintainer-clean-target-libgcc
@@ -2260,6 +2279,7 @@ check-host:  \
 check-target:  \
     maybe-check-target-libstdc++-v3 \
     maybe-check-target-libmudflap \
+    maybe-check-target-libasan \
     maybe-check-target-libssp \
     maybe-check-target-newlib \
     maybe-check-target-libgcc \
@@ -2414,6 +2434,7 @@ install-host:  \
 install-target:  \
     maybe-install-target-libstdc++-v3 \
     maybe-install-target-libmudflap \
+    maybe-install-target-libasan \
     maybe-install-target-libssp \
     maybe-install-target-newlib \
     maybe-install-target-libgcc \
@@ -2515,6 +2536,7 @@ install-strip-host:  \
 install-strip-target:  \
     maybe-install-strip-target-libstdc++-v3 \
     maybe-install-strip-target-libmudflap \
+    maybe-install-strip-target-libasan \
     maybe-install-strip-target-libssp \
     maybe-install-strip-target-newlib \
     maybe-install-strip-target-libgcc \
@@ -32337,6 +32359,463 @@ maintainer-clean-target-libmudflap:
 
 
 
+.PHONY: configure-target-libasan maybe-configure-target-libasan
+maybe-configure-target-libasan:
+@if gcc-bootstrap
+configure-target-libasan: stage_current
+@endif gcc-bootstrap
+@if target-libasan
+maybe-configure-target-libasan: configure-target-libasan
+configure-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libasan..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libasan ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libasan/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libasan/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libasan/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libasan/Makefile; \
+	    mv $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libasan/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libasan ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libasan; \
+	cd "$(TARGET_SUBDIR)/libasan" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libasan/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libasan"; \
+	libsrcdir="$$s/libasan"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libasan
+
+
+
+
+
+.PHONY: all-target-libasan maybe-all-target-libasan
+maybe-all-target-libasan:
+@if gcc-bootstrap
+all-target-libasan: stage_current
+@endif gcc-bootstrap
+@if target-libasan
+TARGET-target-libasan=all
+maybe-all-target-libasan: all-target-libasan
+all-target-libasan: configure-target-libasan
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+		$(TARGET-target-libasan))
+@endif target-libasan
+
+
+
+
+
+.PHONY: check-target-libasan maybe-check-target-libasan
+maybe-check-target-libasan:
+@if target-libasan
+maybe-check-target-libasan: check-target-libasan
+
+check-target-libasan:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libasan
+
+.PHONY: install-target-libasan maybe-install-target-libasan
+maybe-install-target-libasan:
+@if target-libasan
+maybe-install-target-libasan: install-target-libasan
+
+install-target-libasan: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libasan
+
+.PHONY: install-strip-target-libasan maybe-install-strip-target-libasan
+maybe-install-strip-target-libasan:
+@if target-libasan
+maybe-install-strip-target-libasan: install-strip-target-libasan
+
+install-strip-target-libasan: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libasan
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libasan info-target-libasan
+maybe-info-target-libasan:
+@if target-libasan
+maybe-info-target-libasan: info-target-libasan
+
+info-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-dvi-target-libasan dvi-target-libasan
+maybe-dvi-target-libasan:
+@if target-libasan
+maybe-dvi-target-libasan: dvi-target-libasan
+
+dvi-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-pdf-target-libasan pdf-target-libasan
+maybe-pdf-target-libasan:
+@if target-libasan
+maybe-pdf-target-libasan: pdf-target-libasan
+
+pdf-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-html-target-libasan html-target-libasan
+maybe-html-target-libasan:
+@if target-libasan
+maybe-html-target-libasan: html-target-libasan
+
+html-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-TAGS-target-libasan TAGS-target-libasan
+maybe-TAGS-target-libasan:
+@if target-libasan
+maybe-TAGS-target-libasan: TAGS-target-libasan
+
+TAGS-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-info-target-libasan install-info-target-libasan
+maybe-install-info-target-libasan:
+@if target-libasan
+maybe-install-info-target-libasan: install-info-target-libasan
+
+install-info-target-libasan: \
+    configure-target-libasan \
+    info-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-pdf-target-libasan install-pdf-target-libasan
+maybe-install-pdf-target-libasan:
+@if target-libasan
+maybe-install-pdf-target-libasan: install-pdf-target-libasan
+
+install-pdf-target-libasan: \
+    configure-target-libasan \
+    pdf-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-html-target-libasan install-html-target-libasan
+maybe-install-html-target-libasan:
+@if target-libasan
+maybe-install-html-target-libasan: install-html-target-libasan
+
+install-html-target-libasan: \
+    configure-target-libasan \
+    html-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-installcheck-target-libasan installcheck-target-libasan
+maybe-installcheck-target-libasan:
+@if target-libasan
+maybe-installcheck-target-libasan: installcheck-target-libasan
+
+installcheck-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-mostlyclean-target-libasan mostlyclean-target-libasan
+maybe-mostlyclean-target-libasan:
+@if target-libasan
+maybe-mostlyclean-target-libasan: mostlyclean-target-libasan
+
+mostlyclean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-clean-target-libasan clean-target-libasan
+maybe-clean-target-libasan:
+@if target-libasan
+maybe-clean-target-libasan: clean-target-libasan
+
+clean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-distclean-target-libasan distclean-target-libasan
+maybe-distclean-target-libasan:
+@if target-libasan
+maybe-distclean-target-libasan: distclean-target-libasan
+
+distclean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-maintainer-clean-target-libasan maintainer-clean-target-libasan
+maybe-maintainer-clean-target-libasan:
+@if target-libasan
+maybe-maintainer-clean-target-libasan: maintainer-clean-target-libasan
+
+maintainer-clean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libasan
+
+
+
+
+
 .PHONY: configure-target-libssp maybe-configure-target-libssp
 maybe-configure-target-libssp:
 @if gcc-bootstrap
@@ -44591,6 +45070,7 @@ configure-stage4-target-libstdc++-v3: ma
 configure-stageprofile-target-libstdc++-v3: maybe-all-stageprofile-gcc
 configure-stagefeedback-target-libstdc++-v3: maybe-all-stagefeedback-gcc
 configure-target-libmudflap: stage_last
+configure-target-libasan: stage_last
 configure-target-libssp: stage_last
 configure-target-newlib: stage_last
 configure-stage1-target-libgcc: maybe-all-stage1-gcc
@@ -44626,6 +45106,7 @@ configure-target-libatomic: stage_last
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-gcc
 configure-target-libmudflap: maybe-all-gcc
+configure-target-libasan: maybe-all-gcc
 configure-target-libssp: maybe-all-gcc
 configure-target-newlib: maybe-all-gcc
 configure-target-libgcc: maybe-all-gcc
@@ -45405,6 +45886,7 @@ configure-stagefeedback-target-libgomp:
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-target-libgcc
 configure-target-libmudflap: maybe-all-target-libgcc
+configure-target-libasan: maybe-all-target-libgcc
 configure-target-libssp: maybe-all-target-libgcc
 configure-target-newlib: maybe-all-target-libgcc
 configure-target-libbacktrace: maybe-all-target-libgcc
@@ -45431,6 +45913,8 @@ configure-target-libstdc++-v3: maybe-all
 
 configure-target-libmudflap: maybe-all-target-newlib maybe-all-target-libgloss
 
+configure-target-libasan: maybe-all-target-newlib maybe-all-target-libgloss
+
 configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss
 
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 192487)
+++ configure.ac	(working copy)
@@ -160,6 +160,7 @@ target_libraries="target-libgcc \
 		target-libitm \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libasan \
 		target-libssp \
 		target-libquadmath \
 		target-libgfortran \
Index: configure
===================================================================
--- configure	(revision 192487)
+++ configure	(working copy)
@@ -2725,6 +2725,7 @@ target_libraries="target-libgcc \
 		target-libitm \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libasan \
 		target-libssp \
 		target-libquadmath \
 		target-libgfortran \
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 192487)
+++ gcc/gcc.c	(working copy)
@@ -679,6 +679,7 @@ proper position among the other output f
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
+    %{fasan|coverage:-lasan -lpthread -ldl -lstdc++}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
     %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
 #endif
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 192487)
+++ Makefile.def	(working copy)
@@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
 		   lib_path=src/.libs;
 		   raw_cxx=true; };
 target_modules = { module= libmudflap; lib_path=.libs; };
+target_modules = { module= libasan; lib_path=.libs; };
 target_modules = { module= libssp; lib_path=.libs; };
 target_modules = { module= newlib; };
 target_modules = { module= libgcc; bootstrap=true; no_check=true; };

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16  6:45   ` Wei Mi
@ 2012-10-16  7:47     ` Andrew Pinski
  2012-10-16 15:27     ` Jakub Jelinek
  1 sibling, 0 replies; 31+ messages in thread
From: Andrew Pinski @ 2012-10-16  7:47 UTC (permalink / raw)
  To: Wei Mi; +Cc: gcc-patches, Diego Novillo, David Li

On Mon, Oct 15, 2012 at 11:39 PM, Wei Mi <wmi@google.com> wrote:
>>
>> This is a good start.  Can you send a patch out without including
>> libasan so at least the toplevel parts can be reviewed easier?
>> Also the changelog entry for gcc.c go under the gcc/ChangeLog rather
>> than the toplevel one.
>>
>> Thanks,
>> Andrew Pinski
>
> Sure, I attach it. Thanks for pointing out the changelog error.

+    %{fasan|coverage:-lasan -lpthread -ldl -lstdc++}\

Just curious, does asan runtime really require linking against pthread
and the standard C++ library?
Also I think the above will not work if shared libraries are disabled
as -lsupc++ is also needed when linking against the stdc++.

Also if libasan really depends on the C++ library, then most likely
you should a dependency in the toplevel makefile itself and maybe even
have the shared version of libasan link against libstdc++.

Thanks,
Andrew Pinski

>
> Thanks,
> Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16  6:45   ` Wei Mi
  2012-10-16  7:47     ` Andrew Pinski
@ 2012-10-16 15:27     ` Jakub Jelinek
  2012-10-18 17:00       ` Wei Mi
  2012-10-18 18:22       ` Xinliang David Li
  1 sibling, 2 replies; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-16 15:27 UTC (permalink / raw)
  To: Wei Mi; +Cc: Andrew Pinski, gcc-patches, Diego Novillo, David Li

On Mon, Oct 15, 2012 at 11:39:52PM -0700, Wei Mi wrote:
> --- gcc/gcc.c	(revision 192487)
> +++ gcc/gcc.c	(working copy)
> @@ -679,6 +679,7 @@ proper position among the other output f
>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>      %(mflib) " STACK_SPLIT_SPEC "\
>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
> +    %{fasan|coverage:-lasan -lpthread -ldl -lstdc++}\
>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"

Why the |coverage there?  It isn't related to asan in any way.
Also, why -lstdc++ in there?  I could understand %{static:-lstdc++}, but
given that libasan doesn't support static linking, I find it hardly useful.

> --- Makefile.def	(revision 192487)
> +++ Makefile.def	(working copy)
> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>  		   lib_path=src/.libs;
>  		   raw_cxx=true; };
>  target_modules = { module= libmudflap; lib_path=.libs; };
> +target_modules = { module= libasan; lib_path=.libs; };
>  target_modules = { module= libssp; lib_path=.libs; };
>  target_modules = { module= newlib; };
>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };

Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16 15:27     ` Jakub Jelinek
@ 2012-10-18 17:00       ` Wei Mi
  2012-10-18 18:28         ` Jakub Jelinek
  2012-10-18 18:22       ` Xinliang David Li
  1 sibling, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-18 17:00 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches, Diego Novillo, David Li

[-- Attachment #1: Type: text/plain, Size: 1954 bytes --]

Thanks for the comments. I create a dynamic linking libasan and update
the patch.

Thanks,
Wei.

ChangeLog:
2012-10-18   Wei Mi  <wmi@google.com>

migrate llvm runtime to asan branch
* configure.ac: Add libasan to target_libraries
* Makefile.def: Ditto
* configure: Regenerate
* Makefile.in: Regenerate
* libasan: New directory for asan runtime

gcc/ChangeLog:
2012-10-18   Wei Mi  <wmi@google.com>

link pthread and dynamic load library
* gcc/gcc.c: Add -lasan -lpthread -ldl to link command if -fasan is on

On Tue, Oct 16, 2012 at 12:27 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Oct 15, 2012 at 11:39:52PM -0700, Wei Mi wrote:
>> --- gcc/gcc.c (revision 192487)
>> +++ gcc/gcc.c (working copy)
>> @@ -679,6 +679,7 @@ proper position among the other output f
>>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>>      %(mflib) " STACK_SPLIT_SPEC "\
>>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
>> +    %{fasan|coverage:-lasan -lpthread -ldl -lstdc++}\
>>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
>
> Why the |coverage there?  It isn't related to asan in any way.
> Also, why -lstdc++ in there?  I could understand %{static:-lstdc++}, but
> given that libasan doesn't support static linking, I find it hardly useful.
>
>> --- Makefile.def      (revision 192487)
>> +++ Makefile.def      (working copy)
>> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>>                  lib_path=src/.libs;
>>                  raw_cxx=true; };
>>  target_modules = { module= libmudflap; lib_path=.libs; };
>> +target_modules = { module= libasan; lib_path=.libs; };
>>  target_modules = { module= libssp; lib_path=.libs; };
>>  target_modules = { module= newlib; };
>>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
>
> Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?
>
>         Jakub

[-- Attachment #2: patch.wo.libasan.txt --]
[-- Type: text/plain, Size: 26954 bytes --]

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 192567)
+++ Makefile.in	(working copy)
@@ -575,7 +575,7 @@ all:
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the target machine work.
-TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
+TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libasan)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
 
 @if target-libstdc++-v3
 TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
@@ -585,6 +585,10 @@ TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TAR
 TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs:
 @endif target-libmudflap
 
+@if target-libasan
+TARGET_LIB_PATH_libasan = $$r/$(TARGET_SUBDIR)/libasan/.libs:
+@endif target-libasan
+
 @if target-libssp
 TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
 @endif target-libssp
@@ -914,6 +918,7 @@ configure-host:  \
 configure-target:  \
     maybe-configure-target-libstdc++-v3 \
     maybe-configure-target-libmudflap \
+    maybe-configure-target-libasan \
     maybe-configure-target-libssp \
     maybe-configure-target-newlib \
     maybe-configure-target-libgcc \
@@ -1062,6 +1067,7 @@ all-host: maybe-all-lto-plugin
 all-target: maybe-all-target-libstdc++-v3
 @endif target-libstdc++-v3-no-bootstrap
 all-target: maybe-all-target-libmudflap
+all-target: maybe-all-target-libasan
 all-target: maybe-all-target-libssp
 all-target: maybe-all-target-newlib
 @if target-libgcc-no-bootstrap
@@ -1152,6 +1158,7 @@ info-host: maybe-info-lto-plugin
 
 info-target: maybe-info-target-libstdc++-v3
 info-target: maybe-info-target-libmudflap
+info-target: maybe-info-target-libasan
 info-target: maybe-info-target-libssp
 info-target: maybe-info-target-newlib
 info-target: maybe-info-target-libgcc
@@ -1233,6 +1240,7 @@ dvi-host: maybe-dvi-lto-plugin
 
 dvi-target: maybe-dvi-target-libstdc++-v3
 dvi-target: maybe-dvi-target-libmudflap
+dvi-target: maybe-dvi-target-libasan
 dvi-target: maybe-dvi-target-libssp
 dvi-target: maybe-dvi-target-newlib
 dvi-target: maybe-dvi-target-libgcc
@@ -1314,6 +1322,7 @@ pdf-host: maybe-pdf-lto-plugin
 
 pdf-target: maybe-pdf-target-libstdc++-v3
 pdf-target: maybe-pdf-target-libmudflap
+pdf-target: maybe-pdf-target-libasan
 pdf-target: maybe-pdf-target-libssp
 pdf-target: maybe-pdf-target-newlib
 pdf-target: maybe-pdf-target-libgcc
@@ -1395,6 +1404,7 @@ html-host: maybe-html-lto-plugin
 
 html-target: maybe-html-target-libstdc++-v3
 html-target: maybe-html-target-libmudflap
+html-target: maybe-html-target-libasan
 html-target: maybe-html-target-libssp
 html-target: maybe-html-target-newlib
 html-target: maybe-html-target-libgcc
@@ -1476,6 +1486,7 @@ TAGS-host: maybe-TAGS-lto-plugin
 
 TAGS-target: maybe-TAGS-target-libstdc++-v3
 TAGS-target: maybe-TAGS-target-libmudflap
+TAGS-target: maybe-TAGS-target-libasan
 TAGS-target: maybe-TAGS-target-libssp
 TAGS-target: maybe-TAGS-target-newlib
 TAGS-target: maybe-TAGS-target-libgcc
@@ -1557,6 +1568,7 @@ install-info-host: maybe-install-info-lt
 
 install-info-target: maybe-install-info-target-libstdc++-v3
 install-info-target: maybe-install-info-target-libmudflap
+install-info-target: maybe-install-info-target-libasan
 install-info-target: maybe-install-info-target-libssp
 install-info-target: maybe-install-info-target-newlib
 install-info-target: maybe-install-info-target-libgcc
@@ -1638,6 +1650,7 @@ install-pdf-host: maybe-install-pdf-lto-
 
 install-pdf-target: maybe-install-pdf-target-libstdc++-v3
 install-pdf-target: maybe-install-pdf-target-libmudflap
+install-pdf-target: maybe-install-pdf-target-libasan
 install-pdf-target: maybe-install-pdf-target-libssp
 install-pdf-target: maybe-install-pdf-target-newlib
 install-pdf-target: maybe-install-pdf-target-libgcc
@@ -1719,6 +1732,7 @@ install-html-host: maybe-install-html-lt
 
 install-html-target: maybe-install-html-target-libstdc++-v3
 install-html-target: maybe-install-html-target-libmudflap
+install-html-target: maybe-install-html-target-libasan
 install-html-target: maybe-install-html-target-libssp
 install-html-target: maybe-install-html-target-newlib
 install-html-target: maybe-install-html-target-libgcc
@@ -1800,6 +1814,7 @@ installcheck-host: maybe-installcheck-lt
 
 installcheck-target: maybe-installcheck-target-libstdc++-v3
 installcheck-target: maybe-installcheck-target-libmudflap
+installcheck-target: maybe-installcheck-target-libasan
 installcheck-target: maybe-installcheck-target-libssp
 installcheck-target: maybe-installcheck-target-newlib
 installcheck-target: maybe-installcheck-target-libgcc
@@ -1881,6 +1896,7 @@ mostlyclean-host: maybe-mostlyclean-lto-
 
 mostlyclean-target: maybe-mostlyclean-target-libstdc++-v3
 mostlyclean-target: maybe-mostlyclean-target-libmudflap
+mostlyclean-target: maybe-mostlyclean-target-libasan
 mostlyclean-target: maybe-mostlyclean-target-libssp
 mostlyclean-target: maybe-mostlyclean-target-newlib
 mostlyclean-target: maybe-mostlyclean-target-libgcc
@@ -1962,6 +1978,7 @@ clean-host: maybe-clean-lto-plugin
 
 clean-target: maybe-clean-target-libstdc++-v3
 clean-target: maybe-clean-target-libmudflap
+clean-target: maybe-clean-target-libasan
 clean-target: maybe-clean-target-libssp
 clean-target: maybe-clean-target-newlib
 clean-target: maybe-clean-target-libgcc
@@ -2043,6 +2060,7 @@ distclean-host: maybe-distclean-lto-plug
 
 distclean-target: maybe-distclean-target-libstdc++-v3
 distclean-target: maybe-distclean-target-libmudflap
+distclean-target: maybe-distclean-target-libasan
 distclean-target: maybe-distclean-target-libssp
 distclean-target: maybe-distclean-target-newlib
 distclean-target: maybe-distclean-target-libgcc
@@ -2124,6 +2142,7 @@ maintainer-clean-host: maybe-maintainer-
 
 maintainer-clean-target: maybe-maintainer-clean-target-libstdc++-v3
 maintainer-clean-target: maybe-maintainer-clean-target-libmudflap
+maintainer-clean-target: maybe-maintainer-clean-target-libasan
 maintainer-clean-target: maybe-maintainer-clean-target-libssp
 maintainer-clean-target: maybe-maintainer-clean-target-newlib
 maintainer-clean-target: maybe-maintainer-clean-target-libgcc
@@ -2260,6 +2279,7 @@ check-host:  \
 check-target:  \
     maybe-check-target-libstdc++-v3 \
     maybe-check-target-libmudflap \
+    maybe-check-target-libasan \
     maybe-check-target-libssp \
     maybe-check-target-newlib \
     maybe-check-target-libgcc \
@@ -2414,6 +2434,7 @@ install-host:  \
 install-target:  \
     maybe-install-target-libstdc++-v3 \
     maybe-install-target-libmudflap \
+    maybe-install-target-libasan \
     maybe-install-target-libssp \
     maybe-install-target-newlib \
     maybe-install-target-libgcc \
@@ -2515,6 +2536,7 @@ install-strip-host:  \
 install-strip-target:  \
     maybe-install-strip-target-libstdc++-v3 \
     maybe-install-strip-target-libmudflap \
+    maybe-install-strip-target-libasan \
     maybe-install-strip-target-libssp \
     maybe-install-strip-target-newlib \
     maybe-install-strip-target-libgcc \
@@ -32337,6 +32359,463 @@ maintainer-clean-target-libmudflap:
 
 
 
+.PHONY: configure-target-libasan maybe-configure-target-libasan
+maybe-configure-target-libasan:
+@if gcc-bootstrap
+configure-target-libasan: stage_current
+@endif gcc-bootstrap
+@if target-libasan
+maybe-configure-target-libasan: configure-target-libasan
+configure-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	echo "Checking multilib configuration for libasan..."; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libasan ; \
+	$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libasan/multilib.tmp 2> /dev/null ; \
+	if test -r $(TARGET_SUBDIR)/libasan/multilib.out; then \
+	  if cmp -s $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; then \
+	    rm -f $(TARGET_SUBDIR)/libasan/multilib.tmp; \
+	  else \
+	    rm -f $(TARGET_SUBDIR)/libasan/Makefile; \
+	    mv $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; \
+	  fi; \
+	else \
+	  mv $(TARGET_SUBDIR)/libasan/multilib.tmp $(TARGET_SUBDIR)/libasan/multilib.out; \
+	fi; \
+	test ! -f $(TARGET_SUBDIR)/libasan/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libasan ; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	echo Configuring in $(TARGET_SUBDIR)/libasan; \
+	cd "$(TARGET_SUBDIR)/libasan" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(TARGET_SUBDIR)/libasan/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libasan"; \
+	libsrcdir="$$s/libasan"; \
+	rm -f no-such-file || : ; \
+	CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
+	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif target-libasan
+
+
+
+
+
+.PHONY: all-target-libasan maybe-all-target-libasan
+maybe-all-target-libasan:
+@if gcc-bootstrap
+all-target-libasan: stage_current
+@endif gcc-bootstrap
+@if target-libasan
+TARGET-target-libasan=all
+maybe-all-target-libasan: all-target-libasan
+all-target-libasan: configure-target-libasan
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS)  \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)  \
+		$(TARGET-target-libasan))
+@endif target-libasan
+
+
+
+
+
+.PHONY: check-target-libasan maybe-check-target-libasan
+maybe-check-target-libasan:
+@if target-libasan
+maybe-check-target-libasan: check-target-libasan
+
+check-target-libasan:
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
+
+@endif target-libasan
+
+.PHONY: install-target-libasan maybe-install-target-libasan
+maybe-install-target-libasan:
+@if target-libasan
+maybe-install-target-libasan: install-target-libasan
+
+install-target-libasan: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+
+@endif target-libasan
+
+.PHONY: install-strip-target-libasan maybe-install-strip-target-libasan
+maybe-install-strip-target-libasan:
+@if target-libasan
+maybe-install-strip-target-libasan: install-strip-target-libasan
+
+install-strip-target-libasan: installdirs
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install-strip)
+
+@endif target-libasan
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-target-libasan info-target-libasan
+maybe-info-target-libasan:
+@if target-libasan
+maybe-info-target-libasan: info-target-libasan
+
+info-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing info in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           info) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-dvi-target-libasan dvi-target-libasan
+maybe-dvi-target-libasan:
+@if target-libasan
+maybe-dvi-target-libasan: dvi-target-libasan
+
+dvi-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing dvi in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           dvi) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-pdf-target-libasan pdf-target-libasan
+maybe-pdf-target-libasan:
+@if target-libasan
+maybe-pdf-target-libasan: pdf-target-libasan
+
+pdf-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing pdf in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           pdf) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-html-target-libasan html-target-libasan
+maybe-html-target-libasan:
+@if target-libasan
+maybe-html-target-libasan: html-target-libasan
+
+html-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing html in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           html) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-TAGS-target-libasan TAGS-target-libasan
+maybe-TAGS-target-libasan:
+@if target-libasan
+maybe-TAGS-target-libasan: TAGS-target-libasan
+
+TAGS-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing TAGS in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           TAGS) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-info-target-libasan install-info-target-libasan
+maybe-install-info-target-libasan:
+@if target-libasan
+maybe-install-info-target-libasan: install-info-target-libasan
+
+install-info-target-libasan: \
+    configure-target-libasan \
+    info-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-info in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-info) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-pdf-target-libasan install-pdf-target-libasan
+maybe-install-pdf-target-libasan:
+@if target-libasan
+maybe-install-pdf-target-libasan: install-pdf-target-libasan
+
+install-pdf-target-libasan: \
+    configure-target-libasan \
+    pdf-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-pdf in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-pdf) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-install-html-target-libasan install-html-target-libasan
+maybe-install-html-target-libasan:
+@if target-libasan
+maybe-install-html-target-libasan: install-html-target-libasan
+
+install-html-target-libasan: \
+    configure-target-libasan \
+    html-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing install-html in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           install-html) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-installcheck-target-libasan installcheck-target-libasan
+maybe-installcheck-target-libasan:
+@if target-libasan
+maybe-installcheck-target-libasan: installcheck-target-libasan
+
+installcheck-target-libasan: \
+    configure-target-libasan 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing installcheck in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           installcheck) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-mostlyclean-target-libasan mostlyclean-target-libasan
+maybe-mostlyclean-target-libasan:
+@if target-libasan
+maybe-mostlyclean-target-libasan: mostlyclean-target-libasan
+
+mostlyclean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing mostlyclean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           mostlyclean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-clean-target-libasan clean-target-libasan
+maybe-clean-target-libasan:
+@if target-libasan
+maybe-clean-target-libasan: clean-target-libasan
+
+clean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing clean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           clean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-distclean-target-libasan distclean-target-libasan
+maybe-distclean-target-libasan:
+@if target-libasan
+maybe-distclean-target-libasan: distclean-target-libasan
+
+distclean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing distclean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           distclean) \
+	  || exit 1
+
+@endif target-libasan
+
+.PHONY: maybe-maintainer-clean-target-libasan maintainer-clean-target-libasan
+maybe-maintainer-clean-target-libasan:
+@if target-libasan
+maybe-maintainer-clean-target-libasan: maintainer-clean-target-libasan
+
+maintainer-clean-target-libasan: 
+	@: $(MAKE); $(unstage)
+	@[ -f $(TARGET_SUBDIR)/libasan/Makefile ] || exit 0 ; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(NORMAL_TARGET_EXPORTS) \
+	echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libasan" ; \
+	for flag in $(EXTRA_TARGET_FLAGS); do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	(cd $(TARGET_SUBDIR)/libasan && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	           maintainer-clean) \
+	  || exit 1
+
+@endif target-libasan
+
+
+
+
+
 .PHONY: configure-target-libssp maybe-configure-target-libssp
 maybe-configure-target-libssp:
 @if gcc-bootstrap
@@ -44591,6 +45070,7 @@ configure-stage4-target-libstdc++-v3: ma
 configure-stageprofile-target-libstdc++-v3: maybe-all-stageprofile-gcc
 configure-stagefeedback-target-libstdc++-v3: maybe-all-stagefeedback-gcc
 configure-target-libmudflap: stage_last
+configure-target-libasan: stage_last
 configure-target-libssp: stage_last
 configure-target-newlib: stage_last
 configure-stage1-target-libgcc: maybe-all-stage1-gcc
@@ -44626,6 +45106,7 @@ configure-target-libatomic: stage_last
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-gcc
 configure-target-libmudflap: maybe-all-gcc
+configure-target-libasan: maybe-all-gcc
 configure-target-libssp: maybe-all-gcc
 configure-target-newlib: maybe-all-gcc
 configure-target-libgcc: maybe-all-gcc
@@ -45405,6 +45886,7 @@ configure-stagefeedback-target-libgomp:
 @if gcc-no-bootstrap
 configure-target-libstdc++-v3: maybe-all-target-libgcc
 configure-target-libmudflap: maybe-all-target-libgcc
+configure-target-libasan: maybe-all-target-libgcc
 configure-target-libssp: maybe-all-target-libgcc
 configure-target-newlib: maybe-all-target-libgcc
 configure-target-libbacktrace: maybe-all-target-libgcc
@@ -45431,6 +45913,8 @@ configure-target-libstdc++-v3: maybe-all
 
 configure-target-libmudflap: maybe-all-target-newlib maybe-all-target-libgloss
 
+configure-target-libasan: maybe-all-target-newlib maybe-all-target-libgloss
+
 configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss
 
 
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 192567)
+++ Makefile.def	(working copy)
@@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
 		   lib_path=src/.libs;
 		   raw_cxx=true; };
 target_modules = { module= libmudflap; lib_path=.libs; };
+target_modules = { module= libasan; lib_path=.libs; };
 target_modules = { module= libssp; lib_path=.libs; };
 target_modules = { module= newlib; };
 target_modules = { module= libgcc; bootstrap=true; no_check=true; };
Index: configure
===================================================================
--- configure	(revision 192567)
+++ configure	(working copy)
@@ -2725,6 +2725,7 @@ target_libraries="target-libgcc \
 		target-libitm \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libasan \
 		target-libssp \
 		target-libquadmath \
 		target-libgfortran \
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 192567)
+++ gcc/gcc.c	(working copy)
@@ -679,6 +679,7 @@ proper position among the other output f
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
+    %{fasan:-lasan -lpthread -ldl}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
     %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
 #endif
Index: configure.ac
===================================================================
--- configure.ac	(revision 192567)
+++ configure.ac	(working copy)
@@ -160,6 +160,7 @@ target_libraries="target-libgcc \
 		target-libitm \
 		target-libstdc++-v3 \
 		target-libmudflap \
+		target-libasan \
 		target-libssp \
 		target-libquadmath \
 		target-libgfortran \

[-- Attachment #3: patch.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 190184 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-16 15:27     ` Jakub Jelinek
  2012-10-18 17:00       ` Wei Mi
@ 2012-10-18 18:22       ` Xinliang David Li
  2012-10-18 18:32         ` Jakub Jelinek
  1 sibling, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-18 18:22 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Tue, Oct 16, 2012 at 12:27 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Oct 15, 2012 at 11:39:52PM -0700, Wei Mi wrote:
>> --- gcc/gcc.c (revision 192487)
>> +++ gcc/gcc.c (working copy)
>> @@ -679,6 +679,7 @@ proper position among the other output f
>>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>>      %(mflib) " STACK_SPLIT_SPEC "\
>>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
>> +    %{fasan|coverage:-lasan -lpthread -ldl -lstdc++}\
>>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
>
> Why the |coverage there?  It isn't related to asan in any way.
> Also, why -lstdc++ in there?  I could understand %{static:-lstdc++}, but
> given that libasan doesn't support static linking, I find it hardly useful.
>
>> --- Makefile.def      (revision 192487)
>> +++ Makefile.def      (working copy)
>> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>>                  lib_path=src/.libs;
>>                  raw_cxx=true; };
>>  target_modules = { module= libmudflap; lib_path=.libs; };
>> +target_modules = { module= libasan; lib_path=.libs; };
>>  target_modules = { module= libssp; lib_path=.libs; };
>>  target_modules = { module= newlib; };
>>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
>
> Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?
>

I don't think it should depend on any C++ libraries.  libasan is
written in C++, but I don't see any C++ features that require C++
runtime support (libstdc++, libcsup++) are used -- otherwise the
archive libasan can not be used with C program.


David


>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 17:00       ` Wei Mi
@ 2012-10-18 18:28         ` Jakub Jelinek
  2012-10-18 20:25           ` Wei Mi
  0 siblings, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-18 18:28 UTC (permalink / raw)
  To: Wei Mi; +Cc: Andrew Pinski, gcc-patches, Diego Novillo, David Li

On Thu, Oct 18, 2012 at 09:46:36AM -0700, Wei Mi wrote:
> --- gcc/gcc.c	(revision 192567)
> +++ gcc/gcc.c	(working copy)
> @@ -679,6 +679,7 @@ proper position among the other output f
>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>      %(mflib) " STACK_SPLIT_SPEC "\
>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
> +    %{fasan:-lasan -lpthread -ldl}\
>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
>  #endif

Sorry for not mentioning it earlier at once, but -lpthread -ldl shouldn't
be there either, the -fasan compiled code makes no direct calls to
-lpthread nor -ldl, just libasan.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 18:22       ` Xinliang David Li
@ 2012-10-18 18:32         ` Jakub Jelinek
  2012-10-18 19:29           ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-18 18:32 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 18, 2012 at 11:15:33AM -0700, Xinliang David Li wrote:
> >> --- Makefile.def      (revision 192487)
> >> +++ Makefile.def      (working copy)
> >> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
> >>                  lib_path=src/.libs;
> >>                  raw_cxx=true; };
> >>  target_modules = { module= libmudflap; lib_path=.libs; };
> >> +target_modules = { module= libasan; lib_path=.libs; };
> >>  target_modules = { module= libssp; lib_path=.libs; };
> >>  target_modules = { module= newlib; };
> >>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
> >
> > Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?
> >
> 
> I don't think it should depend on any C++ libraries.  libasan is
> written in C++, but I don't see any C++ features that require C++
> runtime support (libstdc++, libcsup++) are used -- otherwise the
> archive libasan can not be used with C program.

Is it compiled with -fno-exceptions -fno-rtti?  Without it it would
require either libstdc++ or libsupc++.  I see it uses at least
#include <new>, so even if it doesn't link against libstdc++, it needs
its headers being setup and thus need to depend at the toplevel
on libstdc++ being built (and likely needs to use
`$(...)/libstdc++-v3/scripts/testsuite_flags --build-includes`
) when compiling.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 18:32         ` Jakub Jelinek
@ 2012-10-18 19:29           ` Xinliang David Li
  2012-10-18 19:45             ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-18 19:29 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 18, 2012 at 11:22 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 18, 2012 at 11:15:33AM -0700, Xinliang David Li wrote:
>> >> --- Makefile.def      (revision 192487)
>> >> +++ Makefile.def      (working copy)
>> >> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>> >>                  lib_path=src/.libs;
>> >>                  raw_cxx=true; };
>> >>  target_modules = { module= libmudflap; lib_path=.libs; };
>> >> +target_modules = { module= libasan; lib_path=.libs; };
>> >>  target_modules = { module= libssp; lib_path=.libs; };
>> >>  target_modules = { module= newlib; };
>> >>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
>> >
>> > Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?
>> >
>>
>> I don't think it should depend on any C++ libraries.  libasan is
>> written in C++, but I don't see any C++ features that require C++
>> runtime support (libstdc++, libcsup++) are used -- otherwise the
>> archive libasan can not be used with C program.
>
> Is it compiled with -fno-exceptions -fno-rtti?  Without it it would
> require either libstdc++ or libsupc++.  I see it uses at least
> #include <new>, so even if it doesn't link against libstdc++, it needs
> its headers being setup and thus need to depend at the toplevel
> on libstdc++ being built (and likely needs to use
> `$(...)/libstdc++-v3/scripts/testsuite_flags --build-includes`
> ) when compiling.

I looked at the library built with LLVM -- it does not reference any
exception handling routines, nor operator new, rtti related routines.

I am not sure if the inclusion of <new> is needed -- it is used in
asan_new_delete.cc which defines replacement for global new and
delete, I think.

David

>
>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 19:29           ` Xinliang David Li
@ 2012-10-18 19:45             ` Xinliang David Li
       [not found]               ` <CAN=P9piGAbcEmLLVF+77jJvOHAh3dFpEWMgrYqAHqKynrfFNeQ@mail.gmail.com>
  0 siblings, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-18 19:45 UTC (permalink / raw)
  To: Jakub Jelinek, Kostya Serebryany
  Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

+ kcc the author of the libasan library.

Koystya, does libasan build (need to ) depend on C++ library ?

thanks,

David

On Thu, Oct 18, 2012 at 12:26 PM, Xinliang David Li <davidxl@google.com> wrote:
> On Thu, Oct 18, 2012 at 11:22 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Oct 18, 2012 at 11:15:33AM -0700, Xinliang David Li wrote:
>>> >> --- Makefile.def      (revision 192487)
>>> >> +++ Makefile.def      (working copy)
>>> >> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>>> >>                  lib_path=src/.libs;
>>> >>                  raw_cxx=true; };
>>> >>  target_modules = { module= libmudflap; lib_path=.libs; };
>>> >> +target_modules = { module= libasan; lib_path=.libs; };
>>> >>  target_modules = { module= libssp; lib_path=.libs; };
>>> >>  target_modules = { module= newlib; };
>>> >>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
>>> >
>>> > Shouldn't libasan, given it is a C++ shared library, depend on libstdc++-v3?
>>> >
>>>
>>> I don't think it should depend on any C++ libraries.  libasan is
>>> written in C++, but I don't see any C++ features that require C++
>>> runtime support (libstdc++, libcsup++) are used -- otherwise the
>>> archive libasan can not be used with C program.
>>
>> Is it compiled with -fno-exceptions -fno-rtti?  Without it it would
>> require either libstdc++ or libsupc++.  I see it uses at least
>> #include <new>, so even if it doesn't link against libstdc++, it needs
>> its headers being setup and thus need to depend at the toplevel
>> on libstdc++ being built (and likely needs to use
>> `$(...)/libstdc++-v3/scripts/testsuite_flags --build-includes`
>> ) when compiling.
>
> I looked at the library built with LLVM -- it does not reference any
> exception handling routines, nor operator new, rtti related routines.
>
> I am not sure if the inclusion of <new> is needed -- it is used in
> asan_new_delete.cc which defines replacement for global new and
> delete, I think.
>
> David
>
>>
>>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 18:28         ` Jakub Jelinek
@ 2012-10-18 20:25           ` Wei Mi
  2012-10-19  3:49             ` Wei Mi
  0 siblings, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-18 20:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches, Diego Novillo, David Li

On Thu, Oct 18, 2012 at 11:16 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 18, 2012 at 09:46:36AM -0700, Wei Mi wrote:
>> --- gcc/gcc.c (revision 192567)
>> +++ gcc/gcc.c (working copy)
>> @@ -679,6 +679,7 @@ proper position among the other output f
>>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>>      %(mflib) " STACK_SPLIT_SPEC "\
>>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
>> +    %{fasan:-lasan -lpthread -ldl}\
>>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
>>  #endif
>
> Sorry for not mentioning it earlier at once, but -lpthread -ldl shouldn't
> be there either, the -fasan compiled code makes no direct calls to
> -lpthread nor -ldl, just libasan.
>
>         Jakub

Thanks, I move those options to libasan LDFLAGS.

Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-18 20:25           ` Wei Mi
@ 2012-10-19  3:49             ` Wei Mi
  2012-10-19 17:43               ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-19  3:49 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches, Diego Novillo, David Li

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Hi,

David cought a problem in the last patch when he tries to built
libasan. The problem was that an incomplete libtool under libasan
build directory was generated. The cause is that the old patch used an
old ltmain.sh to generate libtool. I fix it and attach a new patch.
And the new patch move -lpthread and -ldl to libasan LDFLAGS.

Thanks,
Wei.

[-- Attachment #2: patch.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 284555 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
       [not found]               ` <CAN=P9piGAbcEmLLVF+77jJvOHAh3dFpEWMgrYqAHqKynrfFNeQ@mail.gmail.com>
@ 2012-10-19  5:14                 ` Xinliang David Li
  0 siblings, 0 replies; 31+ messages in thread
From: Xinliang David Li @ 2012-10-19  5:14 UTC (permalink / raw)
  To: Kostya Serebryany
  Cc: Jakub Jelinek, Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo,
	Alexander Potapenko, Evgeniy Stepanov, Alexey Samsonov

thanks.  If libasan is statically linked in (which is the case for
clang), removing the dependency on libstdc++ is a must.

David

On Thu, Oct 18, 2012 at 9:05 PM, Kostya Serebryany <kcc@google.com> wrote:
> +few more folks
>
> libasan does not (and should not) depend on libstdc++-v3.
> In llvm build system it is built with
>   -fPIC
>   -fno-builtin
>   -fno-exceptions
>   -fomit-frame-pointer
>   -funwind-tables
>   -O3
> (I guess we can add -fno-rtti too, but we did not need it).
>
> the file asan_new_delete.cc indeed depends on <new>, but I think we can
> eliminate this include completely
> (we've just discussed this yesterday).
>
>
> --kcc
>
> On Thu, Oct 18, 2012 at 11:29 PM, Xinliang David Li <davidxl@google.com>
> wrote:
>>
>> + kcc the author of the libasan library.
>>
>> Koystya, does libasan build (need to ) depend on C++ library ?
>>
>> thanks,
>>
>> David
>>
>> On Thu, Oct 18, 2012 at 12:26 PM, Xinliang David Li <davidxl@google.com>
>> wrote:
>> > On Thu, Oct 18, 2012 at 11:22 AM, Jakub Jelinek <jakub@redhat.com>
>> > wrote:
>> >> On Thu, Oct 18, 2012 at 11:15:33AM -0700, Xinliang David Li wrote:
>> >>> >> --- Makefile.def      (revision 192487)
>> >>> >> +++ Makefile.def      (working copy)
>> >>> >> @@ -119,6 +119,7 @@ target_modules = { module= libstdc++-v3;
>> >>> >>                  lib_path=src/.libs;
>> >>> >>                  raw_cxx=true; };
>> >>> >>  target_modules = { module= libmudflap; lib_path=.libs; };
>> >>> >> +target_modules = { module= libasan; lib_path=.libs; };
>> >>> >>  target_modules = { module= libssp; lib_path=.libs; };
>> >>> >>  target_modules = { module= newlib; };
>> >>> >>  target_modules = { module= libgcc; bootstrap=true; no_check=true;
>> >>> >> };
>> >>> >
>> >>> > Shouldn't libasan, given it is a C++ shared library, depend on
>> >>> > libstdc++-v3?
>> >>> >
>> >>>
>> >>> I don't think it should depend on any C++ libraries.  libasan is
>> >>> written in C++, but I don't see any C++ features that require C++
>> >>> runtime support (libstdc++, libcsup++) are used -- otherwise the
>> >>> archive libasan can not be used with C program.
>> >>
>> >> Is it compiled with -fno-exceptions -fno-rtti?  Without it it would
>> >> require either libstdc++ or libsupc++.  I see it uses at least
>> >> #include <new>, so even if it doesn't link against libstdc++, it needs
>> >> its headers being setup and thus need to depend at the toplevel
>> >> on libstdc++ being built (and likely needs to use
>> >> `$(...)/libstdc++-v3/scripts/testsuite_flags --build-includes`
>> >> ) when compiling.
>> >
>> > I looked at the library built with LLVM -- it does not reference any
>> > exception handling routines, nor operator new, rtti related routines.
>> >
>> > I am not sure if the inclusion of <new> is needed -- it is used in
>> > asan_new_delete.cc which defines replacement for global new and
>> > delete, I think.
>> >
>> > David
>> >
>> >>
>> >>         Jakub
>
>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19  3:49             ` Wei Mi
@ 2012-10-19 17:43               ` Xinliang David Li
  2012-10-19 18:52                 ` Diego Novillo
  2012-10-19 19:02                 ` Wei Mi
  0 siblings, 2 replies; 31+ messages in thread
From: Xinliang David Li @ 2012-10-19 17:43 UTC (permalink / raw)
  To: Wei Mi; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

I tried it, and this version works for me.

Your probably do not need to add the m4 subdir under libasan.  The
required m4 files are either in .. or ../config dir. See how
libmudflap does it.

Other than that, if there are no other comments, the change is good to
check into the branch. Remaining bugs can always be found and fixed
later.

thanks,

David



On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
> Hi,
>
> David cought a problem in the last patch when he tries to built
> libasan. The problem was that an incomplete libtool under libasan
> build directory was generated. The cause is that the old patch used an
> old ltmain.sh to generate libtool. I fix it and attach a new patch.
> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>
> Thanks,
> Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19 17:43               ` Xinliang David Li
@ 2012-10-19 18:52                 ` Diego Novillo
  2012-10-19 19:02                 ` Wei Mi
  1 sibling, 0 replies; 31+ messages in thread
From: Diego Novillo @ 2012-10-19 18:52 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Jakub Jelinek, Andrew Pinski, gcc-patches

On 2012-10-19 13:16 , Xinliang David Li wrote:

> Other than that, if there are no other comments, the change is good to
> check into the branch. Remaining bugs can always be found and fixed
> later.

Agreed.  David, could you commit the patch after Wei has addressed your 
feedback?  I have just committed a merge from trunk.

Once the runtime is in, please test patches against it.  We still don't 
have dejagnu glue, so testing will need to be manual at first.


Diego.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19 17:43               ` Xinliang David Li
  2012-10-19 18:52                 ` Diego Novillo
@ 2012-10-19 19:02                 ` Wei Mi
  2012-10-19 20:28                   ` Xinliang David Li
  1 sibling, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-19 19:02 UTC (permalink / raw)
  To: Xinliang David Li
  Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

David, I put the m4 subdir under libasan because once I use the .m4
files (libtool.m4  lt~obsolete.m4  ltoptions.m4  ltsugar.m4
ltversion.m4) and ltmain.sh under $topsrcdir, the problem that a bad
libtool was generated under
$topbuilddir/x86_64-unknown-linux-gnu/libasan you met yesterday
appeared.  That is why I had to generate the new libtool m4 files and
ltmain.sh using libtoolize.

Thanks,
Wei.

On Fri, Oct 19, 2012 at 10:16 AM, Xinliang David Li <davidxl@google.com> wrote:
> I tried it, and this version works for me.
>
> Your probably do not need to add the m4 subdir under libasan.  The
> required m4 files are either in .. or ../config dir. See how
> libmudflap does it.
>
> Other than that, if there are no other comments, the change is good to
> check into the branch. Remaining bugs can always be found and fixed
> later.
>
> thanks,
>
> David
>
>
>
> On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
>> Hi,
>>
>> David cought a problem in the last patch when he tries to built
>> libasan. The problem was that an incomplete libtool under libasan
>> build directory was generated. The cause is that the old patch used an
>> old ltmain.sh to generate libtool. I fix it and attach a new patch.
>> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>>
>> Thanks,
>> Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19 19:02                 ` Wei Mi
@ 2012-10-19 20:28                   ` Xinliang David Li
  2012-10-19 20:41                     ` Diego Novillo
  2012-10-20  2:08                     ` Wei Mi
  0 siblings, 2 replies; 31+ messages in thread
From: Xinliang David Li @ 2012-10-19 20:28 UTC (permalink / raw)
  To: Wei Mi; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

The library builds fine with the following diff. The file acinclude.m4
is cloned from libmudflap.

David

index 485d169..3e847f1 100644
--- a/libasan/aclocal.m4
+++ b/libasan/aclocal.m4
@@ -1037,8 +1037,8 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR

-m4_include([m4/libtool.m4])
-m4_include([m4/ltoptions.m4])
-m4_include([m4/ltsugar.m4])
-m4_include([m4/ltversion.m4])
-m4_include([m4/lt~obsolete.m4])
+m4_include([../config/ltoptions.m4])
+m4_include([../config/ltsugar.m4])
+m4_include([../config/ltversion.m4])
+#m4_include([../config/lt~obsolete.m4])
+m4_include([acinclude.m4])


On Fri, Oct 19, 2012 at 11:02 AM, Wei Mi <wmi@google.com> wrote:
> David, I put the m4 subdir under libasan because once I use the .m4
> files (libtool.m4  lt~obsolete.m4  ltoptions.m4  ltsugar.m4
> ltversion.m4) and ltmain.sh under $topsrcdir, the problem that a bad
> libtool was generated under
> $topbuilddir/x86_64-unknown-linux-gnu/libasan you met yesterday
> appeared.  That is why I had to generate the new libtool m4 files and
> ltmain.sh using libtoolize.
>
> Thanks,
> Wei.
>
> On Fri, Oct 19, 2012 at 10:16 AM, Xinliang David Li <davidxl@google.com> wrote:
>> I tried it, and this version works for me.
>>
>> Your probably do not need to add the m4 subdir under libasan.  The
>> required m4 files are either in .. or ../config dir. See how
>> libmudflap does it.
>>
>> Other than that, if there are no other comments, the change is good to
>> check into the branch. Remaining bugs can always be found and fixed
>> later.
>>
>> thanks,
>>
>> David
>>
>>
>>
>> On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
>>> Hi,
>>>
>>> David cought a problem in the last patch when he tries to built
>>> libasan. The problem was that an incomplete libtool under libasan
>>> build directory was generated. The cause is that the old patch used an
>>> old ltmain.sh to generate libtool. I fix it and attach a new patch.
>>> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>>>
>>> Thanks,
>>> Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19 20:28                   ` Xinliang David Li
@ 2012-10-19 20:41                     ` Diego Novillo
  2012-10-20  2:08                     ` Wei Mi
  1 sibling, 0 replies; 31+ messages in thread
From: Diego Novillo @ 2012-10-19 20:41 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Jakub Jelinek, Andrew Pinski, gcc-patches

On Fri, Oct 19, 2012 at 3:52 PM, Xinliang David Li <davidxl@google.com> wrote:
> The library builds fine with the following diff. The file acinclude.m4
> is cloned from libmudflap.

This is OK with the corresponding ChangeLog entry (in ChangeLog.asan).


Diego.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-19 20:28                   ` Xinliang David Li
  2012-10-19 20:41                     ` Diego Novillo
@ 2012-10-20  2:08                     ` Wei Mi
  2012-10-20  2:33                       ` Wei Mi
  1 sibling, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-20  2:08 UTC (permalink / raw)
  To: Xinliang David Li
  Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 3214 bytes --]

Thanks David. Here is the patch after removing m4 directory under libasan.
And I add the dependence libasan on libstdc++-v3 to avoid problem
under parallel making for now.

The patch is too big even after compressed, so I have to split the
patch into two parts contained in two mails. patch.part1.txt and
patch.part2.txt. This is the first part.

--- a/Makefile.def      2012-10-19 15:36:36.156106282 -0700
+++ b/Makefile.def      2012-10-19 15:36:51.656186869 -0700
@@ -504,7 +504,6 @@
 dependencies = { module=configure-target-libobjc;
on=configure-target-boehm-gc; };
 dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
 dependencies = { module=configure-target-libstdc++-v3;
on=configure-target-libgomp; };
+dependencies = { module=configure-target-libasan;
on=all-target-libstdc++-v3; };
 // parallel_list.o and parallel_settings.o depend on omp.h, which is
 // generated by the libgomp configure.  Unfortunately, due to the use of
 //  recursive make, we can't be that specific.

Thanks,
Wei.

On Fri, Oct 19, 2012 at 12:52 PM, Xinliang David Li <davidxl@google.com> wrote:
> The library builds fine with the following diff. The file acinclude.m4
> is cloned from libmudflap.
>
> David
>
> index 485d169..3e847f1 100644
> --- a/libasan/aclocal.m4
> +++ b/libasan/aclocal.m4
> @@ -1037,8 +1037,8 @@ AC_SUBST([am__tar])
>  AC_SUBST([am__untar])
>  ]) # _AM_PROG_TAR
>
> -m4_include([m4/libtool.m4])
> -m4_include([m4/ltoptions.m4])
> -m4_include([m4/ltsugar.m4])
> -m4_include([m4/ltversion.m4])
> -m4_include([m4/lt~obsolete.m4])
> +m4_include([../config/ltoptions.m4])
> +m4_include([../config/ltsugar.m4])
> +m4_include([../config/ltversion.m4])
> +#m4_include([../config/lt~obsolete.m4])
> +m4_include([acinclude.m4])
>
>
> On Fri, Oct 19, 2012 at 11:02 AM, Wei Mi <wmi@google.com> wrote:
>> David, I put the m4 subdir under libasan because once I use the .m4
>> files (libtool.m4  lt~obsolete.m4  ltoptions.m4  ltsugar.m4
>> ltversion.m4) and ltmain.sh under $topsrcdir, the problem that a bad
>> libtool was generated under
>> $topbuilddir/x86_64-unknown-linux-gnu/libasan you met yesterday
>> appeared.  That is why I had to generate the new libtool m4 files and
>> ltmain.sh using libtoolize.
>>
>> Thanks,
>> Wei.
>>
>> On Fri, Oct 19, 2012 at 10:16 AM, Xinliang David Li <davidxl@google.com> wrote:
>>> I tried it, and this version works for me.
>>>
>>> Your probably do not need to add the m4 subdir under libasan.  The
>>> required m4 files are either in .. or ../config dir. See how
>>> libmudflap does it.
>>>
>>> Other than that, if there are no other comments, the change is good to
>>> check into the branch. Remaining bugs can always be found and fixed
>>> later.
>>>
>>> thanks,
>>>
>>> David
>>>
>>>
>>>
>>> On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
>>>> Hi,
>>>>
>>>> David cought a problem in the last patch when he tries to built
>>>> libasan. The problem was that an incomplete libtool under libasan
>>>> build directory was generated. The cause is that the old patch used an
>>>> old ltmain.sh to generate libtool. I fix it and attach a new patch.
>>>> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>>>>
>>>> Thanks,
>>>> Wei.

[-- Attachment #2: patch.part1.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 163661 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-20  2:08                     ` Wei Mi
@ 2012-10-20  2:33                       ` Wei Mi
  2012-10-25 16:49                         ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Wei Mi @ 2012-10-20  2:33 UTC (permalink / raw)
  To: Xinliang David Li
  Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 3434 bytes --]

And this is the second part.

Thanks,
Wei.

On Fri, Oct 19, 2012 at 6:41 PM, Wei Mi <wmi@google.com> wrote:
> Thanks David. Here is the patch after removing m4 directory under libasan.
> And I add the dependence libasan on libstdc++-v3 to avoid problem
> under parallel making for now.
>
> The patch is too big even after compressed, so I have to split the
> patch into two parts contained in two mails. patch.part1.txt and
> patch.part2.txt. This is the first part.
>
> --- a/Makefile.def      2012-10-19 15:36:36.156106282 -0700
> +++ b/Makefile.def      2012-10-19 15:36:51.656186869 -0700
> @@ -504,7 +504,6 @@
>  dependencies = { module=configure-target-libobjc;
> on=configure-target-boehm-gc; };
>  dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
>  dependencies = { module=configure-target-libstdc++-v3;
> on=configure-target-libgomp; };
> +dependencies = { module=configure-target-libasan;
> on=all-target-libstdc++-v3; };
>  // parallel_list.o and parallel_settings.o depend on omp.h, which is
>  // generated by the libgomp configure.  Unfortunately, due to the use of
>  //  recursive make, we can't be that specific.
>
> Thanks,
> Wei.
>
> On Fri, Oct 19, 2012 at 12:52 PM, Xinliang David Li <davidxl@google.com> wrote:
>> The library builds fine with the following diff. The file acinclude.m4
>> is cloned from libmudflap.
>>
>> David
>>
>> index 485d169..3e847f1 100644
>> --- a/libasan/aclocal.m4
>> +++ b/libasan/aclocal.m4
>> @@ -1037,8 +1037,8 @@ AC_SUBST([am__tar])
>>  AC_SUBST([am__untar])
>>  ]) # _AM_PROG_TAR
>>
>> -m4_include([m4/libtool.m4])
>> -m4_include([m4/ltoptions.m4])
>> -m4_include([m4/ltsugar.m4])
>> -m4_include([m4/ltversion.m4])
>> -m4_include([m4/lt~obsolete.m4])
>> +m4_include([../config/ltoptions.m4])
>> +m4_include([../config/ltsugar.m4])
>> +m4_include([../config/ltversion.m4])
>> +#m4_include([../config/lt~obsolete.m4])
>> +m4_include([acinclude.m4])
>>
>>
>> On Fri, Oct 19, 2012 at 11:02 AM, Wei Mi <wmi@google.com> wrote:
>>> David, I put the m4 subdir under libasan because once I use the .m4
>>> files (libtool.m4  lt~obsolete.m4  ltoptions.m4  ltsugar.m4
>>> ltversion.m4) and ltmain.sh under $topsrcdir, the problem that a bad
>>> libtool was generated under
>>> $topbuilddir/x86_64-unknown-linux-gnu/libasan you met yesterday
>>> appeared.  That is why I had to generate the new libtool m4 files and
>>> ltmain.sh using libtoolize.
>>>
>>> Thanks,
>>> Wei.
>>>
>>> On Fri, Oct 19, 2012 at 10:16 AM, Xinliang David Li <davidxl@google.com> wrote:
>>>> I tried it, and this version works for me.
>>>>
>>>> Your probably do not need to add the m4 subdir under libasan.  The
>>>> required m4 files are either in .. or ../config dir. See how
>>>> libmudflap does it.
>>>>
>>>> Other than that, if there are no other comments, the change is good to
>>>> check into the branch. Remaining bugs can always be found and fixed
>>>> later.
>>>>
>>>> thanks,
>>>>
>>>> David
>>>>
>>>>
>>>>
>>>> On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
>>>>> Hi,
>>>>>
>>>>> David cought a problem in the last patch when he tries to built
>>>>> libasan. The problem was that an incomplete libtool under libasan
>>>>> build directory was generated. The cause is that the old patch used an
>>>>> old ltmain.sh to generate libtool. I fix it and attach a new patch.
>>>>> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>>>>>
>>>>> Thanks,
>>>>> Wei.

[-- Attachment #2: patch.part2.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 176181 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-20  2:33                       ` Wei Mi
@ 2012-10-25 16:49                         ` Xinliang David Li
  2012-10-25 16:51                           ` Jakub Jelinek
  0 siblings, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-25 16:49 UTC (permalink / raw)
  To: Wei Mi; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches, Diego Novillo

To accommodate tsan (and msan in the future), the directory structure
needs to be changed. The top level directory can be called something
like librt with the following subdirs: asan, tsan, sanitizer_common,
and interception.  Also the libasan should be linked in statically by
default.

thanks,

David

On Fri, Oct 19, 2012 at 6:42 PM, Wei Mi <wmi@google.com> wrote:
> And this is the second part.
>
> Thanks,
> Wei.
>
> On Fri, Oct 19, 2012 at 6:41 PM, Wei Mi <wmi@google.com> wrote:
>> Thanks David. Here is the patch after removing m4 directory under libasan.
>> And I add the dependence libasan on libstdc++-v3 to avoid problem
>> under parallel making for now.
>>
>> The patch is too big even after compressed, so I have to split the
>> patch into two parts contained in two mails. patch.part1.txt and
>> patch.part2.txt. This is the first part.
>>
>> --- a/Makefile.def      2012-10-19 15:36:36.156106282 -0700
>> +++ b/Makefile.def      2012-10-19 15:36:51.656186869 -0700
>> @@ -504,7 +504,6 @@
>>  dependencies = { module=configure-target-libobjc;
>> on=configure-target-boehm-gc; };
>>  dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
>>  dependencies = { module=configure-target-libstdc++-v3;
>> on=configure-target-libgomp; };
>> +dependencies = { module=configure-target-libasan;
>> on=all-target-libstdc++-v3; };
>>  // parallel_list.o and parallel_settings.o depend on omp.h, which is
>>  // generated by the libgomp configure.  Unfortunately, due to the use of
>>  //  recursive make, we can't be that specific.
>>
>> Thanks,
>> Wei.
>>
>> On Fri, Oct 19, 2012 at 12:52 PM, Xinliang David Li <davidxl@google.com> wrote:
>>> The library builds fine with the following diff. The file acinclude.m4
>>> is cloned from libmudflap.
>>>
>>> David
>>>
>>> index 485d169..3e847f1 100644
>>> --- a/libasan/aclocal.m4
>>> +++ b/libasan/aclocal.m4
>>> @@ -1037,8 +1037,8 @@ AC_SUBST([am__tar])
>>>  AC_SUBST([am__untar])
>>>  ]) # _AM_PROG_TAR
>>>
>>> -m4_include([m4/libtool.m4])
>>> -m4_include([m4/ltoptions.m4])
>>> -m4_include([m4/ltsugar.m4])
>>> -m4_include([m4/ltversion.m4])
>>> -m4_include([m4/lt~obsolete.m4])
>>> +m4_include([../config/ltoptions.m4])
>>> +m4_include([../config/ltsugar.m4])
>>> +m4_include([../config/ltversion.m4])
>>> +#m4_include([../config/lt~obsolete.m4])
>>> +m4_include([acinclude.m4])
>>>
>>>
>>> On Fri, Oct 19, 2012 at 11:02 AM, Wei Mi <wmi@google.com> wrote:
>>>> David, I put the m4 subdir under libasan because once I use the .m4
>>>> files (libtool.m4  lt~obsolete.m4  ltoptions.m4  ltsugar.m4
>>>> ltversion.m4) and ltmain.sh under $topsrcdir, the problem that a bad
>>>> libtool was generated under
>>>> $topbuilddir/x86_64-unknown-linux-gnu/libasan you met yesterday
>>>> appeared.  That is why I had to generate the new libtool m4 files and
>>>> ltmain.sh using libtoolize.
>>>>
>>>> Thanks,
>>>> Wei.
>>>>
>>>> On Fri, Oct 19, 2012 at 10:16 AM, Xinliang David Li <davidxl@google.com> wrote:
>>>>> I tried it, and this version works for me.
>>>>>
>>>>> Your probably do not need to add the m4 subdir under libasan.  The
>>>>> required m4 files are either in .. or ../config dir. See how
>>>>> libmudflap does it.
>>>>>
>>>>> Other than that, if there are no other comments, the change is good to
>>>>> check into the branch. Remaining bugs can always be found and fixed
>>>>> later.
>>>>>
>>>>> thanks,
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Oct 18, 2012 at 8:04 PM, Wei Mi <wmi@google.com> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> David cought a problem in the last patch when he tries to built
>>>>>> libasan. The problem was that an incomplete libtool under libasan
>>>>>> build directory was generated. The cause is that the old patch used an
>>>>>> old ltmain.sh to generate libtool. I fix it and attach a new patch.
>>>>>> And the new patch move -lpthread and -ldl to libasan LDFLAGS.
>>>>>>
>>>>>> Thanks,
>>>>>> Wei.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 16:49                         ` Xinliang David Li
@ 2012-10-25 16:51                           ` Jakub Jelinek
  2012-10-25 16:53                             ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-25 16:51 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 09:24:51AM -0700, Xinliang David Li wrote:
> To accommodate tsan (and msan in the future), the directory structure
> needs to be changed. The top level directory can be called something
> like librt with the following subdirs: asan, tsan, sanitizer_common,
> and interception.  Also the libasan should be linked in statically by
> default.

librt is a very bad name, that clashes with glibc librt, would only create
confusion.

Why should be libasan linked statically by default?

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 16:51                           ` Jakub Jelinek
@ 2012-10-25 16:53                             ` Xinliang David Li
  2012-10-25 16:55                               ` Diego Novillo
  2012-10-25 17:00                               ` Jakub Jelinek
  0 siblings, 2 replies; 31+ messages in thread
From: Xinliang David Li @ 2012-10-25 16:53 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 9:39 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 25, 2012 at 09:24:51AM -0700, Xinliang David Li wrote:
>> To accommodate tsan (and msan in the future), the directory structure
>> needs to be changed. The top level directory can be called something
>> like librt with the following subdirs: asan, tsan, sanitizer_common,
>> and interception.  Also the libasan should be linked in statically by
>> default.
>
> librt is a very bad name, that clashes with glibc librt, would only create
> confusion.

Ok, then we should pick something that is not confusing but reflect
the fact  they are for runtime error checking ..

>
> Why should be libasan linked statically by default?
>

There are a couple of reasons:

1) it makes running sanitized binary on remote machines which does not
have libasan installed easier;
2) There is no guarantee that libasan API won't change, statically
linking it in makes it less vulnerable to such changes.

thanks,

David

>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 16:53                             ` Xinliang David Li
@ 2012-10-25 16:55                               ` Diego Novillo
  2012-10-25 16:56                                 ` Xinliang David Li
  2012-10-25 17:00                               ` Jakub Jelinek
  1 sibling, 1 reply; 31+ messages in thread
From: Diego Novillo @ 2012-10-25 16:55 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Jakub Jelinek, Wei Mi, Andrew Pinski, gcc-patches

On Thu, Oct 25, 2012 at 12:48 PM, Xinliang David Li <davidxl@google.com> wrote:
> On Thu, Oct 25, 2012 at 9:39 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>>
>> librt is a very bad name, that clashes with glibc librt, would only create
>> confusion.
>
> Ok, then we should pick something that is not confusing but reflect
> the fact  they are for runtime error checking ..

libsanitizer?


Diego.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 16:55                               ` Diego Novillo
@ 2012-10-25 16:56                                 ` Xinliang David Li
  0 siblings, 0 replies; 31+ messages in thread
From: Xinliang David Li @ 2012-10-25 16:56 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Jakub Jelinek, Wei Mi, Andrew Pinski, gcc-patches

On Thu, Oct 25, 2012 at 9:52 AM, Diego Novillo <dnovillo@google.com> wrote:
> On Thu, Oct 25, 2012 at 12:48 PM, Xinliang David Li <davidxl@google.com> wrote:
>> On Thu, Oct 25, 2012 at 9:39 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>>>
>>> librt is a very bad name, that clashes with glibc librt, would only create
>>> confusion.
>>
>> Ok, then we should pick something that is not confusing but reflect
>> the fact  they are for runtime error checking ..
>
> libsanitizer?

+1 --- missed the obvious one :)

David

>
>
> Diego.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 16:53                             ` Xinliang David Li
  2012-10-25 16:55                               ` Diego Novillo
@ 2012-10-25 17:00                               ` Jakub Jelinek
  2012-10-25 17:13                                 ` Xinliang David Li
  1 sibling, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-25 17:00 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 09:48:54AM -0700, Xinliang David Li wrote:
> > Why should be libasan linked statically by default?

> There are a couple of reasons:
> 
> 1) it makes running sanitized binary on remote machines which does not
> have libasan installed easier;
> 2) There is no guarantee that libasan API won't change, statically
> linking it in makes it less vulnerable to such changes.

Neither of the reasons look important enough, compared to the
http://www.akkadia.org/drepper/no_static_linking.html
Especially as libasan is overriding malloc etc., having dozens of malloc
overrides in different shared libraries, perhaps all chaining into each
other, is a nightmare.
For 2), libasan should just use symbol versioning and provide backwards
compatibility as long as it is possible, or worst case bump SONAME
occassionally.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 17:00                               ` Jakub Jelinek
@ 2012-10-25 17:13                                 ` Xinliang David Li
  2012-10-25 17:27                                   ` Jakub Jelinek
  0 siblings, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-25 17:13 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 9:55 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 25, 2012 at 09:48:54AM -0700, Xinliang David Li wrote:
>> > Why should be libasan linked statically by default?
>
>> There are a couple of reasons:
>>
>> 1) it makes running sanitized binary on remote machines which does not
>> have libasan installed easier;
>> 2) There is no guarantee that libasan API won't change, statically
>> linking it in makes it less vulnerable to such changes.
>
> Neither of the reasons look important enough, compared to the
> http://www.akkadia.org/drepper/no_static_linking.html
> Especially as libasan is overriding malloc etc., having dozens of malloc
> overrides in different shared libraries, perhaps all chaining into each
> other, is a nightmare.


How about statically linking just for executables, not shared library buid?

David

> For 2), libasan should just use symbol versioning and provide backwards
> compatibility as long as it is possible, or worst case bump SONAME
> occassionally.
>
>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 17:13                                 ` Xinliang David Li
@ 2012-10-25 17:27                                   ` Jakub Jelinek
  2012-10-25 18:08                                     ` Xinliang David Li
  0 siblings, 1 reply; 31+ messages in thread
From: Jakub Jelinek @ 2012-10-25 17:27 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 10:00:03AM -0700, Xinliang David Li wrote:
> How about statically linking just for executables, not shared library buid?

That is IMHO still a bad idea.

	Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 17:27                                   ` Jakub Jelinek
@ 2012-10-25 18:08                                     ` Xinliang David Li
  2012-10-25 18:11                                       ` Diego Novillo
  0 siblings, 1 reply; 31+ messages in thread
From: Xinliang David Li @ 2012-10-25 18:08 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Wei Mi, Andrew Pinski, gcc-patches, Diego Novillo

On Thu, Oct 25, 2012 at 10:19 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 25, 2012 at 10:00:03AM -0700, Xinliang David Li wrote:
>> How about statically linking just for executables, not shared library buid?
>
> That is IMHO still a bad idea.

I don't know why you think so (It seems that the points mentioned in
http://www.akkadia.org/drepper/no_static_linking.html mainly apply to
release binaries, not sanitized ones), but for now let's drop the
static link request.

thanks,

David


>
>         Jakub

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [asan] migrate runtime from llvm
  2012-10-25 18:08                                     ` Xinliang David Li
@ 2012-10-25 18:11                                       ` Diego Novillo
  0 siblings, 0 replies; 31+ messages in thread
From: Diego Novillo @ 2012-10-25 18:11 UTC (permalink / raw)
  To: Xinliang David Li; +Cc: Jakub Jelinek, Wei Mi, Andrew Pinski, gcc-patches

On Thu, Oct 25, 2012 at 1:24 PM, Xinliang David Li <davidxl@google.com> wrote:

> I don't know why you think so (It seems that the points mentioned in
> http://www.akkadia.org/drepper/no_static_linking.html mainly apply to
> release binaries, not sanitized ones), but for now let's drop the
> static link request.

Yeah, we can always just do that in our own builds.


Diego.

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2012-10-25 17:27 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16  6:40 [asan] migrate runtime from llvm Wei Mi
2012-10-16  6:40 ` Andrew Pinski
2012-10-16  6:45   ` Wei Mi
2012-10-16  7:47     ` Andrew Pinski
2012-10-16 15:27     ` Jakub Jelinek
2012-10-18 17:00       ` Wei Mi
2012-10-18 18:28         ` Jakub Jelinek
2012-10-18 20:25           ` Wei Mi
2012-10-19  3:49             ` Wei Mi
2012-10-19 17:43               ` Xinliang David Li
2012-10-19 18:52                 ` Diego Novillo
2012-10-19 19:02                 ` Wei Mi
2012-10-19 20:28                   ` Xinliang David Li
2012-10-19 20:41                     ` Diego Novillo
2012-10-20  2:08                     ` Wei Mi
2012-10-20  2:33                       ` Wei Mi
2012-10-25 16:49                         ` Xinliang David Li
2012-10-25 16:51                           ` Jakub Jelinek
2012-10-25 16:53                             ` Xinliang David Li
2012-10-25 16:55                               ` Diego Novillo
2012-10-25 16:56                                 ` Xinliang David Li
2012-10-25 17:00                               ` Jakub Jelinek
2012-10-25 17:13                                 ` Xinliang David Li
2012-10-25 17:27                                   ` Jakub Jelinek
2012-10-25 18:08                                     ` Xinliang David Li
2012-10-25 18:11                                       ` Diego Novillo
2012-10-18 18:22       ` Xinliang David Li
2012-10-18 18:32         ` Jakub Jelinek
2012-10-18 19:29           ` Xinliang David Li
2012-10-18 19:45             ` Xinliang David Li
     [not found]               ` <CAN=P9piGAbcEmLLVF+77jJvOHAh3dFpEWMgrYqAHqKynrfFNeQ@mail.gmail.com>
2012-10-19  5:14                 ` Xinliang David Li

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).