Commit Graph

120 Commits

Author SHA1 Message Date
Chris Bieneman e82ad46f15 [CMake] Provide options for toggling on and off various runtime libraries.
Summary:
Rather than having to add new "experimental" options each time someone wants to work on bringing a sanitizer to a new platform, this patch makes options for all of them.

The default values for the options are set by the platform checks that would have enabled them, but they can be overridden on or off.

Reviewers: kubabrecka, samsonov

Subscribers: llvm-commits

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

llvm-svn: 255170
2015-12-09 22:45:03 +00:00
Sumanth Gundapaneni dbb8a1d8e7 Fix the target specific "-msse3" flag check in CMake. NFC
msse3 is a target dependent flag and must be guarded as check_cxx_compiler_flag()
checks only for compiler error messages and ignores warnings. Earlier COMPILER_RT_HAS_MSSE3_FLAG
is set to "TRUE" for all targets as clang emits warnings and the compilation spits unnecessary 
warnings for non-X86 targets. This issue is fixed by coupling the flag with "-Werror"

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

llvm-svn: 255165
2015-12-09 22:26:38 +00:00
Bill Schmidt 2979162732 [PPC64, TSAN] LLVM basic enablement of thread sanitizer for PPC64 (BE and LE)
This patch is by Simone Atzeni with portions by Adhemerval Zanella.

This contains the LLVM patches to enable the thread sanitizer for
PPC64, both big- and little-endian.  Two different virtual memory
sizes are supported:  Old kernels use a 44-bit address space, while
newer kernels require a 46-bit address space.

There are two companion patches that will be added shortly.  There is
a Clang patch to actually turn on the use of the thread sanitizer for
PPC64.  There is also a patch that I wrote to provide interceptor
support for setjmp/longjmp on PPC64.

Patch discussion at reviews.llvm.org/D12841.

llvm-svn: 255057
2015-12-08 21:54:39 +00:00
Chris Bieneman 4604ece66b [CMake] Adding simulator supported runtimes should be done in the block that tests simulator capabilities.
Not sure why I put this in the iOS block originally, it shouldn't be there.

llvm-svn: 255046
2015-12-08 19:31:33 +00:00
Alexey Samsonov d20a13023b [TSan] Enforce TSan runtime doesn't include system headers with --sysroot flag.
llvm-svn: 254966
2015-12-07 23:21:36 +00:00
Kuba Brecka 74775eb5da [tsan] Enable ThreadSanitizer on OS X builds by default, take 2
Second attempt to enable building ThreadSanitizer (and running tests) on OS X by default.

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

llvm-svn: 254603
2015-12-03 11:02:43 +00:00
Kuba Brecka 1e9fd96c4c Revert r254417 ("[tsan] Enable Thread Sanitizer on OS X builds by default").
A ton of tests fail on OS X 10.10, because dyld auto-interposition is only available in 10.11.

llvm-svn: 254420
2015-12-01 15:56:38 +00:00
Kuba Brecka 6c800eb3f0 [tsan] Enable Thread Sanitizer on OS X builds by default
Differential Revision: http://reviews.llvm.org/D15109

llvm-svn: 254417
2015-12-01 15:00:16 +00:00
Chris Bieneman 9586a38870 [CMake] Moving -fvisibility-inlines-hidden append as per post-commit review
Thanks Alexey.

llvm-svn: 254316
2015-11-30 19:16:42 +00:00
Chris Bieneman 9b6d4ffdf9 [CMake] Add -fvisibility-inlines-hidden if the compiler supports it.
This results in a significant reduction in the size of the sanitizer libraries.

llvm-svn: 254308
2015-11-30 17:42:30 +00:00
Chris Bieneman 01ec64499c [CMake] Add iOS simulator to the supported OS list for the profile library.
We already support this in autoconf and it ships in Apple Clang.

llvm-svn: 253709
2015-11-20 20:56:02 +00:00
George Burgess IV 362352c6be Attempt to fix build breakage caused by r253646.
Apparently check_c_compiler_flag isn't a thing everywhere. Not being
incredibly well-versed in cmake, I'm hoping that check_cxx_compiler_flag
serves a similar purpose. :)

