[compiler-rt] r243599 - [Sanitizer] Replace diagnostic string literal to workaround CMake 2.8 bug.

Kostya Serebryany kcc at google.com
Wed Jul 29 18:02:28 PDT 2015


WAT!?




On Wed, Jul 29, 2015 at 5:50 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:

> Author: samsonov
> Date: Wed Jul 29 19:50:40 2015
> New Revision: 243599
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243599&view=rev
> Log:
> [Sanitizer] Replace diagnostic string literal to workaround CMake 2.8 bug.
>
> Let me tell you a story. Suppose you want to build your project (e.g. LLVM)
> with CMake 2.8, Clang and AddressSanitizer. You also want to ensure that
> Clang is fresh enough and check that CMAKE_CXX_COMPILER_VERSION is 3.1+.
> This check would fail - CMake would fail to correctly calculate compiler
> version if you pass CMAKE_CXX_FLAGS=-fsanitize=address.
>
> The problem is funky compiler version calculation in
> CMakeDetermineCompilerId.cmake module: it compiles the sample source
> file with provided compiler and compile flags, runs "strings" and greps
> for "INFO:" ASCII strings contained on the executable to fetch
> "INFO:compiler", "INFO:compiler_version" etc. It limits the output of
> grep to just 4 lines.
>
> Unfortunately, if your executable was built with ASan, it would also
> contain
> an ASCII string
>   INFO: %s ignores mlock/mlockall/munlock/munlockall
> and INFO:compiler_version string would never be parsed.
>
> All of the above actually happened after r243574 when we tried to
> configure libcxx with just-built Clang with TSan/MSan, and the version
> check mentioned above failed in HandleLLVMOptions.cmake
>
> (╯°□°)╯.~.┻━┻
>
> Modified:
>
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=243599&r1=243598&r2=243599&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> (original)
> +++
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> Wed Jul 29 19:50:40 2015
> @@ -4957,7 +4957,7 @@ static void MlockIsUnsupported() {
>    static atomic_uint8_t printed;
>    if (atomic_exchange(&printed, 1, memory_order_relaxed))
>      return;
> -  VPrintf(1, "INFO: %s ignores mlock/mlockall/munlock/munlockall\n",
> +  VPrintf(1, "%s ignores mlock/mlockall/munlock/munlockall\n",
>            SanitizerToolName);
>  }
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150729/6763ece1/attachment.html>


More information about the llvm-commits mailing list