Commit Graph

554 Commits

Author SHA1 Message Date
Francis Ricci ab85292261 Enable i386 builds for darwin lsan
Summary:
Now that __thread is no longer used for lsan on darwin, i386 builds
can be enabled.

Reviewers: kcc, kubamracek

Subscribers: danalbert, srhines, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29995

llvm-svn: 298946
2017-03-28 21:56:44 +00:00
Kuba Mracek ded235a141 [sanitizers] Upgrade ios min version to 8
Differential Revision: https://reviews.llvm.org/D29787

llvm-svn: 298860
2017-03-27 17:16:47 +00:00
Bob Haarman 1012fe8a54 [compiler-rt] build compiler-rt runtimes without LTO
Summary: Currently, we build the compiler-rt runtimes with link-time optimization if LTO is configured for the LLVM project. This will break external programs that don't invoke the linker in such a way that it supports LLVM's LTO. To avoid this, this change causes the compiler-rt runtimes to be compiled with -fno-lto. This also makes the check-profile tests work on systems when doing a lld LTO build on a system where the system linker does not support LLVM LTO.

Reviewers: rnk, davidxl

Reviewed By: davidxl

Subscribers: dberris, mgorny, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D31218

llvm-svn: 298525
2017-03-22 17:25:49 +00:00
Bob Haarman ccd6ae25f4 [compiler-rt] respect CMAKE_EXE_LINKER_FLAGS in compiler and library tests
Summary: check_cxx_compiler_flag and check_library_exists could fail because they ignored CMAKE_EXE_LINKER_FLAGS and therefore would always fail to produce executables. Cmake policy CMP0056 fixes this, but was explicitly set to OLD in our CMakeLists because it caused problems with test_target_arch. This change sets the policy to NEW to fix the problem with the compiler and library tests, and temporarily clears CMAKE_EXE_LINKER_FLAGS inside test_target_arch to emulate the old behavior there. This allows, for example, LTO builds that require lld to succeed.

Reviewers: davidxl, beanz

Reviewed By: beanz

Subscribers: fjricci, dberris, mgorny, mehdi_amini, tejohnson, rnk, llvm-commits

Differential Revision: https://reviews.llvm.org/D31098

llvm-svn: 298413
2017-03-21 18:25:35 +00:00
Pirama Arumuga Nainar a84404c7a4 Enable PROFILE, TSAN and UBSAN for Android
Summary:
These sanitizers are enabled and used in Android but got built with
Android's build system.  This change enables them in the CMake build
system.

Reviewers: eugenis

Subscribers: llvm-commits, danalbert, srhines, mgorny

Differential Revision: https://reviews.llvm.org/D30127

llvm-svn: 295523
2017-02-18 01:12:55 +00:00
Francis Ricci 908e2d9009 Revert "Upgrade ios min version to 8"
Accidental commit

This reverts commit f21d4a6836ea159e95e5042ba8383f20d4899cda.

llvm-svn: 295414
2017-02-17 04:33:40 +00:00
Francis Ricci 32f0ec51d1 Upgrade ios min version to 8
Summary:
Version 8 is the first version to support the __thread
keyword, which is required for building lsan for
64-bit ios.

Reviewers: kubamracek, kcc, glider

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29787

llvm-svn: 295412
2017-02-17 04:32:17 +00:00
Tim Shen c6ce73b114 Re-commit r295017, since we have a potential fix of the tests, r295248, landed.
Differential Revision: https://reviews.llvm.org/D29742