llvm-svn: 253648
2015-11-20 05:02:08 +00:00
George Burgess IV b47c02f39b Silence "unrecognised -std=c99" warning on MSVC.
Thanks to angelsl for the patch!

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

llvm-svn: 253646
2015-11-20 03:37:12 +00:00
Kuba Brecka c47620a838 [tsan] Add TSan unit test support for OS X
This patch enables building and running TSan unit tests on OS X.

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

llvm-svn: 252731
2015-11-11 14:53:57 +00:00
Kuba Brecka c9249498ce [tsan] CMake support for TSan on OS X
Hi, this patch adds a CMake flag called `COMPILER_RT_ENABLE_TSAN_OSX`, which is off by default. If enabled, the build system will be building the OS X version of the TSan runtime library (called `libclang_rt.tsan_osx_dynamic.dylib`). I'll submit patches that fix OS X build errors shortly.

This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point.

llvm-svn: 251915
2015-11-03 14:13:59 +00:00
Adhemerval Zanella b0d5dd0199 [lsan] [aarch64] Add support for AArch64
This patch add support for leak sanitizer for aarch64.  Similar to
MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64
currently supports 39 and 42-bit VMA).

It also fixes the android build issue.

llvm-svn: 250898
2015-10-21 13:08:06 +00:00
Chris Bieneman 4ebd15726f [CMake] [darwin] [builitins] Don't build x86_64h into the 10.4 builtins library
There is no haswell support in 10.4, so we don't need a 10.4 builtin library.

llvm-svn: 249868
2015-10-09 18:32:34 +00:00
Chris Bieneman 3a1ad39702 [CMake] [Darwin] [Builtins] Fixing a typo that was keeping the OS X 10.4 builtins library from being built properly.
llvm-svn: 249844
2015-10-09 16:47:43 +00:00
Evgeniy Stepanov 437615639f Revert "[lsan] [aarch64] Add support for AArch64"
This reverts commit ea02fa45225c35613bfecab383fb526e24b74497 (r249337).

Reason: broken "ninja AsanUnitTests" on Android/AArch64.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/20675/steps/build%20compiler-rt%20android%2Faarch64/logs/stdio

llvm-svn: 249730
2015-10-08 20:08:30 +00:00
Vasileios Kalintiris 0943a95f46 [builtins] Enable building of the builtins library for MIPS targets.
Reviewers: howard.hinnant, samsonov

Subscribers: samsonov, dsanders, llvm-commits

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

llvm-svn: 249382
2015-10-06 09:02:38 +00:00
Adhemerval Zanella 5ea8dcb8cf [lsan] [aarch64] Add support for AArch64
This patch add support for leak sanitizer for aarch64.  Similar to
MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64
currently supports 39 and 42-bit VMA).

llvm-svn: 249337
2015-10-05 19:16:09 +00:00
Chris Bieneman adfe26fdbd [CMake] Only build the simulator builtins if you're also building the device builtins.
This matters because simulator builtins get lipo'd together with the device builtins into a single static archive per-platform.

llvm-svn: 249056
2015-10-01 19:26:26 +00:00
Chris Bieneman 291723353a [CMake] Only add an OS to the supported OS lists if there are supported architectures for that OS.
llvm-svn: 249054
2015-10-01 18:58:59 +00:00
Chris Bieneman b1ff6e4260 [CMake] [Darwin] Add and populate PROFILE_SUPPORTED_OS to enable building libclang_rt.profile for iOS.
llvm-svn: 248948
2015-09-30 21:23:22 +00:00
Chris Bieneman af01508cc3 [CMake] [Darwin] [builtins] Add support for building libclang_rt.10.4.a
This builtin library is used when setting the OS X deployment target to 10.4, which we still support.

llvm-svn: 248940
2015-09-30 20:26:14 +00:00
Chris Bieneman d823302483 [CMake] [Darwin] [builtins] Change condition for skipping cc_kext to be setting based.
This is needed because we need to skip cc_kext generation for more than just the simulator builds.

