Commit Graph

55 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 1b42b81549 [Sanitizers Win] Move duplicate Windows-specific compiler flags to a common CMake variable
Reviewed at http://reviews.llvm.org/D3952

llvm-svn: 209889
2014-05-30 12:42:57 +00:00
Timur Iskhodzhanov 82ee0433da [ASan/Win] Use clang rather than clang-cl by default for lit tests. Make Windows-only tests explicitly use clang-cl.
Reviewed at http://reviews.llvm.org/D3893

llvm-svn: 209719
2014-05-28 08:38:13 +00:00
Chandler Carruth 332e1b1909 Exclude MSVC to try to unbreak their builds. We have a bad skew between
how CMake drives a windows link and how our custom command does.

llvm-svn: 208903
2014-05-15 16:33:58 +00:00
Chandler Carruth 57e0ec7d20 Teach the compiler-rt custom compilation and linking CMake rules used
for sanitizers to pass the C++ compilation and exe linking flags through
from the host CMake configuration. We pass the target flags afterward,
allowing them to trump flags as needed. This is particularly important
when the flags direct Clang, even the just-built-Clang, toward the
standard library, linker, and other tools to use.

llvm-svn: 208896
2014-05-15 15:21:11 +00:00
Alexey Samsonov 5af5f8f0b5 [CMake] Log output of configure/build/install steps for instrumented libcxx to reduce noise
llvm-svn: 208632
2014-05-12 21:07:28 +00:00
Timur Iskhodzhanov b0279d7f7d [ASan tests] Use clang-cl to build tests on Windows
Reviewed at http://reviews.llvm.org/D3680

