Commit Graph

286 Commits

Author SHA1 Message Date
Chris Bieneman 380ebd0b2c [CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App Store.
This change modifies find_darwin_sdk_dir to set a variable if a Darwin "Internal" SDK is present which allows CMake to disable components that require internal-only APIs.

This mechanism is then used to disable TSan when an internal SDK is not present.

llvm-svn: 267575
2016-04-26 17:53:25 +00:00
Derek Bruening af7aaae1bc [esan] EfficiencySanitizer base runtime library
Summary:
Adds the initial version of a runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The library includes:

+ Slowpath code via callouts from the compiler instrumentation for
  each memory access.

+ Registration of atexit() to call finalization code.

+ Runtime option flags controlled by the environment variable
  ESAN_OPTIONS.  The common sanitizer flags are supported such as
  verbosity and log_path.

+ An initial simple test.

Still TODO: common code for libc interceptors and shadow memory mapping,
and tool-specific code for shadow state updating.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267060
2016-04-21 21:32:25 +00:00
Marcin Koscielnicki b5e4804aee [sanitizer] [SystemZ] Enable UBSan.
sanitizer_common is now in good enough shape on s390x to support UBSan
- all tests passing.  Let's enable it.

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

llvm-svn: 266483
2016-04-15 22:25:04 +00:00
Sean Silva 3e85ddc011 Use `CMAKE_HOST_UNIX` to check the host.
`UNIX` is for the target.

llvm-svn: 265595
2016-04-06 20:19:31 +00:00
Chris Bieneman 17bcc439d6 [CMake] Provide the ability to skip stripping when generating dSYMs
For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On.

llvm-svn: 265057
2016-03-31 21:17:19 +00:00
Reid Kleckner 747dc2eb61 [cmake] Get the MSVC version by running cl rather than relying on MSVC_VERSION
MSVC_VERSION comes from the _MSC_VER macro, which won't correspond to
the STL version if the host compiler is clang-cl.

llvm-svn: 264901
2016-03-30 18:31:14 +00:00
Reid Kleckner f2be78c07e Move -fms-compatibility-version=19 into target cflags
This reduces cflags duplication and allows us to build
sanitizer_common/tests with clang and the VS 2015 STL.

llvm-svn: 264017
2016-03-22 01:14:36 +00:00
Devin Coughlin 7704720d41 [tsan] Build TSan dylibs for iOS-style simulators
Update the compiler-rt cmake to build TSan dylibs for iOS-style simulators when the
corresponding COMPILER_RT_ENABLE_FOO_OS setting is enabled.

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

Part of rdar://problem/24048382

llvm-svn: 263910
2016-03-20 17:35:45 +00:00
Alexey Samsonov 5c966a2063 [CMake] Remove bash-ism in SanitizerLintCheck
llvm-svn: 263751
2016-03-17 21:41:08 +00:00
Filipe Cabecinhas b08c76f5f8 [cmake] Address Samsonov's post-commit review of r262723
Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 262770
2016-03-05 10:01:04 +00:00
Mohit K. Bhakkad b87b2ecb4b [Compiler-rt][safestack] Enable for MIPS
Reviewers: samsonov

Subscribers: jaydeep, sagar, llvm-commits

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

llvm-svn: 262690
2016-03-04 06:15:59 +00:00
Alexey Samsonov 2eff7f788a [CMake] Fix a typo in add_compiler_rt_library.
llvm-svn: 262063
2016-02-26 20:59:40 +00:00
Chris Bieneman 497a0ac23f [CMake] Support component-based installation for runtime libraries
This enables targets like "install-ubsan" and "install-asan" to install all associated runtime libraries.

llvm-svn: 261700
2016-02-23 21:55:38 +00:00
Chris Bieneman 86792ea718 [CMake] Assign components and dependencies during add_compiler_rt_resource_file
This makes it so that component-based installations will include resource files (i.e. blacklists). My next patch will add support for component-based installations.

llvm-svn: 261699
2016-02-23 21:50:39 +00:00
Chris Bieneman 953d593cd7 [CMake] Adding a CMake cache file that matches Apple's build configs
This should have no impact on anyone, but we're going to use it from GreenDragon to make our builders match what we ship.

llvm-svn: 261377
2016-02-19 22:59:18 +00:00
Chris Bieneman 5a5b21d5be [CMake] [NFC] Move macro definitions out of config-ix.cmake
This change should have no functional impact, it just moves some macro definitions out of config-ix.cmake into CompilerRTUtils.cmake.

This step will allow these macros to be re-used by the separated builtin build.

llvm-svn: 261108
2016-02-17 16:57:38 +00:00
Chris Bieneman a58d0651cb [CMake] Push the dependency on AddLLVM into the test and unites layers
Compiler-rt only relies on LLVM for lit support. Pushing this dependency down into the test and unitest layers will allow builtin libraries to be built without LLVM.

llvm-svn: 261105
2016-02-17 16:38:54 +00:00
Alexey Samsonov e34c8e8f8a [TSan] Use darwin_filter_host_arch to restrict set of test arch on Mac OS.
This also reverts r259577 which was a quick-fix to fix buildbots.

llvm-svn: 259593
2016-02-02 22:42:25 +00:00
Daniel Sanders f3eb90743c [tsan] Disable x86_64h build that was enabled as part of r259542.
It fails almost every test on clang-stage1-cmake-RA_check.

llvm-svn: 259577
2016-02-02 21:41:17 +00:00
Daniel Sanders 440b8610e6 [compiler-rt] add_custom_libcxx should pass LLVM_PATH and a C++ compiler
Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 259493
2016-02-02 12:55:28 +00:00
Anna Zaks c77a080bdb [asan] Add iOS support.
llvm-svn: 259451
2016-02-02 02:01:17 +00:00
Alexey Samsonov a7be03d66b [CMake] Use LLVM_MAIN_SRC_DIR instead of LLVM_SOURCE_DIR.
The former will be properly initialized in standalone CMake build of
compiler-rt.

llvm-svn: 259407
2016-02-01 21:08:16 +00:00
Daniel Sanders de098c9767 [compiler-rt] list_union() is actually an intersect operation. Rename it.
Summary:
Given:
  set(T1 a b c)
  set(T2 b c d)
  message("T1=${T1}")
  message("T2=${T2}")
  list_union(T3 T1 T2)
  message("T3=${T3}")
cmake emitted:
  T1=a;b;c
  T2=b;c;d
  T3=b;c

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 258916
2016-01-27 09:28:01 +00:00
Nico Weber 6a4e0dd1a6 When building without DIA SDK, don't set suppressions.cpp fail
This test requires llvm-symbolizer to be able to convert a stack
address into a function name.  It is only able to do this if the
DIA SDK was found at cmake time.  Add a lit feature for this,
and let the test depend on it.

See also discussion in D15363.

llvm-svn: 258545
2016-01-22 20:26:10 +00:00
Sumanth Gundapaneni b76bf106b1 Fix the cross compilation of unit tests. NFC (second attempt)
With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch does the following changes

>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the 
way it's used.
>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so 
that cross-compiler would be able to build/compile the unit tests
>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so 
that cross-compiler would be able to link the unit tests (if needed)

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

llvm-svn: 257783
2016-01-14 18:18:49 +00:00
Hans Wennborg 7b9d2b6c87 Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling"
This broke the build. For example, from
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1191/steps/cmake%20stage%201/logs/stdio:

	-- Compiler-RT supported architectures: aarch64
	CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:170 (string):
		string sub-command REPLACE requires at least four arguments.
	Call Stack (most recent call first):
		projects/compiler-rt/lib/CMakeLists.txt:4 (include)

llvm-svn: 257694
2016-01-13 22:50:24 +00:00
Sumanth Gundapaneni 2d2f2b5c80 With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch does the following changes

>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the 
way it's used.
>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that 
cross-compiler would be able to build/compile the unit tests
>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that 
cross-compiler would be able to link the unit tests (if needed)

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

llvm-svn: 257686
2016-01-13 22:09:47 +00:00
Dan Gohman 746cd84e3c [WebAssembly] Enable the builtins library for WebAssembly.
llvm-svn: 257619
2016-01-13 16:56:15 +00:00
Chris Bieneman 1a4ae60f5a [CMake] Adding experimental support for tvOS and watchOS
Summary:
* Refactored the iOS config-ix.cmake code to be a more compact loop over supported embedded platforms.
* Added watchOS and tvOS as experimental platforms, they don't currently build so they are disabled by default

Reviewers: zaks.anna, kubabrecka, samsonov

Subscribers: llvm-commits

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

llvm-svn: 257544
2016-01-12 23:51:03 +00:00
Vedant Kumar b626231a50 [cmake] Indentation fix (NFC)
llvm-svn: 257118
2016-01-08 00:07:50 +00:00
Vedant Kumar c5b779cb92 [cmake] Add InstrProfilingWriter to libclang_rt on Darwin
llvmBufferWriter and a few related symbols were missing from libclang_rt
on Darwin (PR26002). This should fix the problem.

Patch by Dan Peebles!

llvm-svn: 257110
2016-01-07 22:54:46 +00:00
Anna Zaks ef9a56faa0 [compiler-rt] On Darwin, link all frameworks with -fapplication-extension
The ASan dylib as well as other compiler-rt dylibs work with app extensions,
so we should add -fapplication-extension to the link line when building them.
This will avoid linker warnings when using the dylibs in app extensions.

(APIs unavailable to app extensions are listed here: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW6)

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

llvm-svn: 256989
2016-01-06 23:15:04 +00:00
Nathan Slingerland ba86c9279b [PGO] Enable building compiler-rt profile support library on Windows
Summary: This change configures Windows builds to build the complier-rt profile support library (clang_rt.profile-i386.lib). Windows API incompatibilities in the compiler-rt profile lib are also fixed.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 256848
2016-01-05 17:27:01 +00:00
Evgeniy Stepanov da1cf9287c Cross-DSO control flow integrity (compiler-rt part).
This is an initial version of the runtime cross-DSO CFI support
library.

It contains a number of FIXMEs, ex. it does not support the
diagnostic mode nor dlopen/dlclose, but it works and can be tested.
Diagnostic mode, in particular, would require some refactoring (we'd
like to gather all CFI hooks in the UBSan library into one function
so that we could easier pass the diagnostic information down to
__cfi_check). It will be implemented later.

Once the diagnostic mode is in, I plan to create a second test
configuration to run all existing tests in both modes. For now, this
patch includes only a few new cross-DSO tests.

llvm-svn: 255695
2015-12-15 23:00:33 +00:00
Adhemerval Zanella eaf1162687 [compiler-rt] [safestack] Enable for aarch64
This patch enables the safestack for aarch64. The frontend already have
it enabled on all supported architectures and no adjustment is required
in llvm.

The compiler-rt adjustments are basically add on the cmake configuration
to enable the tests and fix the pagesize debug check by getting its
value at runtime (since aarch64 has multiple pagesize depending of
kernel configuration).

llvm-svn: 255345
2015-12-11 17:38:38 +00:00
Evgeniy Stepanov 2ad0192e6f Replace cmake check for printf with a check for fopen.
Printf is a builtin, and the check fails with -Werror because of a clang
warning about an incompatible redeclaration.

llvm-svn: 255189
2015-12-10 00:47:50 +00:00
Chris Bieneman 5c64ddfa88 Revert "[CMake] Provide options for toggling on and off various runtime libraries."
This reverts r255170. This change caused a bunch of bot failures and needs to be revised.

llvm-svn: 255184
2015-12-10 00:40:58 +00:00
Chris Bieneman a584158a25 [CMake] [Darwin] Log architecture test failures to CMakeError.log
This makes debugging configuration issues way easier.

llvm-svn: 255183
2015-12-10 00:39:57 +00:00
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
Chris Bieneman bcd09fef72 [CMake] CMake calls to set_property with APPEND string need to have a leading space.
llvm-svn: 254660
2015-12-03 22:56:21 +00:00
Chris Bieneman 1d7a2cf94c [CMake] set_target_properties doesn't append link flags
This fixes a bug I introduced in r254643.

llvm-svn: 254658
2015-12-03 22:52:22 +00:00
Chris Bieneman 69a372dc50 [CMake] Support externalizing debug info on Darwin
* Adds COMPILER_RT_EXTERNALIZE_DEBUGINFO option
* On Darwin this results in calling dsymutil and strip after linking
* This generates an error on non-darwin platforms, matching the LLVM behavior

llvm-svn: 254643
2015-12-03 20:08:22 +00:00
Kuba Brecka 3daf7b4743 [sanitizer] Cache results of darwin_test_archs
For OS X builds of compiler-rt, we run `darwin_test_archs` to determine which architectures can the toolchain target. This detection takes quite a long time, and the result is always the same (as long as you don't upgrade your OS, system headers or toolchain). Let's cache the result.

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

llvm-svn: 254618
2015-12-03 17:02:07 +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
Andy Gibbs abd2a0bf0d Pass along correct 'make' to sub-builds.
If the top-level cmake has a custom make specified through -DCMAKE_MAKE_PROGRAM
then this must be passed along to the sub-build processes in compiler-rt or the
build process will fail.

llvm-svn: 254509
2015-12-02 13:46:56 +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