Commit Graph

272 Commits

Author SHA1 Message Date
Chris Bieneman 7d824da189 [CMake] Temporary workaround to support building builtins on darwin with a toolchain that may not support all x86 and arm architectures.
This is at least a little better than my first attempt. We still really need a way to do compile checks without linking.

llvm-svn: 252572
2015-11-10 00:41:18 +00:00
Chris Bieneman 86af9e07ff Revert "[CMake] [macho_embedded] Check to make sure the compiler supports the architectures before generating build targets"
This commit reverts r252525. I was not really thinking about this fix properly. This doesn't work because it relys on try_compile checks which do a full compile & link. I'm going to put in a temporary solution as an interm step until we have a way to perform compiler checks without linking.

llvm-svn: 252569
2015-11-10 00:31:22 +00:00
Chris Bieneman a9437f5135 [CMake] Don't pass -fPIC when compiling the darwin builtins
This change makes CMake match autoconf.

llvm-svn: 252547
2015-11-09 23:48:58 +00:00
Chris Bieneman 7068fc369d [CMake] Fixing a typo in variable name ARG_*->LIB_*
llvm-svn: 252543
2015-11-09 23:37:45 +00:00
Chris Bieneman ccd9419266 [CMake] Removing extra underscore.
Fixing a typo.

llvm-svn: 252534
2015-11-09 23:20:43 +00:00
Chris Bieneman 7ccc6136b9 [CMake] [Darwin] Don't generate lipo commands if we don't have libraries to put into the fat archive.
Not making sure there are thin libraries results in some difficult to diagnose build failures. This check should make those build failures go away.

llvm-svn: 252527
2015-11-09 23:07:45 +00:00
Chris Bieneman 1ad0146498 [CMake] [macho_embedded] Check to make sure the compiler supports the architectures before generating build targets
If we don't check the compiler's capabilities we end up generating build targets that the compiler might not be able to build.