llvm-svn: 208526
2014-05-12 08:55:20 +00:00
Alexey Samsonov eacb4d8417 [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.

llvm-svn: 208451
2014-05-09 22:11:03 +00:00
Alexey Samsonov 56b6ee9833 [ASan] Optional support for dynamic ASan runtime on Linux.
Based on http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov!

llvm-svn: 205308
2014-04-01 13:16:30 +00:00
Alexey Samsonov 78a8435fd6 [CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.
Soon there will be an option to build compiler-rt parts as shared libraries
on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042
by Yuri Gribov.

llvm-svn: 205183
2014-03-31 13:45:36 +00:00
Alexey Samsonov c41ca6d31a [CMake] Rename the variable
llvm-svn: 204602
2014-03-24 13:29:20 +00:00
Alexey Samsonov 1847401332 [CMake] Respect CMAKE_CXX_FLAGS in custom clang_compile commands
llvm-svn: 204593
2014-03-24 09:42:12 +00:00
Greg Fitzgerald 8288afb5fe fixed check_lint.sh in standalone build
Change-Id: I30d340bbe6b2028cc0f831399b62521912dcac60
llvm-svn: 204419
2014-03-21 00:45:21 +00:00
Alexey Samsonov fe7e28c41f [CMake] Use /W3 instead of -Wall on Windows. Remove add_definitions abuse.
llvm-svn: 203786
2014-03-13 11:31:10 +00:00
Alexey Samsonov 32956d651a [CMake] Make append_if semantics similar to those used in LLVM
llvm-svn: 203773
2014-03-13 09:31:36 +00:00
Alexey Samsonov a79696d9bf [CMake] Port add_sanitizer_rt_symbols to CMake 3.0
Patch by Brad King.

Our add_sanitizer_rt_symbols macro reads the LOCATION property of a
library to compute the location of the "lib<name>.a.syms" file to
generate next to the corresponding "lib<name>.a" library file.  CMake
3.0 introduces policy CMP0026 to disallow reading of the LOCATION target
property from non-imported targets in favor of the more powerful
$<TARGET_FILE> generator expression.

Teach add_sanitizer_rt_symbols to use the $<TARGET_FILE> generator
expression to compute the location of the symbols file to generate
with a custom command.  CMake 3.0 also adds support for generator
expressions to install(FILES) so use it when available to simplify
installation of the symbols file of the proper configuration.

llvm-svn: 202797
2014-03-04 08:32:43 +00:00
Alexey Samsonov 72f17afd48 [CMake] Fix add_sanitizer_rt_symbols on multi-config CMake generators.
Patch by Brad King.

When using a multi-config generator with CMake, such as for VS or Xcode,
the LOCATION target property value contains a placeholder such as
"$(Configuration)" that is meant for substitution by the native build
tool. The install(FILES) command does not understand this name and will
not install the symbols file correctly when using these generators.

Teach add_sanitizer_rt_symbols to read the more-specific target property
LOCATION_<CONFIG> that has a per-configuration value and no placeholder.
On single-configuration generators (Makefile, Ninja), CMAKE_BUILD_TYPE
contains the name of the one configuration to be built.  On multi-config
generators (VS, Xcode), CMAKE_CONFIGURATION_TYPES contains the list of
possible configurations.  In the latter case, loop over the configs and
add a configuration-specific install(FILES) rule for each one.

Place the code block inside an if(TRUE) block so it can be made
conditional in a following change without updating indentation.

llvm-svn: 202796
2014-03-04 08:28:43 +00:00
Evgeniy Stepanov 322e89c4e2 [asan] Install asan_device_setup to bin/ when targetting Android.
asan_device_setup is a utility that prepares a device to run code built with
ASan. Essentially, it installs ASan runtime library into the system. For this
reason, it has to be at a predictable relative path from the runtime library
itself. We also plan to distribute this utility, packaged with runtime library
and maybe llvm-symbolizer, to the users.

llvm-svn: 202362
2014-02-27 08:41:40 +00:00
Alexey Samsonov 4cced3e19b [CMake] Make sure add_compiler_rt_resource_file doesn't do unnecessary work
llvm-svn: 202356
2014-02-27 07:22:59 +00:00
Reid Kleckner 0140ce483f Append -D__func__=__FUNCTION__ to SANITIZER_COMMON_CFLAGS
This way it gets picked up for all sanitizer libs, both sanitizer_common
and asan.  I believe those are the only libs that build with asan.
There should be no need to set the __func__ definition inside
clang_compile.

llvm-svn: 202303
2014-02-26 21:54:39 +00:00
Joerg Sonnenberger 2b41390c89 Emulate C99/C++11 __func__ for Visual C++.
llvm-svn: 202296
2014-02-26 20:31:17 +00:00
Alexey Samsonov a2fee5d907 [CMake] Better support for COMPILER_RT_ENABLE_WERROR. Make sure compiler-rt libraries are build by 'make all' command
llvm-svn: 202023
2014-02-24 11:32:49 +00:00
Alexey Samsonov 150d62aa2a [CMake] Use host compiler to build unittests in standalone mode
llvm-svn: 201672
2014-02-19 13:01:03 +00:00
Alexey Samsonov de4ef2a066 [CMake] Rudimentary support for standalone CompilerRT build system.
This change allows to build compiler-rt libraries separately from
LLVM/Clang (path to LLVM build directory should be specified at
configure time). Running tests is not yet supported.

llvm-svn: 201647
2014-02-19 07:49:16 +00:00
Alexey Samsonov 1181a104e6 [CMake] Rename several variables
llvm-svn: 201575
2014-02-18 14:28:53 +00:00
Alexey Samsonov 63a4af7346 [CMake] Add top-level target for each compiler-rt library, and add 'compiler-rt' target encompassing them all.
llvm-svn: 201556
2014-02-18 09:33:45 +00:00
Alexey Samsonov b73db72a17 [CMake] Simplify setting compile flag disabling RTTI
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Chandler Carruth 65fd238772 LLVM's GoogleTest copy has moved its source code back to the default
location, update this reference to reflect that.

llvm-svn: 194802
2013-11-15 10:21:15 +00:00
Alexander Potapenko 49034e3c33 [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
CMake changes to build the ASan runtime for the iOS simulator. This is a universal library targeting the same architectures as the OSX ASan runtime does, thus the iossim version can't live in the same universal libclang_rt.asan_osx_dynamic.dylib

The difference between the OSX and iossim builds is in the -mios-simulator-version-min and -ios_simulator_version_min flags that tell Clang to compile and link iossim code.

The iossim runtime can only be built on a machine with both Xcode and the iOS Simulator SDK installed. If xcodebuild -version -sdk iphonesimulator Path returns a nonempty path, it is used when compiling and linking the iossim runtime.

llvm-svn: 194199
2013-11-07 10:08:19 +00:00
Peter Collingbourne cbdea323ac Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.
Differential Revision: http://llvm-reviews.chandlerc.com/D1984

llvm-svn: 193449
2013-10-25 23:03:34 +00:00
Alexey Samsonov 20abdf69ec Add top-level CMake 'compiler-rt' target to build all compiler-rt libraries
llvm-svn: 191747
2013-10-01 12:52:15 +00:00
Alexey Samsonov 036a5bef2d [ASan] Split ASan unit tests into two different binaries:
(1) instrumented, i.e. compiled and linked with -fsanitize=address
(2) not instrumented, compiled w/o -fsanitize=address and linked with ASan runtime statically.

llvm-svn: 190788
2013-09-16 15:50:53 +00:00
Alexey Samsonov 5a2f073926 [sanitizer] Refine CMake rules for generating exported symbols and lint checking
llvm-svn: 189577
2013-08-29 10:49:04 +00:00
Will Dietz f967d1f947 sanitizer_common: Use PYTHON_EXECUTABLE to choose appropriate python.
Fixes build on systems where 'python' is not python2.

llvm-svn: 189486
2013-08-28 15:53:17 +00:00
Alexey Samsonov acab30e927 Properly generate lists of exported symbols for sanitizer runtimes
This change adds a Python script that is invoked for
the just-built sanitizer runtime to generate the list of exported symbols
passed to the linker. By default, it contains interceptors and sanitizer
interface functions, but can be extended with tool-specific lists.

llvm-svn: 189356
2013-08-27 15:08:02 +00:00
Alexey Samsonov e838135b6c [ASan] create default (empty) ASan blacklist file in resource directory
llvm-svn: 182380
2013-05-21 13:48:27 +00:00
Richard Smith c91e327cba Build and install .syms files alongside sanitizer runtimes. These are used to
specify which symbols are exported to DSOs when the sanitizer is statically
linked into a binary.

llvm-svn: 177784
2013-03-23 00:31:07 +00:00
Alexey Samsonov 5cb7860129 [CMake] set -mmacosx-version-min to 10.7 if compiler-rt is built with -stdlib=libc++
llvm-svn: 174699
2013-02-08 07:39:25 +00:00
Alexey Samsonov 7c362fb1b6 CMake: simplify build rules for compiler-rt unit tests. This fixes warnings in Ninja build tree.
llvm-svn: 173677
2013-01-28 09:07:30 +00:00
Alexey Samsonov 5311754b62 [CMake] Fix compiler-rt tests after r173617
llvm-svn: 173668
2013-01-28 07:16:22 +00:00
NAKAMURA Takumi 385bbc1594 AddCompilerRT.cmake: Try to unbreak since r173617.
llvm-svn: 173619
2013-01-27 14:12:25 +00:00
Alexey Samsonov b399118cad CMake: add functions creating universal runtime libraries for several architectures on OS X and use them in ASan and UBSan build rules
llvm-svn: 173011
2013-01-21 08:12:20 +00:00
Alexey Samsonov 4e50333684 CMake: Add add_compiler_rt_osx_object_library to create universal libraries on Mac
llvm-svn: 172979
2013-01-20 14:36:12 +00:00
Alexey Samsonov 8c2cd862b6 CMake: Add add_compiler_rt_static_runtime function and use it to build generic compiler-rt libraries
llvm-svn: 172977
2013-01-20 13:58:10 +00:00
Alexey Samsonov 163ab9d0a5 CMake: create AddCompilerRT module and implement convenience add_compiler_rt_object_library function
llvm-svn: 172826
2013-01-18 16:05:21 +00:00
Evgeniy Stepanov f45d92bb22 MemorySanitizer unit tests.
llvm-svn: 171062
2012-12-25 12:39:56 +00:00
Alexey Samsonov 53a965e125 [Sanitizer] Don't implicitly add object files to the list of dependencies when building compiler_rt unittests. Fix sanitizer_common and asan build rules accordingly. This also fixes check-sanitizer command on Ninja.
llvm-svn: 170870
2012-12-21 08:56:14 +00:00
Evgeniy Stepanov e243708d6b [*san] Create unittests output directory, if it does not exist.
llvm-svn: 170696
2012-12-20 14:34:09 +00:00
Alexey Samsonov ca7fcf2354 Significantly change the way we build ASan unittests in CMake
build tree. Now just-built Clang is used to:
  1) compile instrumented sources (as before);
  2) compile non-instrumented sources;
  3) compile our own instrumented version of googletest;
  4) link it all together using -fsanitize=address flag
     (instead of trying to copy linker behavior in
      CMake build rules).

This makes ASan unittests pretty much self-consistent
and independent of other LLVM libraries.

llvm-svn: 170541
2012-12-19 12:33:39 +00:00
Chandler Carruth 6acfaaf3aa Remove the old, and non-functional CMake build system from CompilerRT.
I cannot build any part of this successfully on either Linux or Darwin,
and the replacement is worlds simpler by requiring that this be built as
a subproject of LLVM. If this breaks you for any reason, please let me
know, and let me know what your use case is.

llvm-svn: 154059
2012-04-04 22:12:01 +00:00
Edward O'Callaghan 1bafa6de57 Fix cmake test suit for compiler-rt.
llvm-svn: 85339
2009-10-27 23:23:41 +00:00