Commit Graph

67 Commits

Author SHA1 Message Date
Alexander Potapenko 2b00289bd6 [ASan] Use -isysroot instead of -Wl,-syslibroot to link the ASan iossim runtime
(-Wl,-syslibroot was accidentally overridden by -isysroot from Clang on OSX 10.9)

-isysroot is a Clang/LLVM-GCC-specific option, but hosting libsanitizer for LLVM
with GCC on Darwin shouldn't work anyway, because of the missing blocks support.

llvm-svn: 195132
2013-11-19 14:58:42 +00:00
Alexey Samsonov 4985d5274a [DFSan] Don't include public headers in dfsan runtime code
Summary:
Definitions we use in public sanitizer headers may
slightly conflict with the ones we use in private sanitizer runtimes.
Moreover, we generally forbid to include any system headers (like <stdint.h>)
in sanitizer runtime headers. This leads to inevitable duplication of selected
interface function declarations, but we decided to live with it.

Reviewers: pcc

Reviewed By: pcc

CC: kcc, llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2179

llvm-svn: 194955
2013-11-17 09:41:47 +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 06379b3537 [TSan] Add a couple of compiler warnings to TSan runtime compile flags
llvm-svn: 189581
2013-08-29 12:08:36 +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
Hans Wennborg f8e56278ed cmake: Add /Oy- (don't omit frame pointer) to compile flags
llvm-svn: 189488
2013-08-28 16:14:59 +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
Hans Wennborg 67c6e5041b cmake: fix the compiler-rt build with MSVC
This sets flags and excludes things that aren't working with MSVC yet,
allowing us to build the ASan runtime as part of the cmake build.

Differential Revision: http://llvm-reviews.chandlerc.com/D1525

llvm-svn: 189304
2013-08-27 01:24:01 +00:00
Alexey Samsonov eb7973246f [ASan] Bump min supported Mac OS X version to 10.6
llvm-svn: 186404
2013-07-16 11:54:40 +00:00
Alexey Samsonov dd8872b1d2 Always set -m32/-m64 flags for targeting i386/x86_64 respectively. Apparently, there are platforms where the clang defaults are different from gcc
llvm-svn: 185287
2013-06-30 16:21:32 +00:00
Alexey Samsonov 575c599554 Drop support for 32-bit PowerPC in sanitizer tools.
llvm-svn: 183499
2013-06-07 09:44:43 +00:00
Alexey Samsonov 6a65b18992 [ASan] lit tests: create common autogenerated config for running compiler-rt lit tests, and use it in ASan
llvm-svn: 183400
2013-06-06 12:35:48 +00:00
Evgeniy Stepanov ab25369d04 [sanitizer] Interceptors for gethostbyname and friends.
llvm-svn: 182573
2013-05-23 11:10:23 +00:00
Peter Collingbourne 5829a98c48 [nolibc] Disable the GCC stack protector when building sanitizer runtimes.
This is the first in a sequence of changes designed to eliminate the
libc dependency in sanitizer_common.  The main motivation for these
changes is to be able to provide an alternative for the current
interceptor-based technique for instrumenting functions in libc.
In this new technique, we compile libc with instrumentation.  This has
the potential advantages of being more accurate than interception and
reducing the amount of custom code required for each libc function.
As a side effect of this, we cannot depend on libc in the sanitizer
runtime due to mutual dependency issues.

This change disables the GCC stack protector, which introduces a libc
dependency and is enabled by default in Ubuntu.

Differential Revision: http://llvm-reviews.chandlerc.com/D755

llvm-svn: 181422
2013-05-08 10:39:05 +00:00
Alexey Samsonov 9f3938e271 Explicitly list all sanitizer headers in CMake build rules. Make sure sanitizer lit_tests depend on fresh headers.
llvm-svn: 179293
2013-04-11 15:49:52 +00:00
Michael Gottesman 4ddc2156d6 Change the cmake variable COMPILER_RT_CAN_EXECUTE_TESTS to be an option so that it can overwritten.
The reason why this simple change is needed is that I am trying to set up a
quick cmake/ninja based buildbot and apple-clang does not support using the
sanitizers currently.

The default behavior follows exactly what was there before implying that no ones
builds should be affected at all.

llvm-svn: 178455
2013-04-01 04:13:03 +00:00
Alexey Samsonov acfb82e611 [Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence.
llvm-svn: 177860
2013-03-25 10:31:49 +00:00
Alexey Samsonov 4c17c1b157 Support CMake build of profile runtime library on Linux
llvm-svn: 177382
2013-03-19 09:17:35 +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
Evgeniy Stepanov c9db3b8b39 [sanitizer] Copy sanitizer headers to the build tree.
llvm-svn: 173794
2013-01-29 11:46:06 +00:00
Alexey Samsonov b670018c9f CMake: generalize checking for target availability and add initial support for PowerPC native arch. With this patch, building LLVM on PowerPC native arch produces a working ASan runtime.
llvm-svn: 173044
2013-01-21 14:31:45 +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 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 b068483d4d CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
llvm-svn: 172829
2013-01-18 16:51:07 +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
Alexey Samsonov 4b0ee8ecd5 CMake: start to generalize rules for non-x86 architectures
llvm-svn: 172816
2013-01-18 13:10:42 +00:00
Alexey Samsonov 193b45f4fe CMake variables renaming: X86_64->x86_64 I386->i386
llvm-svn: 172812
2013-01-18 12:45:44 +00:00
Alexey Samsonov c20f5d2246 Define COMPILER_RT_CAN_EXECUTE_TESTS variable on platforms where we can produce working binaries and use it in build rules for sanitizers tests
llvm-svn: 171160
2012-12-27 13:19:23 +00:00
Alexey Samsonov 85bd73d259 [ASan] Support building both 32- and 64-bit unit tests if we can target both architectures
llvm-svn: 170549
2012-12-19 15:17:23 +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
Alexander Potapenko 9448581d9e [ASan] Remove llvm-symbolizer from compiler-rt/utils/
This is the first (1/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.

llvm-svn: 167722
2012-11-12 11:32:42 +00:00
Alexey Samsonov 75fb677fd1 [Sanitizer] Build all sanitizer runtime libraries with debug info (with -gline-tables-only, if it's available)
llvm-svn: 167584
2012-11-08 14:49:28 +00:00
Alexey Samsonov a555b3faf4 [ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state.
llvm-svn: 164486
2012-09-24 11:43:40 +00:00
Alexey Samsonov ddcb77f287 [Sanitizer] don't use -Werror as default compile flag for sanitizer runtimes - people may use too many distinct/old host compilers
llvm-svn: 163784
2012-09-13 10:23:45 +00:00
Alexey Samsonov 3d53c4ecf6 [Sanitizer] Please Android build. Re-check the availability of -Wno-variadic-macros flag.
llvm-svn: 163688
2012-09-12 08:06:15 +00:00
Alexey Samsonov 694633e19b [Sanitizer] first effort to start building ASan runtime with -Werror in CMake build
llvm-svn: 163686
2012-09-12 07:38:47 +00:00
Evgeniy Stepanov 1a8f8fa6c0 CMake build rules for ASan Android runtime and tests.
llvm-svn: 163613
2012-09-11 11:55:45 +00:00
Evgeniy Stepanov af0f6c8991 Fox a typo.
llvm-svn: 163611
2012-09-11 11:35:18 +00:00
Alexey Samsonov eeec3c11b5 [compiler-rt] Install support for CMake build of compiler-rt
llvm-svn: 163607
2012-09-11 10:26:54 +00:00
Alexey Samsonov d83ccd067d [ASan] hoist more compile flags to SANITIZER_COMMON_CFLAGS var and add the rest of flags/defs from old Makefile to CMake
llvm-svn: 163204
2012-09-05 09:00:03 +00:00
Alexey Samsonov f2ce35fc30 [compiler-rt] Recurse into 'utils' directory in CMake build of compiler-rt, enable build of llvm-symbolizer binary (currently for one target only)
llvm-svn: 163138
2012-09-04 14:52:21 +00:00
Chandler Carruth 1aa4fef601 Relocate the external headers provided by ASan and the common sanitizer
library.

These headers are intended to be available to user code when built with
AddressSanitizer (or one of the other sanitizer's in the future) to
interface with the runtime library. As such, they form stable external
C interfaces, and the headers shouldn't be located within the
implementation.

I've pulled them out into what seem like fairly obvious locations and
names, but I'm wide open to further bikeshedding of these names and
locations.

I've updated the code and the build system to cope with the new
locations, both CMake and Makefile. Please let me know if this breaks
anyone's build.

The eventual goal is to install these headers along side the Clang
builtin headers when we build the ASan runtime and install it. My
current thinking is to locate them at:

  <prefix>/lib/clang/X.Y/include/sanitizer/common_interface_defs.h
  <prefix>/lib/clang/X.Y/include/sanitizer/asan_interface.h
  <prefix>/lib/clang/X.Y/include/sanitizer/...

But maybe others have different suggestions?

Fixing the style of the #include between these headers at least unblocks
experimentation with installing them as they now should work when
installed in these locations.

llvm-svn: 162822
2012-08-29 02:27:54 +00:00
Chandler Carruth c1c9d5818f Some flag cleanup for the sanitizer runtimes.
This hoists most of the CFLAGS into a common variable. It also adds
detection for -Wno-c99-extensions and uses it to silence a pile of
warnings.

Finally, it switches to the proper flag -rdynamic.

With this, the cmake build is warning free on my bootstrap Linux build.

llvm-svn: 162809
2012-08-29 00:13:11 +00:00
Evgeniy Stepanov f72f08affc CMake build rules for ASan/Android runtime.
llvm-svn: 162675
2012-08-27 14:28:27 +00:00
Alexey Samsonov fb844c7eff [ASan] CMake support for building ASan runtime as a universal binary on Mac
llvm-svn: 161665
2012-08-10 14:45:52 +00:00
Alexey Samsonov 36796b4899 [compiler-rt] CMake build: if LLVM_BUILD_32_BITS is on, then -m32 is added to llvm definitions. Let us override this by explicitly adding -m64 compiler flag when building compiler-rt libraries for x86_64 target
llvm-svn: 161415
2012-08-07 12:14:29 +00:00
Chandler Carruth 9aaf156f30 Add support for building the ASan instrumentation unit tests with the
just-built Clang binary, and linking them against the just-built ASan
runtime.

This is *very* brittle. I expect it will require tweaking, and I've
pro-actively disabled it on non-Unix builds and on cross-builds.

It is also currently missing dependency edges on GoogleTest header files
and a few other corner cases, but those can be fixed. This is the major
milestone of a mini-bootstrap-like build of the unittest.

llvm-svn: 159255
2012-06-27 09:01:24 +00:00
Chandler Carruth c78ad00c07 Another big step toward a viable CMake build system for CompilerRT,
ASan, and friends.

This explicitly switches the CompilerRT CMake build to require CMake
version 2.8.8 or newer which provides first-class support for "object"
libraries which consist of a pile of '.o' files -- exactly what is
desired for composing runtime libraries. I've gone ahead and switched to
using this.

I've also added the interception library which I missed initially. And
I've added proper dependencies between the various libraries. With this,
I'm able to build archives for asan that appear to contain all of the
necessary .o files.

The final tweak here is to start setting up the compile flags and macro
defines expected by ASan and its helper libraries. These may not be
entirely correct currently, they're based loosely on my reading of the
old Makefiles. However, they can be tweaked more easily now that they're
wired up properly.

llvm-svn: 159129
2012-06-25 08:40:10 +00:00