[llvm] r301007 - [libFuzzer] Changing thread_local to __thread in libFuzzer

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 11:46:18 PDT 2017


Hi Kostya,

Additionally, on one of the windows buildbots libfuzzer compilation fails due to __builtin_bswapX not available.
Would it be a good idea to #ifdef around that and do a manual slower implementation otherwise?

As for the thread_local replacement, I’ll look into that, seems easiest to only apply the replacement for older Apple machines.
I’m more surprised it worked in the first place, since IIRC C++11 standard does not allow redefining keywords. 

George

> On Apr 21, 2017, at 11:22 AM, Kostya Serebryany <kcc at google.com> wrote:
> 
> yes, see it. thanks! 
> 
> On Fri, Apr 21, 2017 at 11:22 AM, Kuba Mracek <mracek at apple.com <mailto:mracek at apple.com>> wrote:
> We've reverted the patch that tries to build libFuzzer by default.
> 
> We'll look into that.
> 
> Kuba
> 
>> On 21 Apr 2017, at 11:17, Kostya Serebryany via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> 
>> Breaks on windows. 
>> In file included from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\yvals.h:7:
>> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xkeycheck.h(250,5):  error: The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.
>>    #error The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.
>>     ^
>> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/10026/steps/build%20LLVMFuzzer/logs/stdio <http://lab.llvm.org:8011/builders/sanitizer-windows/builds/10026/steps/build%20LLVMFuzzer/logs/stdio>
>> 
>> Why did the cmake check on windows decide to use the -D hack?
>> 
>> 
>> 
>> On Fri, Apr 21, 2017 at 10:39 AM, Kuba Mracek via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> Author: kuba.brecka
>> Date: Fri Apr 21 12:39:50 2017
>> New Revision: 301007
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=301007&view=rev <http://llvm.org/viewvc/llvm-project?rev=301007&view=rev>
>> Log:
>> [libFuzzer] Changing thread_local to __thread in libFuzzer
>> 
>> Old Apple compilers do not support thread_local keyword. This patch adds -Dthread_local=__thread when the compiler doesn't support thread_local.
>> 
>> Differential Revision: https://reviews.llvm.org/D32312 <https://reviews.llvm.org/D32312>
>> 
>> 
>> Modified:
>>     llvm/trunk/lib/Fuzzer/CMakeLists.txt
>> 
>> Modified: llvm/trunk/lib/Fuzzer/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/CMakeLists.txt?rev=301007&r1=301006&r2=301007&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/CMakeLists.txt?rev=301007&r1=301006&r2=301007&view=diff>
>> ==============================================================================
>> --- llvm/trunk/lib/Fuzzer/CMakeLists.txt (original)
>> +++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Fri Apr 21 12:39:50 2017
>> @@ -1,3 +1,16 @@
>> +include(CheckCXXSourceCompiles)
>> +
>> +CHECK_CXX_SOURCE_COMPILES("
>> +    static thread_local int blah;
>> +    int main() {
>> +      return 0;
>> +    }
>> +    " HAS_THREAD_LOCAL)
>> +
>> +if( NOT HAS_THREAD_LOCAL )
>> +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Dthread_local=__thread")
>> +endif()
>> +
>>  set(LIBFUZZER_FLAGS_BASE "${CMAKE_CXX_FLAGS}")
>>  # Disable the coverage and sanitizer instrumentation for the fuzzer itself.
>>  set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters -Werror")
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170421/bb087320/attachment.html>


More information about the llvm-commits mailing list