[cfe-dev] Thread Sanitizer reporting "failed to intercept clock_gettime"

Alexey Samsonov samsonov at google.com
Wed Apr 24 13:03:33 PDT 2013


Hi Sean!

A couple of random guesses:
1) do you link with "-lrt"? clock_gettime is the function in librt, and you
should link against it explicitly.
2) if yes, do you use -Wl,--as-needed? We think it may be
sanitizer-hostile, see http://llvm.org/bugs/show_bug.cgi?id=15823

Background:
Normally if you call "clock_gettime" this symbol is undefined in your
library and is taken from librt.so
But if you build your code with -fsanitize=thread, "clock_gettime" is
resolved to a replacement provided by sanitizer
runtime, while the "real" clock_gettime is obtained by the call to
dlsym("clock_gettime")



On Wed, Apr 24, 2013 at 9:45 PM, Sean McBride <sean at rogue-research.com>wrote:

> Hi all,
>
> We have been trying out Thread Sanitizer lately (on ubuntu 12.10, with
> clang trunk) and just ran into a problem where it outputs:
>
> FATAL: ThreadSanitizer: failed to intercept clock_gettime
>
> We do indeed use the clock_gettime() API (via a 3rd party library, but
> whatever).
>
> What does this error message mean?  Is this a tsan bug?  Or something
> that's our fault?
>
> Thanks,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130425/35ea037a/attachment.html>


More information about the cfe-dev mailing list