summaryrefslogtreecommitdiff
path: root/cmake/Modules
AgeCommit message (Collapse)Author
2018-07-10[CMake] Add compiler-rt header files to the list of sources for targetsDan Liew
when building with an IDE so that header files show up in the UI. This massively improves the development workflow in IDEs. To implement this a new function `compiler_rt_process_sources(...)` has been added that adds header files to the list of sources when the generator is an IDE. For non-IDE generators (e.g. Ninja/Makefile) no changes are made to the list of source files. The function can be passed a list of headers via the `ADDITIONAL_HEADERS` argument. For each runtime library a list of explicit header files has been added and passed via `ADDITIONAL_HEADERS`. For `tsan` and `sanitizer_common` a list of headers was already present but it was stale and has been updated to reflect the current state of the source tree. The original version of this patch used file globbing (`*.{h,inc,def}`) to find the headers but the approach was changed due to this being a CMake anti-pattern (if the list of headers changes CMake won't automatically re-generate if globbing is used). The LLVM repo contains a similar function named `llvm_process_sources()` but we don't use it here for several reasons: * It depends on the `LLVM_ENABLE_OPTION` cache variable which is not set in standalone compiler-rt builds. * We would have to `include(LLVMProcessSources)` which I'd like to avoid because it would include a bunch of stuff we don't need. Differential Revision: https://reviews.llvm.org/D48422 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336663 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28Support for multiarch runtimes layoutPetr Hosek
This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335809 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew
build with an IDE (e.g. Xcode) as the generator. Previously the global `USE_FOLDERS` property wasn't set in standalone builds leading to existing settings of FOLDER not being respected. In addition to this there were several targets that appeared at the top level that were not interesting and clustered up the view. These have been changed to be displayed in "Compiler-RT Misc". Now when an Xcode project is generated from a standalone compiler-rt build the project navigator is much less cluttered. The interesting libraries should appear in "Compiler-RT Libraries" in the IDE. Differential Revision: https://reviews.llvm.org/D48378 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335728 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25[UBsan] Enable ubsan minimal unit tests on OpenBSDDavid Carlier
OpenBSD needs lld linker for sanitisers. Disabling lint checking as some symbols cannot be defined and block the proper unit tests launch. Reviewers: lebedev.ri, vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48528 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335524 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-17Revert "[CMake] Use a different source depending on C++ support"Jonas Hahnfeld
This reverts commit r332924 and followup r332936 silencing a warning. The change breaks the build on x86 if there is no 32-bit version of the C++ libraries, see discussion in https://reviews.llvm.org/D47169. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334903 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13[compiler-rt] Use CMAKE_LINKER instead of hardcoding ldShoaib Meenai
Respect a custom linker path provided by the user if one is present (otherwise CMAKE_LINKER will have been set to the right value by CMake). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334654 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13[XRay] Set an explicit dependency on libc++ when neededPetr Hosek
When XRay is being built as part of the just built compiler together with libc++ as part of the runtimes build, we need an explicit dependency from XRay to libc++ to make sure that the library is available by the time we start building XRay. Differential Revision: https://reviews.llvm.org/D48113 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334575 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13Reland "Passthrough additional flags to custom libcxx CMake build"Petr Hosek
This is needed when we're cross-compiling compiler-rt. Differential Revision: https://reviews.llvm.org/D47834 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334570 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12Revert r334458, r334220, r334212, r334139.Matt Morehouse
Reverts changes to AddCompilerRT.cmake due to breakage of http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334528 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12[CMake] Remove -Wno-maybe-uninitialized from passthrough vars.Matt Morehouse
Fixes http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/ buildbot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334458 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07[CMake] Fix Libc++ Modules build.Eric Fiselier
When building the dylib, the C++ headers are fundamentally non-module. They require special versions of the headers in order to provide C++03 and legacy ABI definitions. This causes ODR issues when modules are enabled during both the build and the usage of the libc++ headers. This patch fixes the build error by disabling modules when building the libc++ sources. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334220 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07[CMake] Filter out -z,defs when building custom libc++Petr Hosek
-z,defs is incompatible with sanitizers so we need to filter it out from the linker flags before passing them to the libc++ build. Differential Revision: https://reviews.llvm.org/D47865 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334212 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06[CMake] Passthrough additional flags to custom libcxx CMake buildPetr Hosek
This is needed when we're cross-compiling compiler-rt. Differential Revision: https://reviews.llvm.org/D47834 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334139 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22[CMake] Silence unused variable warning in compiler checkPetr Hosek
This is breaking the compiler check. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332936 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22[CMake] Use a different source depending on C++ supportPetr Hosek
When using system C++ library, assume we have a working C++ compiler and try to compile a complete C++ program. When using in tree C++ library, only check the C compiler since the C++ library likely won't have been built yet at time of running the check. Differential Revision: https://reviews.llvm.org/D47169 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332924 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21Revert "[CMake] Reland "Make simple source used for CMake checks a C file""Petr Hosek
This reverts commit rCRT332679 which doesn't quite work and will be replaced by D47100 and D47115 which is a cleaner solution. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332871 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18Revert r332683 & r332684 relating to compiler runtime checksReid Kleckner
r332683 passes flags to the compiler without first checking if they are supported. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332754 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18[CMake] Use <UNIX|WINDOWS>_COMMAND with separate_argumentsPetr Hosek
NATIVE_COMMAND is only available since CMake 3.9. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18[CMake] Detect the compiler runtime and standard libraryPetr Hosek
Rather then requiring the user to specify runtime the compiler runtime and C++ standard library, or trying to guess them which is error-prone, use auto-detection by parsing the compiler link output. Differential Revision: https://reviews.llvm.org/D46857 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332683 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17[CMake] Reland "Make simple source used for CMake checks a C file"Petr Hosek
The source being compiled is plain C, but using .cc extension forces it to be compiled as C++ which requires a working C++ compiler including C++ library which may not be the case when we're building compiler-rt together with libcxx as part of runtimes build. Differential Revision: https://reviews.llvm.org/D47031 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332679 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17[CMake] Cleanup find_compiler_rt_library function [NFC]Petr Hosek
Rename the output variable and remove the unnecessary set call. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11Revert "[cmake] Remove duplicate command line options from build"Aaron Smith
The Android sanitizer buildbot is failing with this change and it looks like an additional change to cmake is necessary to fix the build. Reverting this change for now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329828 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11[cmake] Remove duplicate command line options from buildAaron Smith
CMAKE_CXX_FLAGS was added twice to the command line. This causes the command line options to be doubled which works until it doesn't as not all options can be specified twice. For example, clang-cl foo.c /GS- /GS- -mllvm -small-loop-cost=1 -mllvm -small-loop-cost=1 clang (LLVM option parsing): for the -small-loop-cost option: may only occur zero or one times! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@329817 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[Fuzzer] Avoid the unnecessary rebuild of the custom libc++Petr Hosek
This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326921 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01[PATCH] [compiler-rt, RISCV] Support builtins for RISC-VShiva Chen
Summary: Support builtins for RISC-V, RV32 and RV64. Reviewers: asb, apazos, mgrang Differential Revision: https://reviews.llvm.org/D42958 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326420 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29Revert: [compiler-rt] r323626 - [cmake] [compiler-rt] Remove duplicate ↵Don Hinton
CMAKE_CXX_FLAGS. Looks like it broke a bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/7195 Reverting until I have a chance to investigate. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323629 91177308-0d34-0410-b5e6-96231b3b80d8
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-30Add powerpc64 to compiler-rt build infrastructure.Sterling Augustine
Now that we have disabled the run-forever tests, and cleaned up the intel 80-bit float based tests, we should be able to enable testing compiler-rt for powerpc64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319474 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-10-12[cmake] Fix skipping DEPS (typo) in sanitizer_test_compile()Michal Gorny
Fix typo in variable assignment inside sanitizer_test_compile() that resulted in TEST_DEPS parameter not being included in the clang_compile() call. Spotted by George Karpenkov in D38444. Differential Revision: https://reviews.llvm.org/D38838 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315604 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-30[builtins] Prevent duplicate definitions for overridden functionsFrancis Ricci
Summary: Some architecture-specific function overrides (for example, i386/ashrdi3.S) duplicate generic functions (in that case, ashrdi3.c). Prevent duplicate definitions by filtering out the generic files before compiling. Reviewers: compnerd, beanz Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D37166 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312140 91177308-0d34-0410-b5e6-96231b3b80d8