profile: Add low level versions of profile buffer functions

On Darwin, compiler_rt uses magic linker symbols to find the profile
counters in the __DATA segment.  This is a reasonable method for
normal, hosted, userspace programs.  However programs with custom
memory layouts, such as the kernel, will need to tell compiler_rt
explicitly where to find these sections.

Patch by Lawrence D'Anna. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223840 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Make sure dd is built as a part of compiler-rt.

Remove unused variables and definitions in CMake files
for TSan and DD (deadlock detector).

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223908 91177308-0d34-0410-b5e6-96231b3b80d8
[DD] Don't store the second copy of CommonFlags inside DDFlags.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223909 91177308-0d34-0410-b5e6-96231b3b80d8
builtins: cleanup constant data section selection

Each of the object formats use a different directive for selecting the constant
section.  Use a macro to avoid the duplication across a number of files.  Also
correct a small macro mismatch on the Windows case (HIDDEN_DIRECTIVE -> HIDDEN).

Patch by Vadim Chugunov!

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223910 91177308-0d34-0410-b5e6-96231b3b80d8
[sanitizer] Disable compile-time checks for __kernel_old_uid_t size on aarch64.

Should fix PR21476.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223925 91177308-0d34-0410-b5e6-96231b3b80d8
Update ASan/Win test expectations broken by r223508

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223932 91177308-0d34-0410-b5e6-96231b3b80d8
Fix check-asan on Windows by putting lib/clang/... onto PATH (PR21880)

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224018 91177308-0d34-0410-b5e6-96231b3b80d8
tsan: don't subtract one from fake PCs

These are fake and not actual PCs, more like function IDs.
Pass them to external symbolizer untouched.



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224022 91177308-0d34-0410-b5e6-96231b3b80d8
tsan: fix Go build

GetRSS is used in Go build.



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224023 91177308-0d34-0410-b5e6-96231b3b80d8
[Tsan] Fix the signal_recursive.cc test to pass on systems with high loads
Differential Revision: http://reviews.llvm.org/D6504


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224030 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Fix report_path functionality:

Summary:
  - Make sure mmap() is never called inside RawWrite function.
  - Wrap a bunch of standalone globals in a ReportFile object.
  - Make sure accesses to these globals are thread-safe.
  - Fix report_path functionality on Windows, where
    __sanitizer_set_report_path() would break program.

I've started this yak shaving in order to make
"CommonFlags::mmap_limit_mb" immutable. Currently we drop this flag
to zero before printing an error message.

Test Plan: regression test suite

Reviewers: kcc, glider

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6595

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224031 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Don't modify mmap_limit_mb flag in runtime.

Instead, rely on the fact that RAW_CHECK doesn't call mmap(),
and we'll be able to print an error message and kill a program.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224034 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Change fake stack and local variables handling.

This commit changes the way we get fake stack from ASan runtime
(to find use-after-return errors) and the way we represent local
variables:
  - __asan_stack_malloc function now returns pointer to newly allocated
    fake stack frame, or NULL if frame cannot be allocated. It doesn't
    take pointer to real stack as an input argument, it is calculated
    inside the runtime.
  - __asan_stack_free function doesn't take pointer to real stack as
    an input argument. Now this function is never called if fake stack
    frame wasn't allocated.
  - __asan_init version is bumped to reflect changes in the ABI.
  - new flag "-asan-stack-dynamic-alloca" allows to store all the
    function local variables in a dynamic alloca, instead of the static
    one. It reduces the stack space usage in use-after-return mode
    (dynamic alloca will not be called if the local variables are stored
    in a fake stack), and improves the debug info quality for local
    variables (they will not be described relatively to %rbp/%rsp, which
    are assumed to be clobbered by function calls). This flag is turned
    off by default for now, but I plan to turn it on after more
    testing.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224063 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Group all flag parsing code together. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224087 91177308-0d34-0410-b5e6-96231b3b80d8
[mips] [test] Enable COMPILER_RT_INCLUDE_TESTS for MIPS

Enabling COMPILER_RT_INCLUDE_TESTS and updating tests/sanitizer_allocator_test.cc to remove Allocator64 related tests for MIPS.

Reviewed By: samsonov

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224101 91177308-0d34-0410-b5e6-96231b3b80d8
[Asan] Fix the tsd_dtor_leak.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D6590


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224116 91177308-0d34-0410-b5e6-96231b3b80d8
[Asan] XFAIL the interception_failure_test.cc test on FreeBSD
Differential Revision: http://reviews.llvm.org/D6591


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224117 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Introduce Allocator::may_return_null bool flag.

Summary:
Turn "allocator_may_return_null" common flag into an
Allocator::may_return_null bool flag. We want to make sure
that common flags are immutable after initialization. There
are cases when we want to change this flag in the allocator
at runtime: e.g. in unit tests and during ASan activation
on Android.

Test Plan: regression test suite, real-life applications

Reviewers: kcc, eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6623

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224148 91177308-0d34-0410-b5e6-96231b3b80d8
Use the newer python syntax for exceptions

We've dropped support for python 2.5, so now we can use the forward
compatible "except ... as" syntax.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224181 91177308-0d34-0410-b5e6-96231b3b80d8
Update test case with more accurate column information now that Clang produces same

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