This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][Revised] Enable libsanitizer on darwin
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: wmi at google dot com, dodji at redhat dot com, mikestump at comcast dot net, iain at codesourcery dot com, ro at CeBiTec dot Uni-Bielefeld dot DE
- Date: Wed, 14 Nov 2012 09:43:56 -0500
- Subject: [PATCH][Revised] Enable libsanitizer on darwin
The attached patch assumes that mach_override/mach_override.h
and mach_override/mach_override.c has been imported by the libsanitizer
maintainers for use by darwin. The patch adds darwin to the supported
target list in configure.tgt and defines USING_MACH_OVERRIDE for darwin
in configure.ac. The definition of USING_MACH_OVERRIDE is used in
Makefile.am as the test for appending mach_override/mach_override.c
to libinterception_la_SOURCES. Tested on x86_64-apple-darwin12 against
the mach_override/mach_override.h and mach_override/mach_override.c
from llvm compiler-rt 3.2 branch. While there is some noise on the
output of asan...
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55289#c14
the functionality of asan appears to be intact. Okay for gcc trunk
after the libsanitizer maintainers import the missing mach_override/mach_override.h
and mach_override/mach_override.c files?
Jack
ps Note that this patch assumes that both mach_override.h and mach_override.c
reside in a mach_override subdirectory in interception as is the case in the
llvm's compiler-rt.
pps Patch to configure.tgt revised to use a distinct instance for darwin in
the case statement and to limit libsanitizer to i?86 and x86_64 on darwin.
libsanitizer/
2012-11-14 Jack Howarth <howarth@bromo.med.uc.edu>
* configure.tgt: Add darwin to supported targets.
* configure.ac: Define USING_MACH_OVERRIDE when on darwin.
* interception/Makefile.am: Compile mach_override.c when
USING_MACH_OVERRIDE defined.
* configure: Regenerated.
* interception/Makefile.in: Likewise.
Index: libsanitizer/interception/Makefile.am
===================================================================
--- libsanitizer/interception/Makefile.am (revision 193500)
+++ libsanitizer/interception/Makefile.am (working copy)
@@ -11,7 +11,11 @@ interception_files = \
interception_mac.cc \
interception_win.cc
-libinterception_la_SOURCES = $(interception_files)
+if USING_MACH_OVERRIDE
+libinterception_la_SOURCES = $(interception_files) mach_override/mach_override.c
+else
+libinterception_la_SOURCES = $(interception_files)
+endif
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
Index: libsanitizer/configure.ac
===================================================================
--- libsanitizer/configure.ac (revision 193500)
+++ libsanitizer/configure.ac (working copy)
@@ -17,6 +17,12 @@ AM_PROG_LIBTOOL
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
+case "$host" in
+ *-*-darwin*) MACH_OVERRIDE=true ;;
+ *) MACH_OVERRIDE=false ;;
+esac
+AM_CONDITIONAL(USING_MACH_OVERRIDE, $MACH_OVERRIDE)
+
#AM_ENABLE_MULTILIB(, ..)
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
Index: libsanitizer/configure.tgt
===================================================================
--- libsanitizer/configure.tgt (revision 193500)
+++ libsanitizer/configure.tgt (working copy)
@@ -22,6 +22,8 @@
case "${target}" in
x86_64-*-linux* | i?86-*-linux*)
;;
+ x86_64-*-darwin* | i?86-*-darwin*)
+ ;;
*)
UNSUPPORTED=1
;;