[llvm-dev] Use of the C++ standard library in XRay compiler-rt
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 13 02:06:29 PDT 2017
On 13 Mar 2017, at 04:39, David Blaikie via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> One thing we rely on heavily on in the FDR mode implementation is C++'s `thread_local` keyword. I'm not sure what that entails runtime-wise (does it need pthreads? or something else?) but I'm sure a functional replacement would be alright too.
>
> No doubt we can find some common API for that, I'd guess tsan probably has already had to figure out things like that.
thread_local depends on any runtime (ABI library) features for destruction, so it’s only a dependency if you have thread-local global with a non-trivial destructor. Local static (non-thread-local) variables also depend on the ABI library for atomic creation.
These are less of an issue than standard library dependencies though, because these calls are all defined by the platform ABI and so if there are multiple options (libcxxrt, libsupc++, libc++abi) then you substitute any of them at run time. This does mean that you’ll need to ensure that one of them is linked in the final binary though, and so must be overridden by the flag that selects C++ standard library implementation during linking.
David
More information about the llvm-dev
mailing list