public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Disable libsanitizer before darwin10
@ 2013-02-11 15:55 Jack Howarth
  2013-02-11 16:06 ` Iain Sandoe
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jack Howarth @ 2013-02-11 15:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub, dodji, kcc, dvyukov, mikestump, iain

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

  Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of 
failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10.
The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream
decides to support the earlier darwin releases. Bootstrap and regression tested on
x86_64-apple-darwin12. Okay for gcc trunk?
         Jack

[-- Attachment #2: darwin_sanitizer_support.diff --]
[-- Type: text/plain, Size: 504 bytes --]

2013-02-11  Jack Howarth  <howarth@bromo.med.uc.edu>

	* configure.tgt: Disable build on darwin9 and earlier.

/libsanitizer

Index: libsanitizer/configure.tgt
===================================================================
--- libsanitizer/configure.tgt	(revision 195940)
+++ libsanitizer/configure.tgt	(working copy)
@@ -29,7 +29,7 @@ case "${target}" in
 	;;
   sparc*-*-linux*)
 	;;
-  x86_64-*-darwin* | i?86-*-darwin*)
+  x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
 	TSAN_SUPPORTED=no
 	;;
   *)

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

* Re: [PATCH] Disable libsanitizer before darwin10
  2013-02-11 15:55 [PATCH] Disable libsanitizer before darwin10 Jack Howarth
@ 2013-02-11 16:06 ` Iain Sandoe
  2013-02-11 16:06 ` Alexander Potapenko
  2013-02-11 23:16 ` Mike Stump
  2 siblings, 0 replies; 5+ messages in thread
From: Iain Sandoe @ 2013-02-11 16:06 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jack Howarth, jakub, dodji, kcc, dvyukov, mikestump

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


On 11 Feb 2013, at 15:55, Jack Howarth wrote:

>  Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of 
> failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10.
> The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream
> decides to support the earlier darwin releases. Bootstrap and regression tested on
> x86_64-apple-darwin12. Okay for gcc trunk?

note that making Darwin9 work is not that difficult - simply avoid the GCD calls (example hack attached).

However, the question is open as to whether upstream is willing to include code to cater for older Darwin (TBD).  
If such a change would be OK there, then the attached could be cleaned up/amended.

(it reduces the fails on i686-Darwin9 from 'all' asan to ~10 each for C on x86/x86_64 and similar for C++)

Iain



[-- Attachment #2: 195915-asan-d9-hack.txt --]
[-- Type: text/plain, Size: 4300 bytes --]

Index: libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc
===================================================================
--- libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc	(revision 195915)
+++ libsanitizer/asan/dynamic/asan_interceptors_dynamic.cc	(working copy)
@@ -84,6 +84,10 @@
   INTERPOSE_FUNCTION(mlockall),
   INTERPOSE_FUNCTION(munlockall),
 #endif
+
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
+
   INTERPOSE_FUNCTION(dispatch_async_f),
   INTERPOSE_FUNCTION(dispatch_sync_f),
   INTERPOSE_FUNCTION(dispatch_after_f),
@@ -96,14 +100,19 @@
   INTERPOSE_FUNCTION(dispatch_source_set_event_handler),
   INTERPOSE_FUNCTION(dispatch_source_set_cancel_handler),
 #endif
+#endif
   INTERPOSE_FUNCTION(signal),
   INTERPOSE_FUNCTION(sigaction),
 
   INTERPOSE_FUNCTION(malloc_create_zone),
   INTERPOSE_FUNCTION(malloc_default_zone),
+
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
   INTERPOSE_FUNCTION(malloc_default_purgeable_zone),
   INTERPOSE_FUNCTION(malloc_make_purgeable),
   INTERPOSE_FUNCTION(malloc_make_nonpurgeable),
+#endif
   INTERPOSE_FUNCTION(malloc_set_zone_name),
   INTERPOSE_FUNCTION(malloc),
   INTERPOSE_FUNCTION(free),
@@ -111,7 +120,10 @@
   INTERPOSE_FUNCTION(calloc),
   INTERPOSE_FUNCTION(valloc),
   INTERPOSE_FUNCTION(malloc_good_size),
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
   INTERPOSE_FUNCTION(posix_memalign),
+#endif
 };
 
 }  // namespace __asan
Index: libsanitizer/asan/asan_mac.cc
===================================================================
--- libsanitizer/asan/asan_mac.cc	(revision 195915)
+++ libsanitizer/asan/asan_mac.cc	(working copy)
@@ -197,6 +197,8 @@
   return err_none;
 }
 
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
 // Support for the following functions from libdispatch on Mac OS:
 //   dispatch_async_f()
 //   dispatch_async()
@@ -285,10 +287,12 @@
   context->func(context->block);
   asan_free(context, &stack, FROM_MALLOC);
 }
-
+#endif
 }  // namespace __asan
 
 using namespace __asan;  // NOLINT
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
 
 // Wrap |ctxt| and |func| into an asan_block_context_t.
 // The caller retains control of the allocated context.
@@ -319,6 +323,7 @@
                                asan_dispatch_call_block_and_release);         \
   }
 
+
 INTERCEPT_DISPATCH_X_F_3(dispatch_async_f)
 INTERCEPT_DISPATCH_X_F_3(dispatch_sync_f)
 INTERCEPT_DISPATCH_X_F_3(dispatch_barrier_async_f)