llvm-svn: 248939
2015-09-30 20:25:10 +00:00
Saleem Abdulrasool f88e4fabb5 build: separate flags
This somehow worked with the build on Linux, but seems to fail on the buildbots.
Split the flags apart here as otherwise the two flags are treated as one, and
cause a compilation failure.

llvm-svn: 248654
2015-09-26 04:40:45 +00:00
Saleem Abdulrasool 96c5023e53 build: create two versions of ARM builtins
This adds a new name for ARM32 (armhf).  We now force that the default build for
ARM32 (arm) to be soft-float ABI.  This has a corresponding clang change to look
for these names based on the floating point ABI.  The functions are built
identically (the functions are marked as AAPCS, so the calling convention does
not change, as per the RTABI specification), however, the object file contains
attributes indicating the build configuration which the linker will ensure are
not mix and matched.  We now built the appropriate named archive so that we can
link properly.

llvm-svn: 248648
2015-09-26 03:26:01 +00:00
Vasileios Kalintiris 22db068008 Be consistent in the way we define 32/64-bit arches in ALL_*_SUPPORTED_ARCH variables. NFC.
Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 248514
2015-09-24 16:45:58 +00:00
Chris Bieneman 0d427986f5 [CMake] [Darwin] Bug 21562 - Add a CMake equivalent for make/platform/clang_darwin.mk in compiler_rt
Summary:
Building the builtins on Darwin platforms is a bit complicated. This is a first-pass implementation of the functionality from clang_darwin.mk into CMake.

When building the builtins on Darwin we have layers of blacklists that we apply based on platform, architecture, and minimum supported OS version.

Reviewers: bogner, filcab, bob.wilson, samsonov

Subscribers: llvm-commits

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

llvm-svn: 248383
2015-09-23 15:18:17 +00:00
Adhemerval Zanella 19074450ee [MSan] Enable MSAN for aarch64
This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA.
As defined by lib/msan/msan.h the memory layout used is for 39-bit is:

   00 0000 0000 - 40 0000 0000:  invalid
   40 0000 0000 - 43 0000 0000:  shadow
   43 0000 0000 - 46 0000 0000:  origin
   46 0000 0000 - 55 0000 0000:  invalid
   55 0000 0000 - 56 0000 0000:  app (low)
   56 0000 0000 - 70 0000 0000:  invalid
   70 0000 0000 - 80 0000 0000:  app (high)

And for 42-bit VMA:

   000 0000 0000 - 100 0000 0000:  invalid
   100 0000 0000 - 11b 0000 0000:  shadow
   11b 0000 0000 - 120 0000 0000:  invalid
   120 0000 0000 - 13b 0000 0000:  origin
   13b 0000 0000 - 2aa 0000 0000:  invalid
   2aa 0000 0000 - 2ab 0000 0000:  app (low)
   2ab 0000 0000 - 3f0 0000 0000:  invalid
   3f0 0000 0000 - 400 0000 0000:  app (high)

Most of tests are passing with exception of:

   * Linux/mallinfo.cc
   * chained_origin_limits.cc
   * dlerror.cc
   * param_tls_limit.cc
   * signal_stress_test.cc
   * nonnull-arg.cpp

The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8'
instead of default first argument 'x1'.  So a function prototype that
aims  to mimic (by using first argument as the return of function) won't
work. For GCC one can make a register alias (register var asm ("r8")), but
for clang it detects is an unused variable and generate wrong code.

The 'chained_origin_limits' is probably due a wrong code generation,
since it fails only when origin memory is used
(-fsanitize-memory-track-origins=2) and only in the returned code
(return buf[50]).

The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic
argument handling in memory sanitizer code instrumentation on LLVM side.

Both 'dlerror' and 'param_tls_test' are unknown failures that require
further investigation.

All the failures are XFAIL for aarch64 for now.

