Commit Graph

274 Commits

Author SHA1 Message Date
Petr Hosek 95d7a4197a [CMake] Support runtimes and monorepo layouts when looking for libcxx
This also slightly refactors the code that's checking the directory
presence which allows eliminating one unnecessary variable.

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

llvm-svn: 320446
2017-12-12 01:20:52 +00:00
Shoaib Meenai 5cd0f44abc [compiler-rt] Remove out of date comment
Per beanz, building compiler-rt standalone is a pretty important use
case, so the comment is very out of date.

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

llvm-svn: 319570
2017-12-01 19:06:30 +00:00
Weiming Zhao e4ba19efdc [compiler-rt] Avoid unnecessarily hiding inline visibility [NFC]
Summary:
having fvisibility=hidden obviates the need for
fvisibility-inlines-hidden.

Reviewers: cryptoad, weimingz, mgorny, vsk, compnerd, peter.smith, nikhgupt

Reviewed By: vsk, nikhgupt

Subscribers: dberris, mgorny

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

llvm-svn: 319257
2017-11-28 23:41:42 +00:00
Walter Lee 52b2bd7845 [asan] Add CMake hook to override shadow scale in compiler_rt
Allow user to override shadow scale in compiler_rt by passing
-DCOMPILER_RT_ASAN_SHADOW_SCALE=n to CMake.  Propagate the override
shadow scale value via a compiler define to compiler-rt and asan
tests.  Tests will use the define to partially disable unsupported
tests.  Set "-mllvm -asan-mapping-scale=<n>" for compiler_rt tests.

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

llvm-svn: 318038
2017-11-13 14:02:27 +00:00
Michal Gorny 806b8d56a2 [cmake] Add a separate CMake var to control profile runtime
Make it possible to control building profile runtime separately from
other options. Before r313549, the profile runtime building was
controlled along with sanitizers. However, since that commit it is built
unconditionally which results in multiple builds for people building
different runtimes separately.

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

llvm-svn: 314646
2017-10-02 05:03:55 +00:00
Francis Ricci d327254b1b Set ANDROID when any android abi is used, not just androideabi
Reviewers: compnerd, beanz

Subscribers: srhines, mgorny, llvm-commits

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

Change-Id: Idab521f187aba18977818d91503763e0e9d3aa0e
llvm-svn: 313652
2017-09-19 17:56:27 +00:00
Francis Ricci ba064be7af Ensure that armhf builtins library is created when using an hf abi
Reviewers: beanz, compnerd

Reviewed By: compnerd

Subscribers: aemerson, mgorny, kristof.beyls, llvm-commits

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

llvm-svn: 313650
2017-09-19 17:54:11 +00:00
Vitaly Buka 0dc3ef3734 [sanitizer] Move android_commoands from asan into sanitizer_common
llvm-svn: 313443
2017-09-16 05:13:56 +00:00
Zachary Turner ce92db13ea Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

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

llvm-svn: 313407
2017-09-15 22:10:46 +00:00
Peter Collingbourne d13d61fdb4 ubsan: Unbreak ubsan_cxx runtime library on Windows.
This was originally broken by r258744 which introduced a weak reference
from ubsan to ubsan_cxx. This reference does not work directly on
Windows because COFF has no direct concept of weak symbols. The fix is
to use /alternatename to create a weak external reference to ubsan_cxx.

Also fix the definition (and the name, so that we drop cached values)
of the cmake flag that controls whether to build ubsan_cxx. Now the
user-controllable flag is always on, and we turn it off internally
depending on whether we support building it.

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

llvm-svn: 313391
2017-09-15 20:24:12 +00:00
Zachary Turner 1929ffd452 Revert "Determine up front which projects are enabled."
This was intended to be a generic CMake solution to a problem
shared across several projects.  It turns out it doesn't interact
very well certain CMake configurations, and furthermore the
"problem" is actually not a problem, as the problematic code
is never executed to begin with.  So this really isn't solving
anything.

llvm-svn: 313191
2017-09-13 20:49:25 +00:00
Petr Hosek d8328f13ac [Fuchsia] Magenta -> Zircon
Fuchsia's lowest API layer has been renamed from Magenta to Zircon.

Patch by Roland McGrath

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