@@ -421,5 +426,6 @@
 }
 
 }  // namespace __asan
+#endif
 
 #endif  // __APPLE__
Index: libsanitizer/asan/asan_malloc_mac.cc
===================================================================
--- libsanitizer/asan/asan_malloc_mac.cc	(revision 195915)
+++ libsanitizer/asan/asan_malloc_mac.cc	(working copy)
@@ -52,6 +52,9 @@
   return &asan_zone;
 }
 
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
+
 INTERCEPTOR(malloc_zone_t *, malloc_default_purgeable_zone, void) {
   // FIXME: ASan should support purgeable allocations.
   // https://code.google.com/p/address-sanitizer/issues/detail?id=139
@@ -73,6 +76,7 @@
   // malloc_make_purgeable().
   return 0;
 }
+#endif
 
 INTERCEPTOR(void, malloc_set_zone_name, malloc_zone_t *zone, const char *name) {
   if (!asan_inited) __asan_init();
@@ -126,6 +130,9 @@
   return asan_zone.introspect->good_size(&asan_zone, size);
 }
 
+#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060
+
 INTERCEPTOR(int, posix_memalign, void **memptr, size_t alignment, size_t size) {
   if (!asan_inited) __asan_init();
   CHECK(memptr);
@@ -137,7 +144,7 @@
   }
   return -1;
 }
-
+#endif
 namespace {
 
 // TODO(glider): the mz_* functions should be united with the Linux wrappers,

[-- Attachment #3: Type: text/plain, Size: 2 bytes --]




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

* Re: [PATCH] Disable libsanitizer before darwin10
  2013-02-11 15:55 [PATCH] Disable libsanitizer before darwin10 Jack Howarth
  2013-02-11 16:06 ` Iain Sandoe
@ 2013-02-11 16:06 ` Alexander Potapenko
  2013-02-11 23:16 ` Mike Stump
  2 siblings, 0 replies; 5+ messages in thread
From: Alexander Potapenko @ 2013-02-11 16:06 UTC (permalink / raw)
  To: Jack Howarth
  Cc: gcc-patches, Jakub Jelinek, Dodji Seketeli, Kostya Serebryany,
	Dmitriy Vyukov, Mike Stump, iain

For the record, ASan never claimed darwin9 support and isn't going to
support darwin9 in the future, so it should be fine to disable
building ASan on this platform.

On Mon, Feb 11, 2013 at 7:55 PM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>   Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of
> failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10.
> The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream
> decides to support the earlier darwin releases. Bootstrap and regression tested on
> x86_64-apple-darwin12. Okay for gcc trunk?
>          Jack



--
Alexander Potapenko
Software Engineer
Google Moscow

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

* Re: [PATCH] Disable libsanitizer before darwin10
  2013-02-11 15:55 [PATCH] Disable libsanitizer before darwin10 Jack Howarth
  2013-02-11 16:06 ` Iain Sandoe
  2013-02-11 16:06 ` Alexander Potapenko
@ 2013-02-11 23:16 ` Mike Stump
  2013-02-12  6:17   ` Dmitry Vyukov
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2013-02-11 23:16 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gcc-patches, jakub, dodji, kcc, dvyukov, mikestump, iain

On Feb 11, 2013, at 7:55 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>  Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of 
> failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10.
> The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream
> decides to support the earlier darwin releases. Bootstrap and regression tested on
> x86_64-apple-darwin12. Okay for gcc trunk?

Ok.

Committed revision 195958.

If the patch needs to go upstream, could the asan people push it up?  Thanks.


I like fixing asan so that it works on darwin9.  If/when that is done, we can remove this patch; until such time, the patch is necessary.

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

* Re: [PATCH] Disable libsanitizer before darwin10
  2013-02-11 23:16 ` Mike Stump
@ 2013-02-12  6:17   ` Dmitry Vyukov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Vyukov @ 2013-02-12  6:17 UTC (permalink / raw)
  To: Mike Stump, Alexander Potapenko
  Cc: Jack Howarth, GCC Patches, Jakub Jelinek, Dodji Seketeli,
	Kostya Serebryany, iain

On Tue, Feb 12, 2013 at 3:16 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Feb 11, 2013, at 7:55 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>>  Iain Sandoe discovered that on intel darwin9, the asan testsuite suffers hundreds of
>> failures due to the absence of dispatch calls (Grand Central Dispatch) prior to darwin10.
>> The attached patch disables building libsanitizer on darwin8 and darwin9 until upstream
>> decides to support the earlier darwin releases. Bootstrap and regression tested on
>> x86_64-apple-darwin12. Okay for gcc trunk?
>
> Ok.
>
> Committed revision 195958.
>
> If the patch needs to go upstream, could the asan people push it up?  Thanks.
>
>
> I like fixing asan so that it works on darwin9.  If/when that is done, we can remove this patch; until such time, the patch is necessary.

LLVM uses different build system, so this patch can't be applied
directly. But future integrations won't break gcc.
Alexander, do we want to apply something similar upstream?

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

end of thread, other threads:[~2013-02-12  6:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11 15:55 [PATCH] Disable libsanitizer before darwin10 Jack Howarth
2013-02-11 16:06 ` Iain Sandoe
2013-02-11 16:06 ` Alexander Potapenko
2013-02-11 23:16 ` Mike Stump
2013-02-12  6:17   ` Dmitry Vyukov

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