llvm-svn: 247809
2015-09-16 15:12:25 +00:00
Alexey Samsonov 63eaeca7d0 [CMake] Remove all uses of LLVM_NATIVE_ARCH.
Instead, assume we're going to target triple specified by
COMPILER_RT_DEFAULT_TARGET_TRIPLE and build runtimes for this triple
(and hope that the host compiler can target them).

This will help users that use cross-compiler on their host to build
Clang that would work on a different architecture. This will also come in
handy if one would want to configure several compiler-rt build trees on
the same host, using just-built Clang that can target many
architectures.

This doesn't change the behavior in the default build configuration.

llvm-svn: 247099
2015-09-08 23:13:47 +00:00
Alexey Samsonov 0d0200d727 [CMake] Rename COMPILER_RT_TEST_TARGET_TRIPLE to more appropriate COMPILER_RT_DEFAULT_TARGET_TRIPLE.
llvm-svn: 247094
2015-09-08 22:48:35 +00:00
Chris Bieneman 9e6af15890 [CMake] Enable building builtins for iOS and iOS simulator.
Building iOS does respect COMPILER_RT_ENABLE_IOS.

llvm-svn: 246501
2015-08-31 22:26:02 +00:00
Chris Bieneman b38affa474 [CMake] Fix building builtins on Linux and Darwin.
Summary:
I broke building the builtins with r245967. This fixes them on Linux and builds them properly for Darwin.

The old code could not be made to work on Darwin as a result of the refactoring of add_compiler_rt_runtime, so I had to rework the way they are built for Darwin. This solution is not ideal and will be fixed in subsequent commits. I just want to get this in so everything is working again.

Reviewers: samsonov, chh, compnerd, bogner

Subscribers: llvm-commits

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

llvm-svn: 246487
2015-08-31 21:24:50 +00:00
Adhemerval Zanella 15db6dc2fb [compiler-rt] [tsan] Enable TSan for AArch64/42-bit VMA
This patch adds support for tsan on aarch64-linux with 42-bit VMA
(current default config for 64K pagesize kernels).  The support is
enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time
for both clang/llvm and compiler-rt.  The default VMA is 39 bits.

It also enabled tsan for previous supported VMA (39).

