summaryrefslogtreecommitdiffstats
path: root/compiler-rt/cmake/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* [XRay][compiler-rt] FDRLogWriter AbstractionDean Michael Berris2018-09-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change introduces an `FDRLogWriter` type which is responsible for serialising metadata and function records to character buffers. This is the first step in a refactoring of the implementation of the FDR runtime to allow for more granular testing of the individual components of the implementation. The main contribution of this change is a means of hiding the details of how specific records are written to a buffer, and for managing the extents of these buffers. We make use of C++ features (templates and some metaprogramming) to reduce repetition in the act of writing out specific kinds of records to the buffer. In this process, we make a number of changes across both LLVM and compiler-rt to allow us to use the `Trace` abstraction defined in the LLVM project in the testing of the runtime implementation. This gives us a closer end-to-end test which version-locks the runtime implementation with the loading implementation in LLVM. We also allow using gmock in compiler-rt unit tests, by adding the requisite definitions in the `AddCompilerRT.cmake` module. Finally, we've gone ahead and updated the FDR logging implementation to use the FDRLogWriter for the lowest-level record-writing details. Following patches will isolate the state machine transitions which manage the set-up and tear-down of the buffers we're using in multiple threads. Reviewers: mboerger, eizan Subscribers: mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52220 llvm-svn: 342518
* [CMake] Don't parse target triple except for archPetr Hosek2018-08-141-10/+4
| | | | | | | | | | | | | | compiler-rt CMake build currently tries to parse the triple and then put it back together, but doing so inherently tricky, and doing so from CMake is just crazy and currently doesn't handle triples that have more than three components. Fortunatelly, the CMake really only needs the architecture part, which is typically the first component, to construct variants for other architectures. This means we can keep the rest of the triple as is and avoid the parsing altogether. Differential Revision: https://reviews.llvm.org/D50548 llvm-svn: 339701
* [CMake] Fix bug in `add_weak_symbols()` function.Dan Liew2018-08-131-1/+9
| | | | | | | | | | | | | Previously the the `weak_symbols.txt` files could be modified and the build system wouldn't update the link flags automatically. Instead the developer had to know to reconfigure CMake manually. This is now fixed by telling CMake that the file being used to read weak symbols from is a configure-time dependency. Differential Revision: https://reviews.llvm.org/D50059 llvm-svn: 339559
* [CMake] Allow building builtins standalone out of tree without any ↵Martin Storsjo2018-08-031-35/+39
| | | | | | | | | | llvm-config available This is the same as libcxxabi/libcxx do. Differential Revision: https://reviews.llvm.org/D50134 llvm-svn: 338818
* [CMake] Add compiler-rt header files to the list of sources for targetsDan Liew2018-07-102-4/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 336663
* Support for multiarch runtimes layoutPetr Hosek2018-06-283-10/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 335809
* [CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew2018-06-273-1/+8
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 335728
* [UBsan] Enable ubsan minimal unit tests on OpenBSDDavid Carlier2018-06-251-1/+4
| | | | | | | | | | | | | 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 llvm-svn: 335524
* Revert "[CMake] Use a different source depending on C++ support"Jonas Hahnfeld2018-06-171-16/+1
| | | | | | | | | 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. llvm-svn: 334903
* [compiler-rt] Use CMAKE_LINKER instead of hardcoding ldShoaib Meenai2018-06-131-1/+1
| | | | | | | 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). llvm-svn: 334654
* [XRay] Set an explicit dependency on libc++ when neededPetr Hosek2018-06-131-2/+6
| | | | | | | | | | | 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 llvm-svn: 334575
* Reland "Passthrough additional flags to custom libcxx CMake build"Petr Hosek2018-06-131-11/+24
| | | | | | | | This is needed when we're cross-compiling compiler-rt. Differential Revision: https://reviews.llvm.org/D47834 llvm-svn: 334570
* Revert r334458, r334220, r334212, r334139.Matt Morehouse2018-06-121-41/+10
| | | | | | | Reverts changes to AddCompilerRT.cmake due to breakage of http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/. llvm-svn: 334528
* [CMake] Remove -Wno-maybe-uninitialized from passthrough vars.Matt Morehouse2018-06-121-0/+3
| | | | | | | Fixes http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/ buildbot. llvm-svn: 334458
* [CMake] Fix Libc++ Modules build.Eric Fiselier2018-06-071-0/+8
| | | | | | | | | | | | 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. llvm-svn: 334220
* [CMake] Filter out -z,defs when building custom libc++Petr Hosek2018-06-071-3/+7
| | | | | | | | | -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 llvm-svn: 334212
* [CMake] Passthrough additional flags to custom libcxx CMake buildPetr Hosek2018-06-061-11/+27
| | | | | | | | This is needed when we're cross-compiling compiler-rt. Differential Revision: https://reviews.llvm.org/D47834 llvm-svn: 334139
* [CMake] Silence unused variable warning in compiler checkPetr Hosek2018-05-221-2/+2
| | | | | | This is breaking the compiler check. llvm-svn: 332936
* [CMake] Use a different source depending on C++ supportPetr Hosek2018-05-221-1/+16
| | | | | | | | | | | 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 llvm-svn: 332924
* Revert "[CMake] Reland "Make simple source used for CMake checks a C file""Petr Hosek2018-05-211-4/+0
| | | | | | | This reverts commit rCRT332679 which doesn't quite work and will be replaced by D47100 and D47115 which is a cleaner solution. llvm-svn: 332871
* Revert r332683 & r332684 relating to compiler runtime checksReid Kleckner2018-05-181-59/+0
| | | | | | | r332683 passes flags to the compiler without first checking if they are supported. llvm-svn: 332754
* [CMake] Use <UNIX|WINDOWS>_COMMAND with separate_argumentsPetr Hosek2018-05-181-1/+5
| | | | | | NATIVE_COMMAND is only available since CMake 3.9. llvm-svn: 332684
* [CMake] Detect the compiler runtime and standard libraryPetr Hosek2018-05-181-0/+55
| | | | | | | | | | 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 llvm-svn: 332683
* [CMake] Reland "Make simple source used for CMake checks a C file"Petr Hosek2018-05-171-0/+4
| | | | | | | | | | | 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 llvm-svn: 332679
* [CMake] Cleanup find_compiler_rt_library function [NFC]Petr Hosek2018-05-171-3/+2
| | | | | | Rename the output variable and remove the unnecessary set call. llvm-svn: 332661
* Revert "[cmake] Remove duplicate command line options from build"Aaron Smith2018-04-111-2/+2
| | | | | | | | 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. llvm-svn: 329828
* [cmake] Remove duplicate command line options from buildAaron Smith2018-04-111-2/+2
| | | | | | | | | | | | | 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! llvm-svn: 329817
* [Fuzzer] Avoid the unnecessary rebuild of the custom libc++Petr Hosek2018-03-071-20/+61
| | | | | | | | | | | | 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 llvm-svn: 326921
* [PATCH] [compiler-rt, RISCV] Support builtins for RISC-VShiva Chen2018-03-011-0/+9
| | | | | | | | | | | Summary: Support builtins for RISC-V, RV32 and RV64. Reviewers: asb, apazos, mgrang Differential Revision: https://reviews.llvm.org/D42958 llvm-svn: 326420
* Revert: [compiler-rt] r323626 - [cmake] [compiler-rt] Remove duplicate ↵Don Hinton2018-01-291-1/+1
| | | | | | | | | 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. llvm-svn: 323629
* [cmake] [compiler-rt] Remove duplicate CMAKE_CXX_FLAGS.Don Hinton2018-01-291-1/+1
| | | | | | | | | | `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 llvm-svn: 323626
* [cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries.Don Hinton2018-01-271-0/+3
| | | | | | | | | 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 llvm-svn: 323606
* [sanitizer] Pass the CMake compiler to custom libc++ buildPetr Hosek2018-01-211-0/+3
| | | | | | This addresses the error introduced in r323054 on some bots. llvm-svn: 323061
* Reland "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek2018-01-211-10/+21
| | | | | | | | | | | | | 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 llvm-svn: 323054
* Revert "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek2018-01-201-30/+8
| | | | | | This reverts commit r323032: failing on the sanitizer-x86_64-linux-autoconf bot. llvm-svn: 323033
* [Fuzzer] Parametrize add_custom_libcxxPetr Hosek2018-01-201-8/+30
| | | | | | | | | | | | | 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 llvm-svn: 323032
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-141-2/+2
| | | | | | | | | | | 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 llvm-svn: 322451
* Revert "Install resource files into a share/ directory"Petr Hosek2018-01-111-2/+2
| | | | | | This reverts commit r322256: broke the dfsan build. llvm-svn: 322261
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-111-2/+2
| | | | | | | | | | | 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 llvm-svn: 322256
* Revert "Install resource files into a share/ directory"Petr Hosek2018-01-111-2/+2
| | | | | | This reverts commit r322234: this is breaking dfsan tests. llvm-svn: 322243
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-101-2/+2
| | | | | | | | | | | 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 llvm-svn: 322234
* Revert "[CMake] Install resource files into a share/ directory"Petr Hosek2018-01-101-1/+1
| | | | | | This reverts commit r322153 because it broke the sanitizer bots. llvm-svn: 322156
* [CMake] Install resource files into a share/ directoryPetr Hosek2018-01-101-1/+1
| | | | | | | | | | | 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 llvm-svn: 322153
* [CMake] Allow passing extra CMake arguments to custom libc++Petr Hosek2017-12-211-1/+2
| | | | | | | | This can be used to customize the libc++ build. Differential Revision: https://reviews.llvm.org/D41103 llvm-svn: 321299
* [CMake] Support runtimes and monorepo layouts when looking for libcxxPetr Hosek2017-12-121-1/+1
| | | | | | | | | 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
* [compiler-rt] Add install-*-stripped targetsShoaib Meenai2017-12-011-0/+16
| | | | | | | | | | | 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 llvm-svn: 319569
* Add powerpc64 to compiler-rt build infrastructure.Sterling Augustine2017-11-301-0/+6
| | | | | | | | 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. llvm-svn: 319474
* [sanitizer] Refactor how assembly files are handledKuba Mracek2017-11-291-0/+11
| | | | | | | | 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 llvm-svn: 319339
* Allow compiler-rt test targets to work with multi-config CMake generatorsGreg Bedwell2017-11-131-0/+11
| | | | | | | | | | 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 llvm-svn: 318037
* [cmake] Fix skipping DEPS (typo) in sanitizer_test_compile()Michal Gorny2017-10-121-1/+1
| | | | | | | | | | 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 llvm-svn: 315604
OpenPOWER on IntegriCloud