llvm-svn: 295251
2017-02-15 22:40:29 +00:00
Sagar Thakur ea831e4c46 [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el
Summary: Adds support for xray on mips/mipsel/mips64/mips64el.

Reviewed by sdardis, dberris
Differential: D27699

llvm-svn: 295166
2017-02-15 10:54:09 +00:00
Tim Shen 6edc4883fe Revert r295017 "Re-commit r294826 and r294781, with a fix on the cmake file to only"
llvm-svn: 295097
2017-02-14 19:48:13 +00:00
Tim Shen b94588eb88 Re-commit r294826 and r294781, with a fix on the cmake file to only
compile on powerpc64le.

I cannot locally reproduce this test failure:
http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux/builds/1363/steps/test%20standalone%20compiler-rt/logs/stdio

Let's see how the buildbot goes.

Differential Revision: https://reviews.llvm.org/D29742

llvm-svn: 295017
2017-02-14 02:05:47 +00:00
Francis Ricci 8187c7b06b Add cmake build support for lsan on OS X
Summary:
Adds a new cmake flag 'COMPILER_RT_ENABLE_LSAN_OSX', which enables lsan
compilation and is turned off by default. Patches to fix build errors
when this flag is enabled will be uploaded soon.

This is part of an effort to port LSan to OS X, but LSan on OS X does not
currently work or pass tests currently.

Reviewers: kubamracek, kcc, glider, alekseyshl

Reviewed By: kubamracek

Subscribers: danalbert, srhines, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29783

llvm-svn: 295012
2017-02-14 00:56:53 +00:00
Vitaly Buka d8230247c9 This reverts commits r294826 and r294781 as they break linking on powerpc.
Revert "Fix -Wsign-compare - this might not be quite right, but preserves behavior"
Revert "[XRay] Implement powerpc64le xray."

This reverts commit r294826.
This reverts commit r294781.

llvm-svn: 294842
2017-02-11 12:34:27 +00:00
Tim Shen 918ed871df [XRay] Implement powerpc64le xray.
Summary:
powerpc64 big-endian is not supported, but I believe that most logic can
be shared, except for xray_powerpc64.cc.

Also add a function InvalidateInstructionCache to xray_util.h, which is
copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest,
and I don't know how.

Reviewers: dberris, echristo, iteratee, kbarton, hfinkel

Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29742

llvm-svn: 294781
2017-02-10 21:03:24 +00:00
Maxim Ostapenko 651cfe3cfa [lsan] Renable LSan for x86 Linux
The missed clang part was committed at https://reviews.llvm.org/rL293609 thus
we can reenable LSan for x86 Linux.

Differential Revision: https://reviews.llvm.org/D28609

llvm-svn: 293610
2017-01-31 07:15:37 +00:00
Oleg Ranevskyy 41abca4355 [Compiler-rt] Broken compiler-rt CMake configuring on Windows
Summary:
Hi Michal,

Would you be able to review this simple fix, please?

Since r291504 compiler-rt uses `llvm-config --cmakedir` to get the path to the LLVM CMake modules.
On Windows this option returns Windows style path with backslashes. CMake treats backslashes as beginning of an escaped character and thus fails to append the path to `CMAKE_MODULE_PATH`.

Reviewers: compnerd, mgorny

Reviewed By: mgorny

Subscribers: compnerd, llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D28908

llvm-svn: 293195
2017-01-26 18:16:02 +00:00
Kostya Kortchinsky 198f864c07 [scudo] Enabling AArch64 support for Scudo
Summary:
Adding ARM64 as a supported architecture for Scudo.
The random shuffle is not yet supported for SizeClassAllocator32, which is used
by the AArch64 allocator, so disable the associated test for now.

Reviewers: kcc, alekseyshl, rengolin

Reviewed By: rengolin

Subscribers: aemerson, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D28960

llvm-svn: 293068
2017-01-25 16:35:18 +00:00
Evgeniy Stepanov 0f550c8176 Revert "[lsan] Enable LSan for x86 Linux."
Breaks tests on i686/Linux due to missing clang driver support:
  error: unsupported option '-fsanitize=leak' for target 'i386-unknown-linux-gnu'

llvm-svn: 292844
2017-01-23 22:52:31 +00:00
Maxim Ostapenko 2523faf677 [lsan] Enable LSan for x86 Linux.
People keep asking LSan to be available on 32 bit targets (e.g. https://github.com/google/sanitizers/issues/403)
despite the fact that false negative ratio might be huge (up to 85%). This happens for big real world applications
that may contain random binary data (e.g. browser), but for smaller apps situation is not so terrible and LSan still might be useful.
This patch adds initial support for x86 Linux (disabled by default), ARM32 is in TODO list.
We used this patch (well, ported to GCC) on our 32 bit mobile emulators and it worked pretty fine
thus I'm posting it here to initiate further discussion.

Differential Revision: https://reviews.llvm.org/D28609

llvm-svn: 292775
2017-01-23 08:45:17 +00:00
Weiming Zhao 93b558a486 [Builtin] [ARM] Update CMake to support the build of armv6m
Summary:
Setting -DCOMPILER_RT_TEST_TARGET_TRIPLE=armv6m-none-eabi  will enable the build of builtin functions ARMv6m.
Currently, only those asms that support armv6m are added.

TODO:All asm sin ARM_EABI_Sources are ported for thumb1 so Thumb1_EABI_Sources will be deprecated.

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: aemerson, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D28463

llvm-svn: 292504
2017-01-19 18:46:11 +00:00
Kostya Kortchinsky b39dff4551 [scudo] Refactor of CRC32 and ARM runtime CRC32 detection
Summary:
ARM & AArch64 runtime detection for hardware support of CRC32 has been added
via check of the AT_HWVAL auxiliary vector.

Following Michal's suggestions in D28417, the CRC32 code has been further
changed and looks better now. When compiled with full relro (which is strongly
suggested to benefit from additional hardening), the weak symbol for
computeHardwareCRC32 is read-only and the assembly generated is fairly clean
and straight forward. As suggested, an additional optimization is to skip
the runtime check if SSE 4.2 has been enabled globally, as opposed to only
for scudo_crc32.cpp.

scudo_crc32.h has no purpose anymore and was removed.

Reviewers: alekseyshl, kcc, rengolin, mgorny, phosek

Reviewed By: rengolin, mgorny

Subscribers: aemerson, rengolin, llvm-commits

Differential Revision: https://reviews.llvm.org/D28574

llvm-svn: 292409
2017-01-18 17:11:17 +00:00
Petr Hosek 783426884d Reland "[CMake][compiler-rt] Mark libcxx build for tsan as standalone"
This relands commit r291722.

llvm-svn: 292083
2017-01-16 00:33:02 +00:00
Petr Hosek f91e47374c Revert "[CMake][compiler-rt] Mark libcxx build for tsan as standalone"
This reverts commit 08dbefb847bb765b387c67dc2dc2ef90a4927312.

llvm-svn: 291730
2017-01-12 00:01:17 +00:00
Petr Hosek d7e4ed3bc3 [CMake][compiler-rt] Mark libcxx build for tsan as standalone
This is to ensure that the libcxx build is properly configured.

Differential Revision: https://reviews.llvm.org/D28579

llvm-svn: 291722
2017-01-11 23:09:16 +00:00
Kostya Kortchinsky c4d6c938e3 [scudo] Separate hardware CRC32 routines
Summary:
As raised in D28304, enabling SSE 4.2 for the whole Scudo tree leads to the
emission of SSE 4.2 instructions everywhere, while the runtime checks only
applied to the CRC32 computing function.

This patch separates the CRC32 function taking advantage of the hardware into
its own file, and only enabled -msse4.2 for that file, if detected to be
supported by the compiler.

Another consequence of removing SSE4.2 globally is realizing that memcpy were
not being optimized, which turned out to be due to the -fno-builtin in
SANITIZER_COMMON_CFLAGS. So we now explicitely enable builtins for Scudo.

The resulting assembly looks good, with some CALLs are introduced instead of
the CRC32 code being inlined.

Reviewers: kcc, mgorny, alekseyshl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D28417

llvm-svn: 291570
2017-01-10 16:39:36 +00:00
Francis Ricci 17781c71b0 Make cmake link flag naming consistent
Summary:
The build system was inconsistent in its naming conventions for
link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS,
for consistency with cmake's LINK_FLAGS property.

This patch should make it easier to search the source code for
uses of link flags, as well as providing the benefit of improved
style and consistency.

Reviewers: compnerd, beanz

Subscribers: kubabrecka, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D28506

llvm-svn: 291539
2017-01-10 04:33:04 +00:00
Michal Gorny 72f8c5f555 [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291504
2017-01-09 23:23:56 +00:00
Francis Ricci ff567a8ba2 Enable weak hooks on darwin
Summary:
By default, darwin requires a definition for weak interface functions at
link time. Adding the '-U' link flag with each weak function allows these
weak interface functions to be used without definitions, which mirrors
behavior on linux and windows.

Reviewers: compnerd, eugenis

Subscribers: kubabrecka, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D28203

llvm-svn: 291417
2017-01-09 03:51:42 +00:00
Francis Ricci fcde2a708f Revert "Enable weak hooks on darwin"
Reverts accidental upload.

This reverts commit 421408c0f2cc811bcf9a945be6e95e46f76cb358.

llvm-svn: 291316
2017-01-07 00:38:24 +00:00
Francis Ricci 1d35775379 Enable weak hooks on darwin
Summary:
By default, darwin requires a definition for weak interface functions at
link time. Adding the '-U' link flag with each weak function allows these
weak interface functions to be used without definitions, which mirrors
behavior on linux and windows.

Reviewers: compnerd, eugenis

Subscribers: kubabrecka, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D28203

llvm-svn: 291314
2017-01-07 00:31:24 +00:00
Michal Gorny c74123bdff [cmake] Disable appending -msse4.2 flag implicitly
Disable the code appending -msse4.2 flag implicitly when the compiler
supports it. The compiler support for this flags do not indicate that
the underlying CPU will support SSE4.2, and passing it may result in
SSE4.2 code being emitted *implicitly*.

If the target platform supports SSE4.2 appropriately, the relevant bits
should be already enabled via -march= or equivalent. In this case
passing -msse4.2 is redundant.

If a runtime detection is desired (which seems to be a case with SCUDO),
then (as gcc manpage points out) the specific SSE4.2 needs to be
isolated into a separate file, the -msse4.2 flag can be forced only
for that file and the function defined in that file can only be called
when the CPU is determined to support SSE4.2.

This fixes SIGILL on SCUDO when it is compiled using gcc-5.4.

Differential Revision: https://reviews.llvm.org/D28304

llvm-svn: 291217
2017-01-06 08:21:02 +00:00
Chandler Carruth bbb82ca4e6 [gtest] Teach the sanitizer's custom gtest compilations to disable
a warning that 'gtest-all.cc' directly triggers in the newer 1.8.0
version.

This should fix a warning in folks' build and bring a couple of -Werror
bots back to life.

llvm-svn: 291070
2017-01-05 03:41:41 +00:00
Kostya Kortchinsky e3be61c139 [scudo] ARM32 support
Summary:
With the previous modifications, the code works on ARM32. The random shuffle
test is unsupported on 32-bit platforms for the moment and being marked as
such. There is no hardware support for the checksum computation yet, this will
come at a later point.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, aemerson, rengolin, mgorny

Differential Revision: https://reviews.llvm.org/D27957

llvm-svn: 290201
2016-12-20 21:17:58 +00:00
Marcos Pividori 4b9853ffa8 Fix simple cmake error when COMPILER_RT_SUPPORTED_ARCH is empty.
Differential Revision: https://reviews.llvm.org/D27719

llvm-svn: 289749
2016-12-15 01:21:04 +00:00
Petr Hosek f332d190cc [compiler-rt] Support building builtins for a single target
This is used when building builtins for multiple targets as part
of LLVM runtimes.

Differential Revision: https://reviews.llvm.org/D26653

llvm-svn: 289489
2016-12-12 23:14:02 +00:00
Kuba Mracek c14916dae7 [compiler-rt] Remove duplicates from COMPILER_RT_SUPPORTED_ARCH
Since we’re adding an entry into COMPILER_RT_SUPPORTED_ARCH for all architectures of all Darwin platforms, COMPILER_RT_SUPPORTED_ARCH often ends up having duplicate items. Let’s remove them.

Differential Revision: https://reviews.llvm.org/D25996

llvm-svn: 288681
2016-12-05 17:52:45 +00:00
Kostya Kortchinsky 1148dc5274 [scudo] 32-bit and hardware agnostic support
Summary:
This update introduces i386 support for the Scudo Hardened Allocator, and
offers software alternatives for functions that used to require hardware
specific instruction sets. This should make porting to new architectures
easier.

Among the changes:
- The chunk header has been changed to accomodate the size limitations
  encountered on 32-bit architectures. We now fit everything in 64-bit. This
  was achieved by storing the amount of unused bytes in an allocation rather
  than the size itself, as one can be deduced from the other with the help
  of the GetActuallyAllocatedSize function. As it turns out, this header can
  be used for both 64 and 32 bit, and as such we dropped the requirement for
  the 128-bit compare and exchange instruction support (cmpxchg16b).
- Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2
  instruction set is supported, use the 32-bit CRC32 instruction, and in the
  XorShift128, use a 32-bit based state instead of 64-bit.
- Add software support for CRC32: if SSE 4.2 is not supported, fallback on a
  software implementation.
- Modify tests that were not 32-bit compliant, and expand them to cover more
  allocation and alignment sizes. The random shuffle test has been deactivated
  for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't
  currently randomize chunks.

Reviewers: alekseyshl, kcc

Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache

Differential Revision: https://reviews.llvm.org/D26358

llvm-svn: 288255
2016-11-30 17:32:20 +00:00
Kuba Mracek ff1bd20ded [sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

Differential Revision: https://reviews.llvm.org/D26929

llvm-svn: 288186
2016-11-29 19:25:53 +00:00
Marcin Koscielnicki 3089884bcf Revert "Revert "[ASan] Enable on SystemZ.""
This reverts commit r287767.

Hopefully, the tests should be fixed by D27118.

llvm-svn: 288116
2016-11-29 08:25:00 +00:00
Saleem Abdulrasool f9d34dfbe4 builtins: switch to c11 from c99
This fixes an incorrect standard usage of GNU99 when the compiler check was for
the ISO standard C99.  Furthermore, bump the dependency up to C11.  The
motivation for this change is ARM EHABI compatibility with clang 3.8.  We rely
on a type definition redefinition which causes an error with -Werror builds.
This is problematic for FreeBSD builds.  Switching to C11 allows the
compatibility without the unnecessary pedantic warning.  The alternative would
be to clutter the support header with a `pragma clang diagnostic ignore`.  GCC
4.8+ and the supported clang revisions along with MSVC support enough of C11 to
allow building the builtins in C11 mode.  No functional change intended.

llvm-svn: 288099
2016-11-29 02:31:40 +00:00
Marcin Koscielnicki 441dd21da9 Revert "[ASan] Enable on SystemZ."
This reverts commit r287764.

Two tests broke on the clang-s390x-linux buildbot:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/1293.

llvm-svn: 287767
2016-11-23 16:07:07 +00:00
Marcin Koscielnicki 9a02c55edf [ASan] Enable on SystemZ.
Differential Revision: http://reviews.llvm.org/D21831

llvm-svn: 287764
2016-11-23 15:47:41 +00:00
Marcin Koscielnicki 5bdf70f410 [profile] Enable on SystemZ.
Differential Revision: http://reviews.llvm.org/D21738

llvm-svn: 287748
2016-11-23 08:28:42 +00:00
Dean Michael Berris bad8f0feb4 [XRay] Support AArch64 in compiler-rt
This patch adds XRay support in compiler-rt for AArch64 targets.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
Clang: https://reviews.llvm.org/D26415

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown

Differential Revision: https://reviews.llvm.org/D26413

llvm-svn: 287517
2016-11-21 03:20:43 +00:00
Dean Michael Berris 4031e4b95d [XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime.
Summary:
Adds a CMake check for whether the compiler used to build the XRay
library supports XRay-instrumentation. If the compiler we're using does
support the `-fxray-instrument` flag (i.e. recently-built Clang), we
define the XRAY_NEVER_INSTRUMENT macro that then makes sure that the
XRay runtime functions never get XRay-instrumented.

This prevents potential weirdness involved with building the XRay
library with a Clang that supports XRay-instrumentation, and is
attempting to XRay-instrument the build of compiler-rt.

Reviewers: majnemer, rSerge, echristo

Subscribers: mehdi_amini, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D26597

llvm-svn: 287068
2016-11-16 01:01:13 +00:00
Kuba Brecka 41c52889b9 [sanitizer] Max out allowed macOS deployment targets to 10.9
It's not a good idea to build the sanitizers with e.g. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12, because some deprecated functions that we intercept will cause build errors. Let's limit the allowed deployment targets to 10.9 (which is the default anyway), and warn when it's set above.

Differential Revision: https://reviews.llvm.org/D26557

llvm-svn: 286859
2016-11-14 18:27:47 +00:00
Nico Weber 0519a53d7d Remove a VS 2012 workaround, we require 2015 now.
llvm-svn: 285096
2016-10-25 18:48:43 +00:00
Sagar Thakur 51458256a2 [ESan][MIPS] Adds support for MIPS64
With this patch 12 out of 13 tests are passing.

Reviewed by zhaoqin.
Differential: D23799 

llvm-svn: 283435
2016-10-06 09:58:11 +00:00
Anna Zaks cacfb554a8 [compiler-rt] Enable building iOS by default.
llvm-svn: 283379
2016-10-05 20:45:36 +00:00
Peter Collingbourne 95d5b9c711 cfi: Fixes for check-cfi when configured as an external project.
Differential Revision: https://reviews.llvm.org/D24817

llvm-svn: 282189
2016-09-22 20:51:48 +00:00
Jonas Hahnfeld b297841572 [CMake] Rename back SIMPLE_SOURCE to compile as C++
This was changed in rL276151 and causes problems if the C++ compiler does not
support the same arches as the C compiler.
For the builtins, only the C compiler is tested in try_compile_only.

Additionally, -fno-exceptions is passed in (if available) to work around
the case where no libunwind is available.

Differential Revision: https://reviews.llvm.org/D23654

llvm-svn: 282054
2016-09-21 05:44:06 +00:00
Chris Bieneman 177ccc554b Revert "[CMake] Explicitly add --target option to compiler flags"
This reverts commit r282024.

This broke some bots, and I'm going to revert while I figure it out.

See: http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/21120
llvm-svn: 282033
2016-09-20 22:29:22 +00:00
Chris Bieneman ea625ea01e [CMake] Fix error preventing simulator sanitizers from building
This should be checking for sim archs not target archs. This bug has
been around for a long time.

llvm-svn: 282025
2016-09-20 21:36:33 +00:00
Chris Bieneman 807c0ae569 [CMake] Explicitly add --target option to compiler flags
Summary:
Much of the non-Darwin build system assumes that COMPILER_RT_DEFAULT_TARGET_TRIPLE is the default target triple for the compiler being used. With clang as your compiler this isn't necessarily true.

To ensure that the rest of the build system behaves as expected this patch adds "--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" to the compiler flags for C, CXX and ASM sources.

Reviewers: compnerd, rengolin, fjricci

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24156

llvm-svn: 282024
2016-09-20 21:36:30 +00:00
Dean Michael Berris d1617cdc49 [XRay] ARM 32-bit no-Thumb support in compiler-rt
This is a port of XRay to ARM 32-bit, without Thumb support yet.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

https://reviews.llvm.org/D23931 (LLVM)
https://reviews.llvm.org/D23932 (Clang test)

Differential Revision: https://reviews.llvm.org/D23933

llvm-svn: 281971
2016-09-20 14:35:57 +00:00
Kuba Brecka 55394c0775 [compiler-rt] Disable building of profiling runtime when LLVM_USE_SANITIZER is set
Currently, when doing a ASanified build of LLVM (with Clang, compiler-rt and libcxx) via -DLLVM_USE_SANITIZER=Address and not using any other options, we already disable building of sanitizer runtimes (because they themselves can’t be sanitized) and also exclude the sanitizer tests. However, the same is not done for the profiling runtime, which will build fine, but then all the tests fail due to linking errors. Let’s disable the profiling runtime as well (when LLVM_USE_SANITIZER is set).

Differential Revision: https://reviews.llvm.org/D24657

llvm-svn: 281815
2016-09-17 06:31:23 +00:00
Michal Gorny 697026f312 [cmake] Support overriding llvm-config query results
Support overriding LLVM_* variables obtained from llvm-config when doing
stand-alone builds. The override of LLVM_MAIN_SRC_DIR is necessary to
provide LLVM sources when the initial directory used to build LLVM does
no longer exist when compiler-rt is built stand-alone. This is
especially the case when building the projects separately in temporary
directories with unpredictable names.

The code is based on existing CMakeLists.txt from clang. Alike clang, it
extends the override to all queried variables.

Differential Revision: https://reviews.llvm.org/D24005

llvm-svn: 281461
2016-09-14 13:42:31 +00:00
Renato Golin 6f605133dd Revert "[XRay] ARM 32-bit no-Thumb support in compiler-rt"
This reverts commit r280890, as the related LLVM commit broke the thumb bots.

llvm-svn: 280969
2016-09-08 17:13:15 +00:00
Reid Kleckner dd16896324 Really fix warnings about passing -std=gnu99 to MSVC
llvm-svn: 280958
2016-09-08 16:25:34 +00:00
Qin Zhao 0ab52b97e8 Revert "[ESan][MIPS] Adds support for MIPS64"
Summary:
This reverts commit 62b3eecdbe72af0255f0639b0446087a47efbf48. (D23799)

The CL cause 13 ESan test failure on x86_64:
Failing Tests (13):
    EfficiencySanitizer-x86_64 :: TestCases/large-stack-linux.c
    EfficiencySanitizer-x86_64 :: TestCases/libc-intercept.c
    EfficiencySanitizer-x86_64 :: TestCases/mmap-shadow-conflict.c
    EfficiencySanitizer-x86_64 :: TestCases/struct-simple.cpp
    EfficiencySanitizer-x86_64 :: TestCases/verbose-simple.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-early-fault.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-memset.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-midreport.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-samples.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-signal-posix.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-simple.cpp
    EfficiencySanitizer-x86_64 :: Unit/circular_buffer.cpp
    EfficiencySanitizer-x86_64 :: Unit/hashtable.cpp

  Unexpected Failures: 13

Reviewers: bruening, slthakur

Subscribers: sdardis, kubabrecka, beanz

Differential Revision: https://reviews.llvm.org/D24350

llvm-svn: 280954
2016-09-08 16:09:46 +00:00
Dean Michael Berris 5332645c6d [XRay] ARM 32-bit no-Thumb support in compiler-rt
This is a port of XRay to ARM 32-bit, without Thumb support yet.
This is one of 3 commits to different repositories of XRay ARM port. The
other 2 are:

1. https://reviews.llvm.org/D23931 (LLVM)
2. https://reviews.llvm.org/D23932 (Clang test)

Differential Revision: https://reviews.llvm.org/D23933

llvm-svn: 280890
2016-09-08 00:28:26 +00:00
Francis Ricci 52fdd22250 [compiler-rt] Allow sanitizers to be compiled for windows with clang
Summary:
A few small changes required to permit building the sanitizers
with Clang instead of only with MSVC.

Reviewers: compnerd, beanz, rnk

Subscribers: beanz, timurrrr, kubabrecka, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D24092

llvm-svn: 280863
2016-09-07 21:03:22 +00:00
Francis Ricci e7729c8468 [compiler-rt] Fix library suffixes on windows
Summary:
Make sure that windows libraries contain the suffixes expected by clang.
This is expecially important when compiling the windows builtins with
clang, as cmake will use .a as the suffix by default.

Reviewers: beanz, compnerd

Subscribers: llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D24046

llvm-svn: 280854
2016-09-07 20:32:48 +00:00
Sagar Thakur 41f08b4422 [ESan][MIPS] Adds support for MIPS64
With this patch 10 out of 13 tests are passing.

Following is the list of failing tests:

    struct-simple.cpp
    workingset-signal-posix.cpp
    mmap-shadow-conflict.c

Reviewed by bruening
Differential: D23799

llvm-svn: 280795
2016-09-07 09:09:03 +00:00
Saleem Abdulrasool b939a7fde8 build: profile is not a sanitizer
There was an invalid entry in the sanitizer list, remove it.  This has no effect
on the building, just removes the definition of a cached variable.

llvm-svn: 280378
2016-09-01 15:05:36 +00:00
Chris Bieneman 21395f9839 [CMake] Connect Compiler-RT targets to LLVM Runtimes directory
This patch builds on LLVM r279776.

In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth.

The three steps I abstract are:

(1) Add a top-level target (i.e asan, msan, ...)
(2) Set the target properties for sorting files in IDE generators
(3) Make the compiler-rt target depend on the top-level target

The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name.

The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings.

With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is:

> cmake [...]
> ninja runtimes-configure
> ninja asan

The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build.

Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats).
llvm-svn: 279863
2016-08-26 20:52:22 +00:00
Francis Ricci 341b1fea7c [builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGET
Summary:
Since we generate the compiler invocation on our own, we need to
manually add -target if CMAKE_C_COMPILER_TARGET has been specified.

Reviewers: compnerd, beanz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23823

llvm-svn: 279747
2016-08-25 16:15:45 +00:00
Francis Ricci 0f488dc215 [compiler-rt] Use flags found when configuring builtins during compilation
Summary: This fixes the omission of -fPIC when building the builtins.

Reviewers: compnerd, beanz

Subscribers: dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D23729

llvm-svn: 279469
2016-08-22 20:33:47 +00:00
Filipe Cabecinhas e5914d82d2 [cmake] Fix append_rtti_flag macro and bad var name
llvm-svn: 279450
2016-08-22 18:30:37 +00:00
Chris Bieneman 9b818ac5d9 [CMake] Support building on OS X without Xcode installation
This should resolve PR23162. This patch has two parts.

First we need to check the error code from xcodebuild when querying for SDKs, second if the OS X SDK is not discovered, we ensure that /usr/include exists and use / as the OS X sysroot.

llvm-svn: 279336
2016-08-19 22:22:35 +00:00
Chris Bieneman 83877ee6cc [CMake] Add top-level install-compiler-rt target
This is a wrapper target of all the component install targets. This wrapper target will be used by the new LLVM runtimes directory to connect top-level targets to the runtime project target.

llvm-svn: 279333
2016-08-19 22:17:46 +00:00
Saleem Abdulrasool b6ced621e8 build: allow building a specific set of sanitizers
Introduce a new CMake option `COMPILER_RT_SANITIZERS_TO_BUILD` which takes
either a special token `all` (default) which will preserve the current behaviour
or a CMake list of sanitizers to build.  It will still perform the normal checks
if the sanitizer is requested.  It only permits a further means to exclude a
particular sanitizer.  This gives finer grained control than
`COMPILER_RT_BUILD_SANITIZERS` which only gives an all or nothing control.

llvm-svn: 279253
2016-08-19 15:13:21 +00:00
Chris Bieneman a8105c607b [CMake] Stop building eprintf library on Darwin
In r278988 clang stopped using the eprintf library, so we should stop generating it too.

llvm-svn: 279090
2016-08-18 17:10:55 +00:00
Chris Bieneman 86412e56fb [CMake] Renaming test variable to be consistent
Based on post-commit review by compnerd.

llvm-svn: 278728
2016-08-15 20:12:43 +00:00
Chris Bieneman 98ee3de514 [CMake] If the compiler supports _Atomic include atomic.c in builtins libraries
This fixes a long-standing TODO by implementing a compiler check for supporting the _Atomic keyword. If the _Atomic keyword is supported by the compiler we should include it in the builtin library sources.

llvm-svn: 278454
2016-08-12 01:29:26 +00:00
Saleem Abdulrasool 1313ae306a builtins: windows has only one flavour on ARM
Windows on ARM is a hard-float only environment.  Don't try to build two copies
of the same library.

llvm-svn: 277834
2016-08-05 16:53:05 +00:00
Jonas Hahnfeld 8ad6cc1c26 Revert "[CMake] Pass -nostdlib if supported"
This reverts commit r277419.

llvm-svn: 277420
2016-08-02 06:01:05 +00:00
Jonas Hahnfeld 55933dfb32 [CMake] Pass -nostdlib if supported
The sanitizers use C++ but don't require linking with the library.

Differential Revision: https://reviews.llvm.org/D23005

llvm-svn: 277419
2016-08-02 05:51:09 +00:00
Jonas Hahnfeld 9b2c3ab620 [CMake] Load LLVMConfig for standalone build of builtins
Therefore move some code into reusable macros.

Differential Revision: https://reviews.llvm.org/D22866

llvm-svn: 277418
2016-08-02 05:51:05 +00:00
Chris Bieneman 178cdfbf66 [CMake] Don't trust compiler error code, also check for errors
Summary: rnk reported that MSVC ignores unknown flags and still returns 0. This should cause unknown flags to be an error during the compiler check.

Reviewers: rnk

Subscribers: brad.king, llvm-commits

Differential Revision: https://reviews.llvm.org/D23030

llvm-svn: 277377
2016-08-01 20:18:18 +00:00
Daniel Sanders aea8b553e3 [compiler-rt][cmake] Don't reset CAN_TARGET_${arch} on every cmake invocation.
Allowing this variable to be cached makes it possible to repair the MIPS
buildbots in lieu of either fixing the mips64 sanitizer issues or fixing the
detection of mips64 support (which I think was changed by r268977 but didn't
take effect on this buildbot until the last couple days) so that it returns to
not being built on these buildbots.

llvm-svn: 276402
2016-07-22 10:15:09 +00:00
Daniel Sanders 8390d50e9c Revert r276256 - Attempt to fix clang-cmake-mips after r268977.
It didn't fix the problem on the buildbot. CAN_TARGET_mips64 is still true.

llvm-svn: 276258
2016-07-21 09:52:33 +00:00
Daniel Sanders 14086eae46 Attempt to fix clang-cmake-mips after r268977.
I think it's wiped out the build area and fully-reconfigured for the first time
since r268977. This seems to have caused Mips64 to become enabled when it wasn't
before because compiling with -mabi=64 succeeds but linking with -mabi=64 fails.

llvm-svn: 276256
2016-07-21 09:28:09 +00:00
Dean Michael Berris 938c5031ab [compiler-rt][XRay] re-submitting r276117, with fixes for build breakage due to extraneous and missing dependencies and attempts to build on unsupported OSes
Summary:
This is a fixed-up version of D21612, to address failure identified post-commit.

Original commit description:

This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Fixes include:
- Gating XRay build to only Linux x86_64 and with the right dependencies in case it is the only library being built
- Including <cstddef> to fix std::size_t issue

Reviewers: kcc, rnk, echristo

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D22611

llvm-svn: 276251
2016-07-21 07:39:55 +00:00
Hans Wennborg ae4e6fe990 Revert r276117 "[XRay] Basic initialization and flag definition for XRay runtime"
and also the follow-up "[xray] Only build xray on Linux for now"

Two build errors were reported on the llvm-commits list:

	[ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o
	/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found
  #include "llvm/Support/ELF.h"
					 ^

and

	In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16:
	/w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error:
				no type named 'size_t' in namespace 'std'
		std::size_t Entries;
		~~~~~^

llvm-svn: 276186
2016-07-20 21:37:38 +00:00
Francis Ricci ba2405cc5b [compiler-rt] Don't require c++ headers when configuring compiler-rt builds
Summary:
A sysroot without c++ headers is able to build compiler-rt, don't
require them when configuring available architectures from cmake.

Reviewers: samsonov, beanz, compnerd

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22469

llvm-svn: 276151
2016-07-20 18:25:46 +00:00
Francis Ricci b04a721830 [compiler-rt] Fix target architecture matching
Summary:
Use stricter comparisons for architecture. This prevents cmake from failing
for sysroots which can only compile armhf and not arm, since
arm MATCHES armhf is true, while arm STREQUAL armhf is false.

Reviewers: beanz, compnerd

Subscribers: aemerson, llvm-commits

Differential Revision: https://reviews.llvm.org/D22473

llvm-svn: 276148
2016-07-20 18:06:31 +00:00
Reid Kleckner 8367634c7a [xray] Only build xray on Linux for now
Should fix the Windows buildbots, and maybe some other non-Linux Unix
bots too.

XRay currently depends on sanitizer_common, so associate it with the
"build sanitizers" option and remove the option for separately
controlling the XRay build.

llvm-svn: 276124
2016-07-20 14:58:07 +00:00
Dean Michael Berris e1c81d10d7 [compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime
Summary:
This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Depends on D19904

Reviewers: echristo, kcc, rnk

Subscribers: rnk, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D21612

llvm-svn: 276117
2016-07-20 14:14:50 +00:00
Mohit K. Bhakkad d7ae23b563 [Compiler-rt][MIPS] Fix simple test failure when using gcc
Reviewers: dsanders

Subscribers: slthakur, jaydeep, llvm-commits, Sanitizers

Differential Revision: https://reviews.llvm.org/D22453

llvm-svn: 275780
2016-07-18 09:23:23 +00:00
Etienne Bergeron ab42f4ddba [compiler-rt] Fix VisualStudio virtual folders layout
Summary:
This patch is a refactoring of the way cmake 'targets' are grouped.
It won't affect non-UI cmake-generators.

Clang/LLVM are using a structured way to group targets which ease
navigation through Visual Studio UI. The Compiler-RT projects
differ from the way Clang/LLVM are grouping targets.

This patch doesn't contain behavior changes.

Reviewers: kubabrecka, rnk

Subscribers: wang0109, llvm-commits, kubabrecka, chrisha

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

llvm-svn: 275111
2016-07-11 21:51:56 +00:00
Chris Bieneman 42e22dcbb5 [CMake] In r273957, I deleted a line that shouldn't have been removed.
llvm-svn: 274030
2016-06-28 16:30:23 +00:00
Chris Bieneman 990ff38786 [CMake] Check for androidabi in CMakeLists.txt not base-config-ix.cmake
COMPILER_RT_DEFAULT_TARGET_ABI is not set in base-config-ix.cmake, so we need to move this check into CMakeLists.txt.

llvm-svn: 273957
2016-06-27 22:52:05 +00:00
Chris Bieneman 90b46fba3d Revert "Parse the triple in base-config-ix to propagate ANDROID variable correctly"
This reverts commit r273914.

This commit broke bots building compiler-rt using LLVM_BUILD_EXTERNAL_COMPILER_RT. See:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/22221/console

llvm-svn: 273956
2016-06-27 22:52:03 +00:00
Sumanth Gundapaneni f0fa61ffcf Parse the triple in base-config-ix to propagate ANDROID variable correctly
The triple must be parsed in base-config-ix.cmake.
Otherwise, the cmake variable ANDROID won't be set and this
will confuse cmake to build unsupported targets targeted for
android.

Diferential revision: http://reviews.llvm.org/D21474

llvm-svn: 273914
2016-06-27 19:46:50 +00:00
Chris Bieneman 38adadfe2a [CMake] Converting darwin_test_archs simple source to C
Using C instead of CXX here removes a configuration-time dependency on libcxx for the sanitizers. This should be NFC.

llvm-svn: 273505
2016-06-22 23:02:49 +00:00
Etienne Bergeron 7e2fc3b702 [compiler-rt] Split cflags and link flags to avoid warnings
Summary:
The MSVC compiler is complaining about invalid flags. The CFLAGS are passed
to the linker (i.e. /Gy-, ...).

Reviewers: rnk

Subscribers: llvm-commits, kubabrecka, chrisha

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

llvm-svn: 273265
2016-06-21 14:46:32 +00:00
Etienne Bergeron b2f17d1719 trimming whitespaces
llvm-svn: 273263
2016-06-21 14:32:52 +00:00
Marcin Koscielnicki d731820f1e Revert "Revert "[MSan] Enable on PowerPC64.""
This reverts commit r269532.

The failures triggered by the first attempt should be fixed by r273250.

llvm-svn: 273251
2016-06-21 07:13:24 +00:00
Reid Kleckner 44e6e36299 Turn off -Wunused-parameter when building compiler-rt with clang on Windows, it is very noisy
It is turned on as part of "clang-cl /W4", which enables -Wextra.

llvm-svn: 273028
2016-06-17 18:30:37 +00:00
Reid Kleckner 652d70f3e1 Fix most MSVC warnings in compiler-rt profiling library
Here's the warnings and how they were fixed:

- InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int

Include io.h to get the prototype.

- warning C4005: 'FILE_MAP_EXECUTE': macro redefinition

Stop trying to support pre-XP versions of Windows, don't attempt to
define this macro.

- InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header'
- InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes'

Turn this warning off. This is definitely legal in C++, all compilers
accept it, and I only have room for half of one language standard in my
brain.

- InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)'

Fix this with an explicit (void) in the prototype.

- InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored

Last remaining warning. This is from linking a selectany definition with
a strong definition. We need to sort out weak symbols in compiler-rt in
general, though.

llvm-svn: 273026
2016-06-17 18:12:50 +00:00
Reid Kleckner d0680ad717 Fix some warnings in the MSVC build
- Fixes warnings about the ignored -fms-compatibility-version flag.
- Fixes warnings about overriding /W4 with /W3 and back.
- Fixes a warning where PREFETCH() expanded to nothing in a braceless if
  block.

llvm-svn: 273021
2016-06-17 17:48:52 +00:00
Chris Bieneman d31a728d76 [CMake] Cleanup CMake version checking
CMAKE_VERSION is always greater than 3.0 now. No reason not to remove the extra compatibility code.

llvm-svn: 272315
2016-06-09 21:35:37 +00:00
Kostya Serebryany 712fc9803a [sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.

Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc

Subscribers: kubabrecka, filcab, llvm-commits

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

llvm-svn: 271968
2016-06-07 01:20:26 +00:00
Chris Bieneman c0d89826a7 [CMake] Support constructing output paths from LLVM variables
This tweak to constructing output paths allows compiler-rt to use LLVM
output variables if they are set regardless of whether or not the build
is in-tree.

llvm-svn: 271749
2016-06-03 23:15:04 +00:00
Chris Bieneman 648d3bc8c7 [CMake] detect_target_arch needs to be moved to Utils
This macro is called from the base config, so it can't live in config-ix, it needs to be in the utils. I suspect the only reason this hasn't caused problems is that nobody is building the Android builtins from the builtins subdirectory.

llvm-svn: 271693
2016-06-03 17:34:02 +00:00
Etienne Bergeron 00f3f6e296 This patch is activating the build of Asan on Windows 64-bits.
It's fixing compilation errors. The runtime is not yet working.

Missing features:

OverrideFunction for x64
an equiv function for inline asm (atomic_compare_exchange_strong)
shadow memory offset needs to be adjusted
RoundUpToInstrBoundary for x64
They will be implemented by subsequent patches.

Patch by Wei Wang.

Differential revision: http://reviews.llvm.org/D20455

llvm-svn: 271049
2016-05-27 21:29:31 +00:00
Kuba Brecka 6d8873b8bc [sanitizer] Fix a typo in config-ix.cmake causing all Darwin embedded platforms to be built with the 'iossim' SDK.
llvm-svn: 270840
2016-05-26 11:18:22 +00:00
Etienne Bergeron 3df2879232 [compiler-rt] Fix multi-configuration output paths
Summary:
When using a multi-configuration build (i.e. MSVC) the output path where
libraries are dropped is incorrect.

Example:
```
C:\src\llvm\examples>d:\src\llvm\build\Release\bin\clang-cl.exe -fsanitize=address test.cc
LINK : fatal error LNK1181: cannot open input file 'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\clang_rt.asan-i386.lib'
```

The dropped executable path contains the configuration 'Release':
```
'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\Release\clang_rt.asan-i386.lib'
```


The variable 'RUNTIME_OUTPUT_DIRECTORY' is used to specify the output directory.
But CMAKE is appending the current configuration (i.e. Debug, Release).

see: https://cmake.org/cmake/help/v3.0/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html
```
"Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory."
```

To avoid this problem, the configuration specific variable must be set:
'RUNTIME_OUTPUT_DIRECTORY_DEBUG', 'RUNTIME_OUTPUT_DIRECTORY_RELEASE', and so on.

Reviewers: ddunbar, chapuni, rnk

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 269658
2016-05-16 14:58:07 +00:00
Marcin Koscielnicki bcbba8caed Revert "[MSan] Enable on PowerPC64."
This reverts commit r269522.

This broke dtls_test.c on ppc64le buildbots.

llvm-svn: 269532
2016-05-14 02:17:38 +00:00
Marcin Koscielnicki c4743ff313 [MSan] Enable on PowerPC64.
Differential Revision: http://reviews.llvm.org/D20001

llvm-svn: 269522
2016-05-14 00:18:02 +00:00
Chris Bieneman 1455de2171 [CMake] Cache check results and avoid duplicate checks
This caches the result of builtin_check_c_compiler_flag, and removes a duplicate check for C99 flag support.

llvm-svn: 269230
2016-05-11 20:37:43 +00:00
Chris Bieneman c49e5e336b [CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.

This patch contains the following specific changes:

* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration

I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.

This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.

Reviewers: samsonov, iains, jroelofs

Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits

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

llvm-svn: 268977
2016-05-09 21:45:52 +00:00
Chris Bieneman aa3d2c13bf [CMake] NFC. Add support for testing the compiler without testing the linker
Summary:
One of the big limitations we have in the compiler-rt build system today is that we cannot bootstrap building the builtins because you need a fully functional toolchain to pass CMake's tests.

This change adds support for compile only tests.

It is NFC because nothing is using the compile-only tests yet.

I believe this is the last separable part of D16653.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 268427
2016-05-03 19:48:11 +00:00
Chris Bieneman 257fe3ab99 [CMake] Adding another missing include. NFC.
This also works fine today, but will break with my upcoming refactoring.

llvm-svn: 267941
2016-04-28 21:16:45 +00:00
Chris Bieneman 551ccac7e4 [CMake] Updating Apple CMake cache file
Changing the Apple CMake cache file to better match the way Apple Clang builds are built.

llvm-svn: 267913
2016-04-28 18:24:29 +00:00
Chris Bieneman 1dd58a7018 [CMake] Adding some missing CMake includes. NFC.
This happens to be working now because the includes exist in another CMake file that is included before this one. That will change with upcoming refactoring.

llvm-svn: 267912
2016-04-28 18:22:01 +00:00
Mohit K. Bhakkad 3ad70b4b5b [Compiler-rt][CFI] Enabling CFI for MIPS64
Reviewers: eugenis

Subscribers: jaydeep, sagar, Sanitizers

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

llvm-svn: 267674
2016-04-27 05:49:42 +00:00
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
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 f1f46b5766 [CMake] [Darwin] libclang_rt.eprintf should be built with the same CFLAGS as the other darwin builtin libraries.
llvm-svn: 254082
2015-11-25 19:32:32 +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
Chris Bieneman 8085475db2 [compiler-rt][cmake] Fix not lipo libclang_rt.cc_kext.a when building on OS X
Summary:

Fix r252525 - cmake configure failed to connect target builtins to target compiler-rt  because of early return call.

Patch by: Jacky Tsao (cao.zhong1)

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 253692
2015-11-20 18:45:42 +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
Chris Bieneman 4f7f57e166 [CMake] [macho_embedded] [builtins] Always use OS X sysroot, even for arm.
Turns out that there are some checks in the backend that change code generation for armv7 if you are building against an iOS sys root. For the macho_embedded builtins we really don't want that.

llvm-svn: 253064
2015-11-13 19:14:58 +00:00
Chris Bieneman 14679e9f68 [CMake] [Darwin] Forcing -fPIC on for all darwin builtins except macho_embedded
We need to add -fPIC to the flags for the builtins in case PIC was turned off at a higher level. We also want to set ENABLE_PIC to Off when building the macho_embedded builtins so the top-level settings don't impact that build.

llvm-svn: 252966
2015-11-12 22:37:03 +00:00
Chris Bieneman 66c126a042 [CMake] [Darwin] [Builtins] Force setting the flags we care about at the end of the compiler command line
Setting CMAKE_*_FLAGS isn't sufficient here because CMAKE_*_FLAGS_${CMAKE_BUILD_TYPE} can override the flags, and there is no way to safely clear that because it is a cached variable (<sarcasm> YAY! </sarcasm>).

llvm-svn: 252807
2015-11-11 21:38:35 +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
Chris Bieneman 45c40fff66 [CMake] [macho_embedded] Only set sys root if the variable is set, this prevents passing empty -isysroot arguments
This is a minor cleanup to the macho_embedded builtins.

llvm-svn: 252619
2015-11-10 17:26:40 +00:00
Chris Bieneman 9a6afeb84d [CMake] Cleaning up flags for Darwin builtins
* Setting CMAKE_*_FLAGS_${BUILD_TYPE} isn't really needed since we're setting the same value everywhere
* functions sanitize variables differently from macros, darwin_add_embedded_builtin_libraries should be a macro otherwise it won't alter the variables.

llvm-svn: 252618
2015-11-10 17:26:35 +00:00
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