* libsanitizer mege from upstream r169392
@ 2012-12-05 18:15 Konstantin Serebryany
2012-12-06 14:18 ` Konstantin Serebryany
0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Serebryany @ 2012-12-05 18:15 UTC (permalink / raw)
To: GCC Patches; +Cc: Jakub Jelinek, Dodji Seketeli, Dmitry Vyukov
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
Hi,
The attached patch is the libsanitizer merge from upstream r169392.
Among other things It fixes the darwin build.
Automatically generated by libsanitizer/merge.sh
Tested with
rm -rf */{*/,}libsanitizer \
&& make -j 50 \
&& make -C gcc check-g{cc,++}
RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} asan.exp'
Ok to commit?
--kcc
[-- Attachment #2: libsanitizer-169392.patch --]
[-- Type: application/octet-stream, Size: 5094 bytes --]
Index: asan/asan_interceptors.cc
===================================================================
--- asan/asan_interceptors.cc (revision 194226)
+++ asan/asan_interceptors.cc (working copy)
@@ -177,8 +177,6 @@
#if ASAN_INTERCEPT___CXA_THROW
INTERCEPTOR(void, __cxa_throw, void *a, void *b, void *c) {
- Printf("__asan's __cxa_throw %p; REAL(__cxa_throw) %p PLAIN %p\n",
- __interceptor___cxa_throw, REAL(__cxa_throw), __cxa_throw);
CHECK(REAL(__cxa_throw));
__asan_handle_no_return();
REAL(__cxa_throw)(a, b, c);
Index: ChangeLog
===================================================================
--- ChangeLog (revision 194226)
+++ ChangeLog (working copy)
@@ -1,5 +1,9 @@
2012-12-05 Kostya Serebryany <kcc@google.com>
+ * All files: Merge from upstream r169392.
+
+2012-12-05 Kostya Serebryany <kcc@google.com>
+
* All files: Merge from upstream r169371.
2012-12-04 Kostya Serebryany <kcc@google.com>
Index: MERGE
===================================================================
--- MERGE (revision 194226)
+++ MERGE (working copy)
@@ -1,4 +1,4 @@
-169371
+169392
The first line of this file holds the svn revision number of the
last merge done from the master library sources.
Index: tsan/tsan_interceptors.cc
===================================================================
--- tsan/tsan_interceptors.cc (revision 194226)
+++ tsan/tsan_interceptors.cc (working copy)
@@ -617,23 +617,33 @@
}
// Used in thread-safe function static initialization.
-TSAN_INTERCEPTOR(int, __cxa_guard_acquire, char *m) {
- SCOPED_TSAN_INTERCEPTOR(__cxa_guard_acquire, m);
- int res = REAL(__cxa_guard_acquire)(m);
- if (res) {
- // This thread does the init.
- } else {
- Acquire(thr, pc, (uptr)m);
+extern "C" int INTERFACE_ATTRIBUTE __cxa_guard_acquire(atomic_uint32_t *g) {
+ SCOPED_INTERCEPTOR_RAW(__cxa_guard_acquire, g);
+ for (;;) {
+ u32 cmp = atomic_load(g, memory_order_acquire);
+ if (cmp == 0) {
+ if (atomic_compare_exchange_strong(g, &cmp, 1<<16, memory_order_relaxed))
+ return 1;
+ } else if (cmp == 1) {
+ Acquire(thr, pc, (uptr)g);
+ return 0;
+ } else {
+ internal_sched_yield();
+ }
}
- return res;
}
-TSAN_INTERCEPTOR(void, __cxa_guard_release, char *m) {
- SCOPED_TSAN_INTERCEPTOR(__cxa_guard_release, m);
- Release(thr, pc, (uptr)m);
- REAL(__cxa_guard_release)(m);
+extern "C" void INTERFACE_ATTRIBUTE __cxa_guard_release(atomic_uint32_t *g) {
+ SCOPED_INTERCEPTOR_RAW(__cxa_guard_release, g);
+ Release(thr, pc, (uptr)g);
+ atomic_store(g, 1, memory_order_release);
}
+extern "C" void INTERFACE_ATTRIBUTE __cxa_guard_abort(atomic_uint32_t *g) {
+ SCOPED_INTERCEPTOR_RAW(__cxa_guard_abort, g);
+ atomic_store(g, 0, memory_order_relaxed);
+}
+
static void thread_finalize(void *v) {
uptr iter = (uptr)v;
if (iter > 1) {
@@ -1508,9 +1518,6 @@
TSAN_INTERCEPT(strncpy);
TSAN_INTERCEPT(strstr);
- TSAN_INTERCEPT(__cxa_guard_acquire);
- TSAN_INTERCEPT(__cxa_guard_release);
-
TSAN_INTERCEPT(pthread_create);
TSAN_INTERCEPT(pthread_join);
TSAN_INTERCEPT(pthread_detach);
Index: tsan/tsan_interface_atomic.cc
===================================================================
--- tsan/tsan_interface_atomic.cc (revision 194226)
+++ tsan/tsan_interface_atomic.cc (working copy)
@@ -113,7 +113,10 @@
}
template<typename T> T func_xchg(volatile T *v, T op) {
- return __sync_lock_test_and_set(v, op);
+ T res = __sync_lock_test_and_set(v, op);
+ // __sync_lock_test_and_set does not contain full barrier.
+ __sync_synchronize();
+ return res;
}
template<typename T> T func_add(volatile T *v, T op) {
@@ -253,6 +256,9 @@
thr->clock.ReleaseStore(&s->clock);
*a = v;
s->mtx.Unlock();
+ // Trainling memory barrier to provide sequential consistency
+ // for Dekker-like store-load synchronization.
+ __sync_synchronize();
}
template<typename T, T (*F)(volatile T *v, T op)>
Index: tsan/tsan_stat.cc
===================================================================
--- tsan/tsan_stat.cc (revision 194226)
+++ tsan/tsan_stat.cc (working copy)
@@ -136,6 +136,7 @@
name[StatInt_atexit] = " atexit ";
name[StatInt___cxa_guard_acquire] = " __cxa_guard_acquire ";
name[StatInt___cxa_guard_release] = " __cxa_guard_release ";
+ name[StatInt___cxa_guard_abort] = " __cxa_guard_abort ";
name[StatInt_pthread_create] = " pthread_create ";
name[StatInt_pthread_join] = " pthread_join ";
name[StatInt_pthread_detach] = " pthread_detach ";
Index: tsan/tsan_stat.h
===================================================================
--- tsan/tsan_stat.h (revision 194226)
+++ tsan/tsan_stat.h (working copy)
@@ -133,6 +133,7 @@
StatInt_atexit,
StatInt___cxa_guard_acquire,
StatInt___cxa_guard_release,
+ StatInt___cxa_guard_abort,
StatInt_pthread_create,
StatInt_pthread_join,
StatInt_pthread_detach,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libsanitizer mege from upstream r169392
2012-12-05 18:15 libsanitizer mege from upstream r169392 Konstantin Serebryany
@ 2012-12-06 14:18 ` Konstantin Serebryany
2012-12-06 14:24 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Serebryany @ 2012-12-06 14:18 UTC (permalink / raw)
To: GCC Patches; +Cc: Jakub Jelinek, Dodji Seketeli, Dmitry Vyukov
Any objections?
On Wed, Dec 5, 2012 at 10:15 PM, Konstantin Serebryany
<konstantin.s.serebryany@gmail.com> wrote:
> Hi,
>
> The attached patch is the libsanitizer merge from upstream r169392.
> Among other things It fixes the darwin build.
>
> Automatically generated by libsanitizer/merge.sh
> Tested with
> rm -rf */{*/,}libsanitizer \
> && make -j 50 \
> && make -C gcc check-g{cc,++}
> RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} asan.exp'
>
> Ok to commit?
>
> --kcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libsanitizer mege from upstream r169392
2012-12-06 14:18 ` Konstantin Serebryany
@ 2012-12-06 14:24 ` Jakub Jelinek
2012-12-06 14:43 ` Konstantin Serebryany
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2012-12-06 14:24 UTC (permalink / raw)
To: Konstantin Serebryany; +Cc: GCC Patches, Dodji Seketeli, Dmitry Vyukov
On Thu, Dec 06, 2012 at 06:17:51PM +0400, Konstantin Serebryany wrote:
> Any objections?
This is fine.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libsanitizer mege from upstream r169392
2012-12-06 14:24 ` Jakub Jelinek
@ 2012-12-06 14:43 ` Konstantin Serebryany
0 siblings, 0 replies; 4+ messages in thread
From: Konstantin Serebryany @ 2012-12-06 14:43 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches, Dodji Seketeli, Dmitry Vyukov
done, 194255. Thanks!
--kcc
On Thu, Dec 6, 2012 at 6:24 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Dec 06, 2012 at 06:17:51PM +0400, Konstantin Serebryany wrote:
>> Any objections?
>
> This is fine.
>
> Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-06 14:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-05 18:15 libsanitizer mege from upstream r169392 Konstantin Serebryany
2012-12-06 14:18 ` Konstantin Serebryany
2012-12-06 14:24 ` Jakub Jelinek
2012-12-06 14:43 ` Konstantin Serebryany
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).