[PATCH] D71059: [LLD][ELF] Add time-trace to ELF LLD (1/2)
Russell Gallop via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 11:24:21 PST 2020
russell.gallop updated this revision to Diff 236388.
russell.gallop edited the summary of this revision.
russell.gallop added a comment.
I reverted this at the end of last year MacOS build issues.
This new version fixes some build issues on various platforms and with LLVM_ENABLE_THREADS=OFF by using LLVM_THREAD_LOCAL.
Not all minimum host toolchains [1] support thread_local (i.e. Apple Clang 6.0) so this falls back to __thread on MacOS and other platforms which don't advertise it with __has_feature(cxx_thread_local) (even if they support thread_local like gcc). On Windows this uses __declspec(thread) which (from vs2017) is effectively thread_local [2].
This involved rolling back use of unique_ptr to raw pointers.
In time (with higher minimum host tools) LLVM_THREAD_LOCAL could become:
#if LLVM_ENABLE_THREADS
#define LLVM_THREAD_LOCAL thread_local
#else
#define LLVM_THREAD_LOCAL
#endif
and this change should still work.
Tested with Linux with clang and gcc host compiler and Windows with MSVC2017. Also tested with LLVM_ENABLE_THREADS=OFF.
[1] https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
[2] https://docs.microsoft.com/en-us/cpp/cpp/thread?view=vs-2017
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71059/new/
https://reviews.llvm.org/D71059
Files:
llvm/include/llvm/Support/TimeProfiler.h
llvm/lib/Support/TimeProfiler.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71059.236388.patch
Type: text/x-patch
Size: 7488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200106/3e974768/attachment.bin>
More information about the llvm-commits
mailing list