[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] x86_64 trace cache and FreeBSD

From: Lassi Tuura
Subject: Re: [Libunwind-devel] x86_64 trace cache and FreeBSD
Date: Fri, 28 Oct 2011 15:11:54 +0200


> I need the patch below on FreeBSD/amd64, otherwise trace cache
> pool is not initialized, and e.g. Gtest-bt loops infinitely in
> mempool.c:add_memory() due to obj_size == 0.

I confirm for my part this patch is fine (after MIME-demangling the patch).
For a long time I programmed these caveats in threaded code, then started
giving up on them, as I thought there are no longer systems in use which
actually require the hacks. Seems I was wrong... or maybe just spoiled?
Thanks for providing the fix Konstantin.

> commit 6d904047253827a047907a45b67694c17df2c65d
> Author: Konstantin Belousov <address@hidden>
> Date:   Sat Sep 17 00:47:23 2011 +0300
>    On FreeBSD, as well as on the Solaris < 10, weak pthread_once stub is
>    always exported from libc. But it does nothing, which means that if
>    threaded library is not loaded, then pthread_once() call do not actually
>    call the initializer finction. The construct
>      if (likely (pthread_once != 0))
>      {
>        pthread_once(&trace_cache_once, &trace_cache_init_once);
>    then fails to initialize the trace cache on x86_64.
>    Work around by checking that the initializer was indeed called.
>    Note that this can break if libthr is loaded dynamically, but my belief
>    is that there is no platforms which allow dynamic loading of the threading
>    library.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]