summaryrefslogtreecommitdiff
path: root/cmake/Modules/AddCompilerRT.cmake
AgeCommit message (Collapse)Author
2018-01-29[cmake] [compiler-rt] Remove duplicate CMAKE_CXX_FLAGS.Don Hinton
`set_target_compile_flags()` ultimately sets COMPILE_FLAGS which is added to CMAKE_CXX_FLAGS in the compile rule, so passing CMAKE_CXX_FLAGS causes them to be duplicated. Differential Revision: https://reviews.llvm.org/D42398 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323626 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-27[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries.Don Hinton
Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42462 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323606 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-21[sanitizer] Pass the CMake compiler to custom libc++ buildPetr Hosek
This addresses the error introduced in r323054 on some bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323061 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-21Reland "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek
add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323054 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20Revert "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek
This reverts commit r323032: failing on the sanitizer-x86_64-linux-autoconf bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323033 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20[Fuzzer] Parametrize add_custom_libcxxPetr Hosek
add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323032 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-14Reland "Install resource files into a share/ directory"Petr Hosek
Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322451 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11Revert "Install resource files into a share/ directory"Petr Hosek
This reverts commit r322256: broke the dfsan build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322261 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11Reland "Install resource files into a share/ directory"Petr Hosek
Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322256 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11Revert "Install resource files into a share/ directory"Petr Hosek
This reverts commit r322234: this is breaking dfsan tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322243 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10Reland "Install resource files into a share/ directory"Petr Hosek
Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322234 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10Revert "[CMake] Install resource files into a share/ directory"Petr Hosek
This reverts commit r322153 because it broke the sanitizer bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322156 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10[CMake] Install resource files into a share/ directoryPetr Hosek
Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[CMake] Allow passing extra CMake arguments to custom libc++Petr Hosek
This can be used to customize the libc++ build. Differential Revision: https://reviews.llvm.org/D41103 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321299 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-12[CMake] Support runtimes and monorepo layouts when looking for libcxxPetr Hosek
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320446 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[compiler-rt] Add install-*-stripped targetsShoaib Meenai
These targets strip during installation, and are required to support install-distribution-stripped in LLVM (to support a stripped distribution). LLVM has an add_llvm_install_targets function for this purpose, but we can't rely on LLVM being present. Differential Revision: https://reviews.llvm.org/D40687 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319569 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[sanitizer] Refactor how assembly files are handledKuba Mracek
This renames ASM_TSAN_SYMBOL and ASM_TSAN_SYMBOL_INTERCEPTOR to just ASM_SYMBOL and ASM_SYMBOL_INTERCEPTOR, because they can be useful in more places than just TSan. Also introduce a CMake function to add ASM sources to a target. Differential Revision: https://reviews.llvm.org/D40143 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319339 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13Allow compiler-rt test targets to work with multi-config CMake generatorsGreg Bedwell
Multi-config CMake generators need lit to be able to resolve paths of artifacts from previous build steps at lit time, rather than expect them to be fully resolved at CMake time as they may contain the build mode. Differential Revision: https://reviews.llvm.org/D38471 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318037 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07[cmake] Work around more -Wunused-driver-argument warningsVedant Kumar
add_compiler_rt_object_libraries should strip out the -msse3 option on non-macOS Apple platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01[cmake] Remove accidentally committed warning messagesVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01[cmake] Work around -Wunused-driver-argument warningsVedant Kumar
Fix the Darwin logic so that -msse3 is only used on macOS, and -fomit-frame-pointer is not used on armv7/armv7k/armv7s. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29Restore clang_rt library name on i686-android.Evgeniy Stepanov
Summary: Recent changes canonicalized clang_rt library names to refer to "i386" on all x86 targets. Android historically uses i686. This change adds a special case to keep i686 in all clang_rt libraries when targeting Android. Reviewers: hans, mgorny, beanz Subscribers: srhines, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D37278 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-21Move libFuzzer to compiler_rt.George Karpenkov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-21[NFC CMake] Do not relink test targets every time in compiler-rtGeorge Karpenkov
CMake's add_custom_target is considered to be *always* out of date. This patch changes it to a combination of add_custom_target and add_custom_command which actually tracks dependencies' timestamps. On my machine this reliably saves 6-7 seconds on each test group. This can be a large difference when debugging small tests. Differential Revision: https://reviews.llvm.org/D36912 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15Quickfix to the refactoring commit: typo in the link flags variableGeorge Karpenkov
name. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310973 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov
into a function. Most CMake configuration under compiler-rt/lib/*/tests have almost-the-same-but-not-quite functions of the form add_X_[unit]tests for compiling and running the tests. Much of the logic is duplicated with minor variations across different sub-folders. This can harm productivity for multiple reasons: For newcomers, resulting CMake files are very large, hard to understand, and hide the intention of the code. Changes for enabling certain architectures end up being unnecessarily large, as they get duplicated across multiple folders. Adding new sub-projects requires more effort than it should, as a developer has to again copy-n-paste the configuration, and it's not even clear from which sub-project it should be copy-n-pasted. With this change the logic of compile-and-generate-a-set-of-tests is extracted into a function, which hopefully makes writing and reading CMake much easier. Differential Revision: https://reviews.llvm.org/D36116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[compiler-rt CMake] CMake refactoring: create directories in helper func.George Karpenkov
Change macro to a function, move creating test directory into `add_compiler_rt_test`. Differential Revision: https://reviews.llvm.org/D36724 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizers] Sanitizer tests CMake clean up: try #2George Karpenkov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309341 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27Revert "[sanitizers] Sanitizer tests CMake clean up"George Karpenkov
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a. Fails on some bots, reverting until I can fix it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309318 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27[sanitizers] Sanitizer tests CMake clean upGeorge Karpenkov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309306 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26[asan] Add support for running lit tests in the iOS SimulatorKuba Mracek
This patch adds a basic support for running the ASan lit test suite against an iOS Simulator. This is done by generating more lit.site.cfg configurations into subdirectories such as IOSSimI386Config and IOSSimX86_64Config. These test suites are not added into "check-all" or into "check-asan", they have to be run manually. Differential Revision: https://reviews.llvm.org/D31477 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22[compiler-rt] build compiler-rt runtimes without LTOBob Haarman
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-16Reland "[CMake][compiler-rt] Mark libcxx build for tsan as standalone"Petr Hosek
This relands commit r291722. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[CMake][compiler-rt] Mark libcxx build for tsan as standalone"Petr Hosek
This reverts commit 08dbefb847bb765b387c67dc2dc2ef90a4927312. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11[CMake][compiler-rt] Mark libcxx build for tsan as standalonePetr Hosek
This is to ensure that the libcxx build is properly configured. Differential Revision: https://reviews.llvm.org/D28579 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10Make cmake link flag naming consistentFrancis Ricci
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05[gtest] Teach the sanitizer's custom gtest compilations to disableChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25Remove a VS 2012 workaround, we require 2015 now.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07[compiler-rt] Fix library suffixes on windowsFrancis Ricci
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
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). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19[CMake] Add top-level install-compiler-rt targetChris Bieneman
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21[compiler-rt] Split cflags and link flags to avoid warningsEtienne Bergeron
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16[compiler-rt] Fix multi-configuration output pathsEtienne Bergeron
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31[CMake] Provide the ability to skip stripping when generating dSYMsChris Bieneman
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@265057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26[CMake] Fix a typo in add_compiler_rt_library.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Support component-based installation for runtime librariesChris Bieneman
This enables targets like "install-ubsan" and "install-asan" to install all associated runtime libraries. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Assign components and dependencies during add_compiler_rt_resource_fileChris Bieneman
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261699 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[CMake] Push the dependency on AddLLVM into the test and unites layersChris Bieneman
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02[compiler-rt] add_custom_libcxx should pass LLVM_PATH and a C++ compilerDaniel Sanders
Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16681 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259493 91177308-0d34-0410-b5e6-96231b3b80d8