This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ubsan merged into trunk


Hi,

On 30 Aug 2013, at 20:43, Jakub Jelinek wrote:

> On Fri, Aug 30, 2013 at 09:38:01PM +0200, Dominique Dhumieres wrote:
>>> I've just merged ubsan into trunk.  Please send complaints my way.
>> 
>> Bootstrap is broken on x86_64-apple-darwin10:

> (wonder why not
> libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la
> if !USING_MAC_INTERPOSE
> libasan_la_LIBADD += $(top_builddir)/interception/libinterception.la
> endif
> libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
> ).

… indeed, that's what I did for ubsan.

> perhaps tsan/Makefile.am too (though, tsan isn't supported on darwin, so
> it doesn't matter that much).

tsan isn't relevant (yet): although, when we get some time to work on it, native thread support should be feasible for Darwin >= 11.

===

the patch below fixes bootstrap - along the lines of your observation;
it also fixes the specs to actually use the library (so that the tests pass too).

bootstrapped x86_64-darwin12 for c,c++ and fortran (objc and ada bootstraps are broken from other causes).
[also bootstrapped on x86_64-linux, and checked RUNTESTFLAGS="asan.exp ubsan.exp"]

OK for trunk?
Iain

gcc:
	* config/darwin.h (LINK_COMMAND_SPEC_A): Revise sanitiser specs to
	include sanitise(undefined).

libsanitiser:

	* ubsan/Makefile.am (libubsan_la_LIBADD): Revise to omit libinterception.la
	for Darwin.
	* ubsan/Makefile.in: Regenerate.

Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 202118)
+++ gcc/config/darwin.h	(working copy)
@@ -178,10 +178,11 @@ extern GTY(()) int darwin_ms_struct;
     %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
     %{fopenmp|ftree-parallelize-loops=*: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
-    %{%:sanitize(address): -lasan } \
     %{fgnu-tm: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
     %{!nostdlib:%{!nodefaultlibs:\
+      %{%:sanitize(address): -lasan } \
+      %{%:sanitize(undefined): -lubsan } \
       %(link_ssp) %(link_gcc_c_sequence)\
     }}\
     %{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}"

Index: libsanitizer/ubsan/Makefile.am
===================================================================
--- libsanitizer/ubsan/Makefile.am	(revision 202118)
+++ libsanitizer/ubsan/Makefile.am	(working copy)
@@ -18,7 +18,11 @@ ubsan_files = \
 	ubsan_value.cc
 
 libubsan_la_SOURCES = $(ubsan_files) 
-libubsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la $(top_builddir)/interception/libinterception.la $(LIBSTDCXX_RAW_CXX_LDFLAGS)
+libubsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la 
+if !USING_MAC_INTERPOSE
+libubsan_la_LIBADD += $(top_builddir)/interception/libinterception.la
+endif
+libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
 libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]