llvm-svn: 246330
2015-08-28 20:40:50 +00:00
Chris Bieneman 5eae197ab0 [CMake] Fix building unit tests on Darwin
Summary:
There are a number of issues with unit tests on Darwin. These patches address the following:
* Unit tests should be passed -arch (-m32/-m64 isn't sufficient)
* Unit tests should be passed ${DARWIN_osx_CFLAGS} because they're being built for OS X
* Test architectures should be filtered based on base system capabilities (i.e. don't try running x86_64h tests on pre-haswell hardware).

Reviewers: bogner, filcab, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 245580
2015-08-20 17:32:06 +00:00
Chris Bieneman 361231ecd5 [CMake] Add experimental support for building compiler-rt for iOS
Summary:
This is a reunification of three separate reviews D11073, D11082, D11083.

Having them separate was not constructive even though the patches were smaller because it led to fragmented conversations, and this is really all about one change.

This patch incorporates feedback from samsonov, and refactors the hacky darwin code out of the root CMakeLists.txt and int config-ix.cmake.

Reviewers: zaks.anna, bogner, kubabrecka, chandlerc, samsonov

Subscribers: jevinskie, filcab, llvm-commits

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

llvm-svn: 244948
2015-08-13 20:38:16 +00:00
Renato Golin 827a40b944 [Compiler-RT] Disable TSAN on AArch64 temporarily
Until all problems with the buildbot can be identified and fixed.

llvm-svn: 244324
2015-08-07 15:41:43 +00:00
Adhemerval Zanella d7984710ae [tsan] Enable tsan for aarch64
This patch enabled TSAN for aarch64 with 39-bit VMA layout.  As defined by
tsan_platform.h the layout used is:

0000 4000 00 - 0200 0000 00: main binary
2000 0000 00 - 4000 0000 00: shadow memory
4000 0000 00 - 5000 0000 00: metainfo
5000 0000 00 - 6000 0000 00: -
6000 0000 00 - 6200 0000 00: traces
6200 0000 00 - 7d00 0000 00: -
7d00 0000 00 - 7e00 0000 00: heap
7e00 0000 00 - 7fff ffff ff: modules and main thread stack

Which gives it about 8GB for main binary, 4GB for heap and 8GB for
modules and main thread stack.

Most of tests are passing, with the exception of:

 * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for
   no support to make mmap page non-executable.

 * longjmp tests due missing specialized assembly routines.

These tests are xfail for now.

The only tsan issue still showing is:

  rtl/TsanRtlTest/Posix.ThreadLocalAccesses

Which still required further investigation.  The test is disable for
aarch64 for now.

llvm-svn: 244055
2015-08-05 15:17:59 +00:00
Adhemerval Zanella 975998bf6a [asan] Enable asan for aarch64
This patch enables asan for aarch64/linux.  It marks it as 'unstable-release',
since some tests are failing due either kernel missing support of non-executable
pages in mmap or environment instability (infinite loop in juno reference
boards).

It sets decorate_proc_maps test to require stable-release, since the test expects
the shadow memory to not be executable and the support for aarch64 is only
added recently by Linux (da141706aea52c1a9 - 4.0).

It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call
as a TLS optimization.

llvm-svn: 244054
2015-08-05 15:13:33 +00:00
Adhemerval Zanella 4e3b4ac241 [dfsan] Enable dfsan for aarch64
This patch enable DFSan for AArch64 (39-bit VMA).  All tests are passing
but:

 * test/dfsan/custom.cc

Due an invalid access in dl_iterate_phdr instrumentation (commenting out
this function make the testcase to pass).  The test is XFAIL for aarch64
for now.

llvm-svn: 243688
2015-07-30 21:13:21 +00:00
Nico Weber e099213481 Revert r243604, it (very likely) caused PR24312.
llvm-svn: 243615
2015-07-30 03:41:05 +00:00
Hans Wennborg 78bea23be0 [CMake] Pass -march=i686 when targeting i686 (PR24222)
Clang will not define __i686__, even when the target triple is i686,
without -march=i686.

With this patch, the compiler-rt build will successfully detect that
Clang can target i686.

The open_memstream.cc test is a little funny. Before my patch, it
was invoked with "-m32 -m64". To make it work after my -march
change, I had to add '-march=x86-64'.

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

llvm-svn: 243604
2015-07-30 01:45:17 +00:00
Alexey Samsonov 398a301893 [CMake] Workaround for PR24222: don't fail if we can't target COMPILER_RT_TEST_TARGET_TRIPLE unless it was explicitly set.
Summary:
Although we assume that we can always target host triple, relax
this check to avoid failing at configure-time for cases when we are
not able to correctly infer/verify host triple for some reasons.

See http://llvm.org/bugs/show_bug.cgi?id=24222 for more details.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 243170
2015-07-24 22:01:07 +00:00
Evgeniy Stepanov 7fb865ea8e [asan] Only link liblog on Android when it exists.
With r242975, liblog is only used on certain older platforms.

llvm-svn: 243139
2015-07-24 19:00:16 +00:00
Evgeniy Stepanov abb966d57e [asan] Enable build of asan-rt on android/aarch64.
llvm-svn: 242966
2015-07-22 23:31:50 +00:00
Peter Collingbourne d3b9917d85 Re-apply r241217 with build fixes:
- Disable building of the interceptor library on 64-bit Windows.
- Mangle names in /alternatename directive for 32-bit Windows.

llvm-svn: 241224
2015-07-02 01:44:34 +00:00
Nico Weber 41acb31623 Revert r241217, it breaks the build on Windows.
llvm-svn: 241219
2015-07-02 01:10:03 +00:00
Peter Collingbourne 191116f3eb ubsan: Port runtime library to (32- and 64-bit) Windows.
Differential Revision: http://reviews.llvm.org/D10856

llvm-svn: 241217
2015-07-02 00:35:47 +00:00