[100986] trunk/dports/lang
jeremyhu at macports.org
jeremyhu at macports.org
Wed Jan 2 14:10:00 PST 2013
Revision: 100986
https://trac.macports.org/changeset/100986
Author: jeremyhu at macports.org
Date: 2013-01-02 14:10:00 -0800 (Wed, 02 Jan 2013)
Log Message:
-----------
clang-3.[23]: Don't interpose pthread_workqueue_additem_np in asan
Modified Paths:
--------------
trunk/dports/lang/llvm-3.2/Portfile
trunk/dports/lang/llvm-3.3/Portfile
Added Paths:
-----------
trunk/dports/lang/llvm-3.2/files/asan-pthread_workqueue.patch
trunk/dports/lang/llvm-3.3/files/asan-pthread_workqueue.patch
Modified: trunk/dports/lang/llvm-3.2/Portfile
===================================================================
--- trunk/dports/lang/llvm-3.2/Portfile 2013-01-02 19:47:58 UTC (rev 100985)
+++ trunk/dports/lang/llvm-3.2/Portfile 2013-01-02 22:10:00 UTC (rev 100986)
@@ -91,7 +91,8 @@
}
patchfiles-append tiger-shlib-clang.patch tiger-libclang.patch scan-build-PR-35006.patch \
- 0001-Comment-out-SL-cctools-workaround.patch
+ 0001-Comment-out-SL-cctools-workaround.patch \
+ asan-pthread_workqueue.patch
build.target clang-only
destroot.target install-clang
Added: trunk/dports/lang/llvm-3.2/files/asan-pthread_workqueue.patch
===================================================================
--- trunk/dports/lang/llvm-3.2/files/asan-pthread_workqueue.patch (rev 0)
+++ trunk/dports/lang/llvm-3.2/files/asan-pthread_workqueue.patch 2013-01-02 22:10:00 UTC (rev 100986)
@@ -0,0 +1,79 @@
+--- projects/compiler-rt/lib/asan/asan_mac.cc.orig 2013-01-02 13:16:49.000000000 -0800
++++ projects/compiler-rt/lib/asan/asan_mac.cc 2013-01-02 13:24:37.000000000 -0800
+@@ -251,9 +251,6 @@ mach_error_t __interception_deallocate_i
+ // The implementation details are at
+ // http://libdispatch.macosforge.org/trac/browser/trunk/src/queue.c
+
+-typedef void* pthread_workqueue_t;
+-typedef void* pthread_workitem_handle_t;
+-
+ typedef void* dispatch_group_t;
+ typedef void* dispatch_queue_t;
+ typedef void* dispatch_source_t;
+@@ -284,9 +281,6 @@ void dispatch_barrier_async_f(dispatch_q
+ dispatch_function_t func);
+ void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t dq,
+ void *ctxt, dispatch_function_t func);
+-int pthread_workqueue_additem_np(pthread_workqueue_t workq,
+- void *(*workitem_func)(void *), void * workitem_arg,
+- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
+ } // extern "C"
+
+ static ALWAYS_INLINE
+@@ -441,43 +435,6 @@ INTERCEPTOR(void, dispatch_source_set_ev
+ }
+ #endif
+
+-// The following stuff has been extremely helpful while looking for the
+-// unhandled functions that spawned jobs on Chromium shutdown. If the verbosity
+-// level is 2 or greater, we wrap pthread_workqueue_additem_np() in order to
+-// find the points of worker thread creation (each of such threads may be used
+-// to run several tasks, that's why this is not enough to support the whole
+-// libdispatch API.
+-extern "C"
+-void *wrap_workitem_func(void *arg) {
+- if (flags()->verbosity >= 2) {
+- Report("wrap_workitem_func: %p, pthread_self: %p\n", arg, pthread_self());
+- }
+- asan_block_context_t *ctxt = (asan_block_context_t*)arg;
+- worker_t fn = (worker_t)(ctxt->func);
+- void *result = fn(ctxt->block);
+- GET_STACK_TRACE_HERE(kStackTraceMax);
+- asan_free(arg, &stack);
+- return result;
+-}
+-
+-INTERCEPTOR(int, pthread_workqueue_additem_np, pthread_workqueue_t workq,
+- void *(*workitem_func)(void *), void * workitem_arg,
+- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp) {
+- GET_STACK_TRACE_HERE(kStackTraceMax);
+- asan_block_context_t *asan_ctxt =
+- (asan_block_context_t*) asan_malloc(sizeof(asan_block_context_t), &stack);
+- asan_ctxt->block = workitem_arg;
+- asan_ctxt->func = (dispatch_function_t)workitem_func;
+- asan_ctxt->parent_tid = asanThreadRegistry().GetCurrentTidOrInvalid();
+- if (flags()->verbosity >= 2) {
+- Report("pthread_workqueue_additem_np: %p\n", asan_ctxt);
+- PRINT_CURRENT_STACK();
+- }
+- return REAL(pthread_workqueue_additem_np)(workq, wrap_workitem_func,
+- asan_ctxt, itemhandlep,
+- gencountp);
+-}
+-
+ // See http://opensource.apple.com/source/CF/CF-635.15/CFString.c
+ int __CFStrIsConstant(CFStringRef str) {
+ CFRuntimeBase *base = (CFRuntimeBase*)str;
+@@ -509,12 +466,6 @@ void InitializeMacInterceptors() {
+ CHECK(INTERCEPT_FUNCTION(dispatch_after_f));
+ CHECK(INTERCEPT_FUNCTION(dispatch_barrier_async_f));
+ CHECK(INTERCEPT_FUNCTION(dispatch_group_async_f));
+- // We don't need to intercept pthread_workqueue_additem_np() to support the
+- // libdispatch API, but it helps us to debug the unsupported functions. Let's
+- // intercept it only during verbose runs.
+- if (flags()->verbosity >= 2) {
+- CHECK(INTERCEPT_FUNCTION(pthread_workqueue_additem_np));
+- }
+ // Normally CFStringCreateCopy should not copy constant CF strings.
+ // Replacing the default CFAllocator causes constant strings to be copied
+ // rather than just returned, which leads to bugs in big applications like
Modified: trunk/dports/lang/llvm-3.3/Portfile
===================================================================
--- trunk/dports/lang/llvm-3.3/Portfile 2013-01-02 19:47:58 UTC (rev 100985)
+++ trunk/dports/lang/llvm-3.3/Portfile 2013-01-02 22:10:00 UTC (rev 100986)
@@ -80,7 +80,8 @@
}
patchfiles-append tiger-shlib-clang.patch tiger-libclang.patch scan-build-PR-35006.patch \
- 0001-Comment-out-SL-cctools-workaround.patch
+ 0001-Comment-out-SL-cctools-workaround.patch \
+ asan-pthread_workqueue.patch
build.target clang-only
destroot.target install-clang
Added: trunk/dports/lang/llvm-3.3/files/asan-pthread_workqueue.patch
===================================================================
--- trunk/dports/lang/llvm-3.3/files/asan-pthread_workqueue.patch (rev 0)
+++ trunk/dports/lang/llvm-3.3/files/asan-pthread_workqueue.patch 2013-01-02 22:10:00 UTC (rev 100986)
@@ -0,0 +1,79 @@
+--- projects/compiler-rt/lib/asan/asan_mac.cc.orig 2012-12-31 14:29:07.000000000 -0800
++++ projects/compiler-rt/lib/asan/asan_mac.cc 2013-01-02 13:26:59.000000000 -0800
+@@ -256,9 +256,6 @@ mach_error_t __interception_deallocate_i
+ // The implementation details are at
+ // http://libdispatch.macosforge.org/trac/browser/trunk/src/queue.c
+
+-typedef void* pthread_workqueue_t;
+-typedef void* pthread_workitem_handle_t;
+-
+ typedef void* dispatch_group_t;
+ typedef void* dispatch_queue_t;
+ typedef void* dispatch_source_t;
+@@ -289,9 +286,6 @@ void dispatch_barrier_async_f(dispatch_q
+ dispatch_function_t func);
+ void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t dq,
+ void *ctxt, dispatch_function_t func);
+-int pthread_workqueue_additem_np(pthread_workqueue_t workq,
+- void *(*workitem_func)(void *), void * workitem_arg,
+- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
+ } // extern "C"
+
+ static ALWAYS_INLINE
+@@ -446,43 +440,6 @@ INTERCEPTOR(void, dispatch_source_set_ev
+ }
+ #endif
+
+-// The following stuff has been extremely helpful while looking for the
+-// unhandled functions that spawned jobs on Chromium shutdown. If the verbosity
+-// level is 2 or greater, we wrap pthread_workqueue_additem_np() in order to
+-// find the points of worker thread creation (each of such threads may be used
+-// to run several tasks, that's why this is not enough to support the whole
+-// libdispatch API.
+-extern "C"
+-void *wrap_workitem_func(void *arg) {
+- if (flags()->verbosity >= 2) {
+- Report("wrap_workitem_func: %p, pthread_self: %p\n", arg, pthread_self());
+- }
+- asan_block_context_t *ctxt = (asan_block_context_t*)arg;
+- worker_t fn = (worker_t)(ctxt->func);
+- void *result = fn(ctxt->block);
+- GET_STACK_TRACE_THREAD;
+- asan_free(arg, &stack, FROM_MALLOC);
+- return result;
+-}
+-
+-INTERCEPTOR(int, pthread_workqueue_additem_np, pthread_workqueue_t workq,
+- void *(*workitem_func)(void *), void * workitem_arg,
+- pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp) {
+- GET_STACK_TRACE_THREAD;
+- asan_block_context_t *asan_ctxt =
+- (asan_block_context_t*) asan_malloc(sizeof(asan_block_context_t), &stack);
+- asan_ctxt->block = workitem_arg;
+- asan_ctxt->func = (dispatch_function_t)workitem_func;
+- asan_ctxt->parent_tid = asanThreadRegistry().GetCurrentTidOrInvalid();
+- if (flags()->verbosity >= 2) {
+- Report("pthread_workqueue_additem_np: %p\n", asan_ctxt);
+- PRINT_CURRENT_STACK();
+- }
+- return REAL(pthread_workqueue_additem_np)(workq, wrap_workitem_func,
+- asan_ctxt, itemhandlep,
+- gencountp);
+-}
+-
+ // See http://opensource.apple.com/source/CF/CF-635.15/CFString.c
+ int __CFStrIsConstant(CFStringRef str) {
+ CFRuntimeBase *base = (CFRuntimeBase*)str;
+@@ -514,12 +471,6 @@ void InitializeMacInterceptors() {
+ CHECK(INTERCEPT_FUNCTION(dispatch_after_f));
+ CHECK(INTERCEPT_FUNCTION(dispatch_barrier_async_f));
+ CHECK(INTERCEPT_FUNCTION(dispatch_group_async_f));
+- // We don't need to intercept pthread_workqueue_additem_np() to support the
+- // libdispatch API, but it helps us to debug the unsupported functions. Let's
+- // intercept it only during verbose runs.
+- if (flags()->verbosity >= 2) {
+- CHECK(INTERCEPT_FUNCTION(pthread_workqueue_additem_np));
+- }
+ // Normally CFStringCreateCopy should not copy constant CF strings.
+ // Replacing the default CFAllocator causes constant strings to be copied
+ // rather than just returned, which leads to bugs in big applications like
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130102/c54ba819/attachment.html>
More information about the macports-changes
mailing list