[CMake] Use ExternalProject to build MSan-ified version of libcxx for unit tests.

This change lets MSan rely on libcxx's own build system instead of manually
compiling its sources and setting up all the necessary compile flags. It would
also simplify compiling libcxx with another sanitizers (in particular, TSan).

The tricky part is to make sure libcxx is reconfigured/rebuilt when Clang or
MSan runtime library is changed. "clobber" step used in this patch works well
for me, but it's possible it would break for other configurations - will
watch the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208451 91177308-0d34-0410-b5e6-96231b3b80d8
InstrProf: Test the functions in the runtime

Check that the profile runtime works as expected.  This tests the
functions that are meant to be available to advanced users.

In particular, check that the `atexit()` hook can be disabled by
defining a custom `__llvm_profile_runtime` variable, that the libc
dependencies are optional, and that the various functions for writing
out files work for basic cases.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208460 91177308-0d34-0410-b5e6-96231b3b80d8
InstrProf: Pacify buildbots after r208460

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208462 91177308-0d34-0410-b5e6-96231b3b80d8
InstrProf: Remove redundant declaration

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208464 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] fix a self deadlock when printing stats; add a relevant test, cleanup that test while at it to remove linux/darwin differences. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=306

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208525 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Use clang-cl to build tests on Windows

Reviewed at http://reviews.llvm.org/D3680

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208526 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] define ASAN_DYNAMIC=1 if PIC is defined

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208530 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Further fix the test from r208333.

Remove a debug print and some copypasta.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208535 91177308-0d34-0410-b5e6-96231b3b80d8
[tsan] force tls_model='initial-exec' for tsan's cur_thread_placeholder so that we don't depend on the compiler flags

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208536 91177308-0d34-0410-b5e6-96231b3b80d8
Add FreeBSD support to address sanitizer process mapping facilities

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208537 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] one more attempt to enable lsan by default (PR19521)

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208545 91177308-0d34-0410-b5e6-96231b3b80d8
Define CRT_HAS_128BIT even for PPC32

r201909, which introduced CRT_HAS_128BIT, unintentionally broke self-hosting on
PPC32. We used to define CRT_HAS_128BIT only on LP64 systems, but this is not
quite right (at least for Clang-compiled code). Even though __int128 is not
supported on PPC32, SROA can (and does) still form i128 variables at the IR
level, and operations on those variables may turn into the associated runtime
calls. As a result, we still need to compile __ashlti3, __ashrti3, __lshrti3,
and perhaps others, on PPC32.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208560 91177308-0d34-0410-b5e6-96231b3b80d8
[asan] Move the "coverage" flag to common flags.

The implementation lives in sanitizer_common and will need to access that flag.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208566 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208568 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Also define USED/UNUSED in lib/sanitizer_common/sanitizer_internal_defs.h if Clang is used on Windows

Otherwise we end up with macro redefinition warnings

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208571 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Don't run FakeStack.CreateDestroy on Windows as it OOMs

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208572 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Exclude/simplify a bunch of tests to make them build on Windows

(This also requires D3720, D3725 and a few more small changes to land)

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208573 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Add references to the issue tracker about malloc/free/new/delete mismatch check on Mac and Windows

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208574 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan tests] Don't define __asan_default_options in tests on Windows as it is not supported

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208575 91177308-0d34-0410-b5e6-96231b3b80d8
[CompilerRT] use .p2align, .balign instead of .align

The .align statements in ARM assembly routines is actually meant to be a power
of 2 alignment (e.g. .align 2 == 4 byte alignment, not 2).  Switch to using
.p2align.  .p2align is guaranteed to be a power-of-two alignment always and much
more explicit.

The .align in the case of x86_64 is byte alignment, use .balign instead of
.align.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208578 91177308-0d34-0410-b5e6-96231b3b80d8