llvm-svn: 252525
2015-11-09 23:05:05 +00:00
Chris Bieneman 472d937db7 [CMake] Need to filter ${arch}/*.c builtins as well as ${arch}/*.S builtins.
This was broken in r248542 when I refactored this to support builtins where ${arch} didn't match the directory prefix (i.e. armv7s).

llvm-svn: 252365
2015-11-06 23:19:29 +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 626f6a057c [CMake] Adding support for generating libclang_rt.eprintf.a
This library provides eprintf for i386 on OS X versions later than 10.4.

llvm-svn: 249913
2015-10-09 22:40:50 +00:00
Chris Bieneman 2c23a80bbf [CMake] [Darwin] [builtins] Need to special case the naming of the OS X cc_kext builtin library.
llvm-svn: 249870
2015-10-09 18:38:34 +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 f9d71a5439 [CMake] [darwin] Removing a line of debug code that I accidentally committed.
llvm-svn: 249278
2015-10-04 15:48:16 +00:00
Chris Bieneman be8b60b602 [CMake] [darwin] [builtins] Add INSTALL_DIR to darwin_lipo_libs
The darwin and macho_embedded libraries get installed to different locations, so we need to feed through an INSTALL_PATH.

llvm-svn: 249199
2015-10-02 22:14:25 +00:00
Chris Bieneman b22351cb18 [CMake] Workaround for the lipo output directory not being created.
This should resolve an issue reported by mclow.

llvm-svn: 249158
2015-10-02 17:37:40 +00:00
Chris Bieneman f0672f1187 [CMake] [builtins] [macho_embedded] Separate out the 64-bit thumb builtins so they don't get included on 'm' architectures. NFC.
This should help make the compiler-rt build less noisy.

llvm-svn: 249084
2015-10-01 22:01:06 +00:00
Chris Bieneman f9e0fe77c7 [CMake] [builtins] [macho_embedded] Don't pass -mfloat-abi=hard flag to x86 because the compiler ignores it and complains.
llvm-svn: 249076
2015-10-01 21:21:19 +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 7bfe1ee428 [CMake] [Darwin] [macho_embedded] Specify the version min explicitly.
We need to set the OS X deployment target on the macho_embedded libraries to match the outputs from the autoconf build system.

llvm-svn: 248944
2015-09-30 21:09:23 +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
Chris Bieneman d208e41030 [CMake] [macho_embedded] We need to set some extra flags when building the macho_embedded builtins.
If we don't specify the arm target the float ABI compiler flags get ignored.

llvm-svn: 248853
2015-09-29 23:21:09 +00:00
Chris Bieneman 6e18e1e39e [CMake] [Darwin] Support building the macho_embedded builtin libraries.
Summary: This ports functionality from the clang_macho_embedded.mk platform makefile over to CMake.

Reviewers: bogner, samsonov, bob.wilson

Subscribers: llvm-commits

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

llvm-svn: 248850
2015-09-29 23:13:45 +00:00
Chris Bieneman 5def2a8a44 [CMake] [Darwin] [builtins] Apply OS and OS-arch filters to cc_kext builtin libraries.
We don't want to filter out the builtins that are present in libSystem like we do for the normal builtins because kexts can't link libSystem, but we should filter out all the builtins that are generally not supported on the OS and architecture.

llvm-svn: 248756
2015-09-28 23:09:46 +00:00
Chris Bieneman 88d8534e87 [CMake] Accidentally committed code that was using a variable only populated in some earlier code. NFC.
llvm-svn: 248752
2015-09-28 22:20:25 +00:00
Chris Bieneman 1341472f92 [CMake] [Darwin] [builtins] Fix building builtins for Darwin simulator platforms.
For Darwin simulator platforms we shouldn't build the cc_kext builtins at all because they aren't applicable, and we should includ the simulator builtins as slices inside the main platform builtin library.

llvm-svn: 248751
2015-09-28 22:18:31 +00:00
Chris Bieneman 8aba4b0589 [CMake] [Darwin] Make darwin_filter_builtin_sources support both whitelist and blacklist filtering.
llvm-svn: 248720
2015-09-28 17:38:44 +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
Chris Bieneman bb62ec2cd6 [CMake] [darwin] [builtins] Make darwin_lipo_libs take OUTPUT_DIR as an option. NFC.
This refactoring will allow me to reuse this function when calling lipo with outputs in different directories.

llvm-svn: 248639
2015-09-25 23:55:53 +00:00
Chris Bieneman cc8c7773c5 [CMake] [darwin] Refactor darwin_read_exclude_file to be reusable. NFC.
Rename darwin_read_exclude_file to more generic darwin_read_list_from_file, and make it take the file path instead of constructing it so it can be reused more freely.

llvm-svn: 248635
2015-09-25 23:29:03 +00:00
Chris Bieneman 905f9fce0a [CMake] [darwin] [builtins] Should install the lipo'd builtin libraries.
On darwin we don't install the single-architecture builtin libraries, but we do need to install the lipo'd ones.

llvm-svn: 248630
2015-09-25 22:39:19 +00:00
Chris Bieneman 75c7c9ce8b [CMake] [darwin] [builtins] Should be reading the OS variable that is passed in, not the bleed through from the function above. NFC.
llvm-svn: 248629
2015-09-25 22:31:17 +00:00
Chris Bieneman 7146f7bcf9 [CMake] [darwin] [cc_kext] In addition to builtin sources the cc_kext builtins include some functions from clang_rt.profile.
llvm-svn: 248548
2015-09-24 22:29:58 +00:00
Chris Bieneman 590a48d4de [CMake] [darwin] [builtins] Refactoring darwin_find_excluded_builtins_list to parse arguments instead of only handling positional arguments.
OS and ARCH must be specified, but minimum version may not. Excluding the minimum version will only apply the filters for builtins not supported by the OS and OS-Arch pair.

llvm-svn: 248543
2015-09-24 21:51:09 +00:00
Chris Bieneman 5fbaeb9e5c [CMake] [darwin] [builtins] Refactoring code to filter builtin lists out into a function. NFC.
llvm-svn: 248542
2015-09-24 21:40:06 +00:00
Chris Bieneman 9b788a452b [CMake] [darwin] [builtins] Match clang_darwin.mk's compiler flags when building builtin libraries
On Darwin we have a very restrictive set of flags used when building the builtins. This change makes CMake match autoconf.

llvm-svn: 248523
2015-09-24 18:26:34 +00:00
Chris Bieneman d983ae0a0e [CMake] pass -Wno-pedantic to cc_kext builtins build
We don't pass -pedantic to the builtin builds in the makefiles, so we shouldn't do it here. This is a temporary fix for the broken bot:

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_build/7526/warnings8Result/new/

A more correct solution is in the works.

llvm-svn: 248515
2015-09-24 16:47:26 +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 01ebf004ff [CMake] [Darwin] Bug 21562 - Add a CMake equivalent for make/platform/clang_darwin.mk in compiler_rt
Summary: First pass at adding cc_kext_* builtin libraries. I need to cleanup and refactor the builtin filtering so that I can use it to filter the builtin symbols list, but this is the first step in the right direction.

Reviewers: bob.wilson, bogner, samsonov

Subscribers: llvm-commits

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

llvm-svn: 248443
2015-09-23 23:05:32 +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
Chris Bieneman 672311b368 [CMake] Make the sample program in darwin_test_archs have a symbol it needs to link.
This resolves an issue building compiler-rt using Xcode 7 that was reported on llvm-dev:

http://lists.llvm.org/pipermail/llvm-dev/2015-September/090245.html

llvm-svn: 247833
2015-09-16 18:29:52 +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 f12cf13f38 [CMake] Add ARCHS option to add_sanitizer_rt_symbols.
Summary:
This is another step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt.

Changes to CMakeLists files are all minimal except ubsan which tests the new ARCHS loop.

Further cleanup patches will follow.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: llvm-commits

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

llvm-svn: 246199
2015-08-27 20:07:54 +00:00
Chris Bieneman 2be86df4b1 [CMake] Add PARENT_TARGET option to add_sanitizer_rt_symbols.
Summary: This is another step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: llvm-commits

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

llvm-svn: 246178
2015-08-27 18:27:33 +00:00
Chris Bieneman bfc74bd3fc [CMake] Converting add_sanitizer_rt_symbols to use cmake_parse_arguments.
Summary: This is the first step in a multi-step refactoring to move add_sanitizer_rt_symbols in the direction of other add_* functions in compiler-rt.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: llvm-commits

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

llvm-svn: 246102
2015-08-26 23:12:25 +00:00
Chris Bieneman 7173f07d70 [CMake] Add OBJECT_LIBS option to add_compiler_rt_runtime, and refactored asan call site to use it.
Summary: This is one more step to allow us to eliminate platform-specific code from the library CMakeLists files. Subsequent patches will refactor all call sites to use this and other new features.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: llvm-commits

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

llvm-svn: 246047
2015-08-26 18:33:51 +00:00
Chris Bieneman d160260681 [CMake] merge add_compiler_rt_runtime and add_compiler_rt_darwin_runtime into a single function
Summary: This refactoring moves much of the Apple-specific behavior into a function in AddCompilerRT. The next cleanup patch will remove more of the if(APPLE) checks in the outlying CMakeLists.

This patch adds a bunch of new functionality to add_compiler_rt_runtime so that the target names don't need to be reconstructed outside the call. It also updates some of the call sites to exercise the new functionality, but does not update all uses fully. Subsequent patches will further update call sites and move to using the new features.

Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov

Subscribers: beanz, rengolin, llvm-commits

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

llvm-svn: 245970
2015-08-25 19:53:09 +00:00
Chris Bieneman 797f5b3683 [CMake] Fixing haswell filtering.
Turns out this wasn't working at all.

llvm-svn: 245713
2015-08-21 18:05:57 +00:00
Chris Bieneman 4268d39436 [CMake] Turns out CMake was passing the space as part of the argument instead of separating two arguments.
llvm-svn: 245624
2015-08-20 22:06:46 +00:00
Chris Bieneman 73107c6122 [CMake] [OS X] Don't require command line tools installations for running compiler-rt tests.
If you're on an Apple platform and /usr/include doesn't exist, we should set a sysroot flag when calling clang.

llvm-svn: 245581
2015-08-20 17:35:56 +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
Filipe Cabecinhas 3e96367e60 [cmake darwin] Use a STATUS message type. Explain where the arches came from.
llvm-svn: 245453
2015-08-19 16:23:19 +00:00
Chris Bieneman 201d065259 [CMake] Refactoring add_compiler_rt functions for darwin runtimes.
Summary: This patch consolidates add_compiler_rt_osx_static_runtime and add_compiler_rt_darwin_dynamic_runtime into a single new function add_compiler_rt_darwin_runtime.

Reviewers: filcab, samsonov, bogner

Subscribers: llvm-commits

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

llvm-svn: 245317
2015-08-18 17:32:18 +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
Filipe Cabecinhas 2bbdbcb835 Fix typo.
llvm-svn: 244475
2015-08-10 18:26:29 +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
Alexey Samsonov 9e694e590c [CMake] One more attempt to fix PR24144.
This time, exclude ExternalProject from build using set_target_properties.

llvm-svn: 242444
2015-07-16 21:20:05 +00:00
Alexey Samsonov 70231d68dc [CMake] Workaround for PR24144: avoid installing libcxx_tsan and libcxx_msan by default "ninja install" command.
Summary:
Exclude external libc++ builds from "all" target, so that they are only
build on demand, and are not installed together with LLVM/Clang.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 242424
2015-07-16 17:53:01 +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
Jay Foad 391e53812a Revert part of r240623 (Enable memory sanitizer for PPC64) because the
buildbots are still failing in check-ubsan.

llvm-svn: 241113
2015-06-30 20:30:19 +00:00
Jay Foad 8677baf024 Enable memory sanitizer for PPC64
Summary:
This patch adds basic memory sanitizer support for PPC64. PR23219.

I have further patches ready to enable it in LLVM and Clang, and to fix
most of the many failing tests in check-msan.

Reviewers: kcc, willschm, samsonov, wschmidt, eugenis

Reviewed By: eugenis

Subscribers: wschmidt, llvm-commits

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

llvm-svn: 240623
2015-06-25 06:22:31 +00:00
Filipe Cabecinhas 7af0a1cb84 CMake: Stop using LLVM's custom parse_arguments. NFC
Summary:
Use CMake's cmake_parse_arguments() instead.
It's called in a slightly different way, but supports all our use cases.
It's in CMake 2.8.8, which is our minimum supported version.

CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc):
http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments

Since I was already changing these calls, I changed ARCH and LIB into
ARCHS and LIBS to make it more clear that they're lists of arguments.

Reviewers: eugenis, samsonov, beanz

Subscribers: llvm-commits

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

llvm-svn: 240120
2015-06-19 03:39:24 +00:00
Alexey Samsonov 2a567835d1 Revert "Revert "[CMake] LSan is not actually available on Darwin.""
Re-land fixed version of r239955.

llvm-svn: 240108
2015-06-19 01:34:06 +00:00
Justin Bogner 66afb72e2a Revert "[CMake] LSan is not actually available on Darwin."
This change makes cmake fail to even run on Darwin with errors
evaluating "$<TARGET_OBJECTS:RTInterception.x86_64>".

This reverts r239955

llvm-svn: 239985
2015-06-18 03:39:51 +00:00
Alexey Samsonov 5cce9e1e59 [CMake] LSan is not actually available on Darwin.
llvm-svn: 239955
2015-06-17 22:24:44 +00:00
Peter Collingbourne 8727100328 SafeStack: Adjust condition for COMPILER_RT_HAS_SAFESTACK to fix sanitizer builds.
llvm-svn: 239840
2015-06-16 18:52:28 +00:00
Peter Collingbourne b64d0b1e6d Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library
This patch adds runtime support for the Safe Stack protection to compiler-rt
(see http://reviews.llvm.org/D6094 for the detailed description of the
Safe Stack).

This patch is our implementation of the safe stack on top of compiler-rt. The
patch adds basic runtime support for the safe stack to compiler-rt that
manages unsafe stack allocation/deallocation for each thread.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

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

llvm-svn: 239763
2015-06-15 21:08:47 +00:00
Chris Bieneman 6bd006f31a [CMake] Cleanup add_compiler_rt_object_library to be platform-agnostic
Summary:
This change takes darwin-specific goop that was scattered around CMakeLists files and spread between add_compiler_rt_object_library and add_compiler_rt_darwin_object_library and moves it all under add_compiler_rt_object_library.

The goal of this is to try to push platform handling as low in the utility functions as possible.

Reviewers: rnk, samsonov

Reviewed By: rnk, samsonov

Subscribers: rnk, rsmith, llvm-commits

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

llvm-svn: 239498
2015-06-10 23:55:07 +00:00
Evgeniy Stepanov cbed1e4f79 [asan] Disable asan for aarch64.
lib/Target/AArch64/AArch64FrameLowering.cpp:370: virtual void llvm::AArch64FrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const: Assertion `!(NeedsRealignment && NumBytes==0) && "NumBytes should never be 0 when realignment is needed"' failed.

llvm-svn: 239352
2015-06-08 21:07:24 +00:00
Evgeniy Stepanov 24196c505b [asan] Enable AArch64 build of ASan runtime and tests.
llvm-svn: 239322
2015-06-08 18:19:26 +00:00
Evgeniy Stepanov 8e9c70be7f Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.
This is done by creating a named shared memory region, unlinking it
and setting up a private (i.e. copy-on-write) mapping of that instead
of a regular anonymous mapping. I've experimented with regular
(sparse) files, but they can not be scaled to the size of MSan shadow
mapping, at least on Linux/X86_64 and ext3 fs.

Controlled by a common flag, decorate_proc_maps, disabled by default.

This patch has a few shortcomings:
* not all mappings are annotated, especially in TSan.
* our handling of memset() of shadow via mmap() puts small anonymous
  mappings inside larger named mappings, which looks ugly and can, in
  theory, hit the mapping number limit.

llvm-svn: 238621
2015-05-29 22:31:28 +00:00
Reid Kleckner aa9029691f Silence some CMake 3.3 dev warnings in compiler-rt
Fix a trivial instance of CMP0054 that came up on llvmdev.

The other warnings were CMP0057, which is about using the same file as a
MAIN_DEPENDENCY multiple times.  The old behavior hasn't been a problem
yet, so I silenced the warning and filed PR23595 to document the issue
if someone cares.

llvm-svn: 237808
2015-05-20 16:56:17 +00:00
Sagar Thakur 3ee5bd9377 [sanitizer][MIPS] Add --target flag for MIPS32
Without the --target flag, clang uses the mips64 triple which selects the n64 abi. We need to add --target=mips-linux-gnu, so that clang can select the correct abi for mips32r2.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9249

llvm-svn: 237675
2015-05-19 09:07:37 +00:00
Evgeniy Stepanov e8b9d791c2 [asan] Use a version script to limit the symbols exported by the ASan shared runtime library.
llvm-svn: 236551
2015-05-05 22:51:35 +00:00
Evgeniy Stepanov 91960900f8 Build ASan runtime library with -z global on Android.
llvm-svn: 236537
2015-05-05 20:13:39 +00:00
Daniel Sanders ffa272ebbb [mips] Support building compiler-rt with gcc.
Summary:
This will allow us to enable it on the buildbot (and then enable a
sanitizer buildbot).

The problem is that gcc for Mips does not accept -m32/-m64 like clang does.
We therefore need to use the nearest equivalent -mips32r2/-mips64r2. We must
also specify -mabi=64 in the -mips64r2 case since gcc's default ABI has
traditionally been N32 whereas clang's is N64.

Reviewers: sagar

Reviewed By: sagar

Subscribers: llvm-commits, samsonov, kcc, mohit.bhakkad, Anand.Takale, sagar

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

llvm-svn: 235299
2015-04-20 12:44:01 +00:00
Sagar Thakur bcc495abc8 test commit
llvm-svn: 235176
2015-04-17 10:14:16 +00:00