llvm-svn: 313106
2017-09-13 01:18:15 +00:00
Zachary Turner c7fc93946c Determine up front which projects are enabled.
Some projects need to add conditional dependencies on other projects.
compiler-rt is already doing this, and I attempted to add this to
debuginfo-tests when I ran into the ordering problem, that you can't
conditionally add a dependency unless that dependency's CMakeLists.txt
has already been run (which would allow you to say if (TARGET foo).

The solution to this seems to be to determine very early on the entire
set of projects which is enabled. This is complicated by the fact that
there are multiple ways to enable projects, and different tree layouts
(e.g. mono-repo, out of -tree, external, etc). This patch attempts to
centralize all of this into one place, and then updates compiler-rt to
demonstrate as a proof of concept how this can simplify code.

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

llvm-svn: 313091
2017-09-12 23:32:34 +00:00
George Karpenkov 10ab2ace13 Move libFuzzer to compiler_rt.
Resulting library binaries will be named libclang_rt.fuzzer*, and will
be placed in Clang toolchain, allowing redistribution.

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

llvm-svn: 311407
2017-08-21 23:25:50 +00:00
Evgeniy Stepanov b52b141dd0 Fix a cmake typo.
Also add "libc++" to list of property values (AFAIK that only affects the cmake gui).

llvm-svn: 310883
2017-08-14 20:42:43 +00:00
Evgeniy Stepanov 3072b539da [compiler-rt] Add SANITIZER_CXX_ABI_LIBNAME=libc++ option.
Summary: This is to support Android where libc++abi is part of libc++.

Reviewers: srhines, EricWF

Subscribers: dberris, mgorny, llvm-commits

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

llvm-svn: 310769
2017-08-11 22:28:02 +00:00
Dean Michael Berris 449fdf816e [XRay][compiler-rt] Allow for building the XRay runtime without PREINIT initialization.
Summary:
Define a build-time configuration option for the XRay runtime to
determine whether the archive will add an entry to the `.preinit_array`
section of the binary. We also allow for initializing the XRay data
structures with an explicit call to __xray_init(). This allows us to
give users the capability to initialize the XRay data structures on
demand.

This can allow us to start porting XRay to platforms where
`.preinit_array` isn't a supported section. It also allows us to limit
the effects of XRay in the initialization sequence for applications that
are sensitive to this kind of interference (i.e. large binaries) or
those that want to package XRay control in libraries.

Future changes should allow us to build two different library archives
for the XRay runtime, and allow clang users to determine which version
to link.

Reviewers: dblaikie, kpw, pelikan

Subscribers: mgorny, llvm-commits

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

llvm-svn: 309909
2017-08-03 00:58:45 +00:00
Vitaly Buka 5d960ec420 [sanitizer_common] Fuchsia OS support code
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: cryptoad, srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309756
2017-08-01 22:22:25 +00:00
Petr Hosek a14a2cc5ce [sanitizer] Fix the sanitizer build on Android
Android uses libgcc name even for shared library unlike other platforms
which use libgcc_s. Furthemore, Android libstdc++ has a dependency on
libdl. These need to be handled while performing CMake checks.

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

llvm-svn: 309638
2017-07-31 22:46:43 +00:00
Petr Hosek a7a9ca4ad1 Support libc++abi in addition to libstdc++
This change adds sanitizer support for LLVM's libunwind and libc++abi
as an alternative to libstdc++. This allows using the in tree version
of libunwind and libc++abi which is useful when building a toolchain
for different target.

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

llvm-svn: 309362
2017-07-28 03:39:39 +00:00
Petr Hosek 2bbb6ad217 Support compiler-rt builtins
This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

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

llvm-svn: 309361
2017-07-28 03:39:38 +00:00
George Karpenkov 50dd3fe903 [sanitizers] Sanitizer tests CMake clean up: try #2
This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

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

llvm-svn: 309341
2017-07-28 00:50:56 +00:00
Petr Hosek 3243a13f0a Revert "[sanitizer] Support compiler-rt builtins"
This reverts commit fd63314d6770e0da62572a3fea2c41c4cc0fc58a.

llvm-svn: 309083
2017-07-26 06:46:11 +00:00
Petr Hosek cc9559f515 Revert "[sanitizer] Support libc++abi in addition to libstdc++"
This reverts commit d1997bff31cf6b484eb59c2ee1fc3155442e338c.

llvm-svn: 309082
2017-07-26 06:46:10 +00:00
Petr Hosek c2c3d6b87b [sanitizer] Support libc++abi in addition to libstdc++
This change adds sanitizer support for LLVM's libunwind and libc++abi
as an alternative to libstdc++. This allows using the in tree version
of libunwind and libc++abi which is useful when building a toolchain
for different target.

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

llvm-svn: 309074
2017-07-26 01:43:02 +00:00
Petr Hosek b1305ce038 [sanitizer] Support compiler-rt builtins
This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

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

llvm-svn: 309060
2017-07-25 23:38:25 +00:00
George Karpenkov e89d0a8f5c [compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so
Differential Revision: https://reviews.llvm.org/D35400

llvm-svn: 308072
2017-07-15 00:30:46 +00:00
Kuba Mracek 5c2e3e2b75 Make sure SANITIZER_MIN_OSX_VERSION is defined before using it.
llvm-svn: 307448
2017-07-07 22:40:13 +00:00
Pirama Arumuga Nainar 31b825d834 Call cmake_minimum_required at the top of CMakeLists.txt
Summary:
Since r298413, the NEW behavior of the CMake policy CMP0056 is followed.
However, it is only effective after the call to cmake_minimum_required.
This causes CMAKE_EXE_LINKER_FLAGS etc. to be unused when CMake tries to
check compilers for languages specified in the 'project' declaration.

Set cmake_minimum_required(VERSION) at the top of the file and ahead of
the project declaration.

Reviewers: beanz

Subscribers: mgorny, srhines, llvm-commits

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

llvm-svn: 305593
2017-06-16 21:14:45 +00:00
Tim Northover ada043541d CMake: don't try to use lld if we're not building it.
Monorepo version!

llvm-svn: 304716
2017-06-05 15:10:04 +00:00
Catherine Moore 61efa174d7 [cmake] Disable building enable_execute_stack.c for baremetal targets.
Disable building enable_execute_stack.c for targets that do not have
support for mprotect().

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

llvm-svn: 302680
2017-05-10 15:34:25 +00:00
Reid Kleckner e2328ebae2 Allow compiler-rt to find lld and libc++ parallel to LLVM, as in the monorepo
llvm-svn: 302541
2017-05-09 15:54:57 +00:00
Kuba Mracek 90caf899eb [sanitizers] Avoid using -fomit-frame-pointer on Darwin
On Darwin, we're having multiple issues with using -fomit-frame-pointer in the AddressSanitizer and ThreadSanitizer runtimes, so we're actually not using -fomit-frame-pointer in the our builds of the sanitizer dylibs. This patch just pushes our internal change upstream.

The issues are usually with debuggers, profilers and other tools that unwind the stack (crash reporter), which are often simply not able to get a stack trace. And crashlogs that don't contain a stack trace are a huge problem.

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

llvm-svn: 298859
2017-03-27 17:14:48 +00:00
Evgeniy Stepanov 656bc5bb5c Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Only depend on LLD if it is going to be built.

Re-land of r298174 which got reverted in r298287.

llvm-svn: 298753
2017-03-25 00:42:25 +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
Evgeniy Stepanov 3bf85d3124 Revert r298174, r298173, r298169, r298159.
Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF."
Revert "[asan] Remove gc-sections test with bfd."
Revert "[asan] Disable globals-gc test with ld.bfd."
Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)"

OOM in gold linker.

llvm-svn: 298287
2017-03-20 18:45:27 +00:00
Evgeniy Stepanov 0e6cb1925c Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Only depend on LLD if it is going to be built.

llvm-svn: 298174
2017-03-18 00:25:43 +00:00
Kostya Kortchinsky 2282ede5a8 [sanitizer] Re-enable -fno-function-sections for powerpc64le
Summary:
For a reason that hasn't been investigated for lack of powerpc knowledge and
hardware, -fno-function-sections is required for the Sanitizers to work
properly on powerpc64le. Without, the function-sections-are-bad test fails on
that architecture (and that architecture only).

This patch re-enables the flag in the powerpc64le cflags.

I have to admit I am not entirely sure if my way is the proper way to do this,
so if anyone has a better way, I'll be happy to oblige.

Reviewers: kcc, eugenis

Reviewed By: eugenis

Subscribers: nemanjai, mgorny, llvm-commits

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

llvm-svn: 293558
2017-01-30 22:31:49 +00:00
Kostya Kortchinsky fb275a48b8 [sanitizer] Remove -fno-function-sections from SANITIZER_COMMON_CFLAGS
Summary:
-fno-function-sections was added as a default Sanitizer common cflag with
https://reviews.llvm.org/rL200683, the reasoning behind was that things would
break if linked with --gc-sections.

This appears to not be necessary anymore, as tests pass without, including
function-sections-are-bad.cc. There is a large benefit to having
function-sections when dealing with static libraries in terms of size and
dependencies that go away with --gc-sections.

Reviewers: kcc, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, mgorny

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

llvm-svn: 293220
2017-01-26 22:50:22 +00:00
Bob Haarman f51b0d5908 [compiler-rt] suppress LNK4221 warning when creating static libraries
Summary:
We put empty object files in archives, which causes MSVC's linker to
complain about these objects not defining any previously undefined
symbols. Since we do it on purpose, this only creates noise during
the build process. This patch causes us to suppress the warnings.

Reviewers: rnk, samsonov

Subscribers: dberris, mgorny

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

llvm-svn: 291011
2017-01-04 21:40:00 +00:00
Kuba Brecka ab61c74f93 [compiler-rt] Exclude compiler-rt from using -fmodules when LLVM_ENABLE_MODULES=On
Sanitizers are intentionally not including system headers and often declare slightly different function prototypes, which is incompatible with -fmodules and -fcxx-modules. Let’s simply exclude compiler-rt from using -fmodules.

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

llvm-svn: 283658
2016-10-08 09:01:27 +00:00
Vedant Kumar cb7110be27 [ubsan] Turn on 'Has CXXABI' to enable support for -fsanitize=vptr on Darwin
Differential Revision: https://reviews.llvm.org/D24990

llvm-svn: 283466
2016-10-06 16:45:40 +00:00
Francis Ricci 0b6f487c63 [compiler-rt] Don't use -fPIC when building for Windows
Summary: This flag doesn't make sense on Windows systems.

Reviewers: beanz, kubabrecka, compnerd

Subscribers: dberris, llvm-commits, beanz

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

llvm-svn: 280953
2016-09-08 15:57:22 +00:00
Francis Ricci 9cf5e4fc00 [compiler-rt] Make cxxabi availability configurable in cmake
Summary:
Allow for use of cxxabi to be disabled from cmake.

This will make sanitizers usable when c++ abi is unavailable.

Reviewers: pcc, rnk, samsonov, beanz, compnerd

Subscribers: llvm-commits, compnerd, dberris

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

llvm-svn: 279451
2016-08-22 18:31:37 +00:00
Jonas Hahnfeld ddbab7d982 [CMake] Fix ASM building in llvm/runtimes
When compiler-rt's CMake is not directly invoked, it will currently not call
project() and thus ASM will not be enabled.
We also don't need to put the .S files through the C compiler then.

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

llvm-svn: 279215
2016-08-19 06:46:00 +00:00
Francis Ricci 39bc97a1ec Revert "[compiler-rt] Allow c++ abi to be explictly disabled in cmake configuration"
This reverts commit dbb6e905684e2e9488887b26c02ee8881849f09f.

llvm-svn: 278852
2016-08-16 20:52:22 +00:00
Francis Ricci 6802eb0868 [compiler-rt] Allow c++ abi to be explictly disabled in cmake configuration
Summary: This will allow for the sanitizers to be used when c++ abi is unavailable.

Reviewers: samsonov, beanz, pcc, rnk

Subscribers: llvm-commits, kubabrecka, compnerd, dberris

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

llvm-svn: 278848
2016-08-16 20:39:10 +00:00
Francis Ricci 3d6aa8a475 Revert "[compiler-rt] Allow c++ abi to be explictly disabled in cmake configuration"
This reverts commit cd5fa595648378f38cdad8b07e18433639c28a9c.

llvm-svn: 278800
2016-08-16 13:58:56 +00:00
Francis Ricci fda072de97 [compiler-rt] Allow c++ abi to be explictly disabled in cmake configuration
Summary: This will allow for the sanitizers to be used when c++ abi is unavailable.

    Reviewers: samsonov, beanz, pcc, rnk

    Subscribers: llvm-commits, kubabrecka, compnerd, dberris

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

llvm-svn: 278772
2016-08-16 02:15:51 +00:00
Francis Ricci 1185b4ae8d Revert "[compiler-rt] Allow c++ abi to be explictly disabled in cmake configuration"
This reverts commit 9528d86531b1289600e18c407b8e992d7fedb94f.

llvm-svn: 278769
2016-08-16 01:11:07 +00:00