summaryrefslogtreecommitdiff
path: root/cmake
AgeCommit message (Collapse)Author
2018-01-22Merging r322973:Hans Wennborg
------------------------------------------------------------------------ r322973 | mgorny | 2018-01-19 18:47:03 +0100 (Fri, 19 Jan 2018) | 7 lines [cmake] Include LLVM_LIBXML2_ENABLED in LLVMConfig.cmake, PR36006 Include the LLVM_LIBXML2_ENABLED cache variable in LLVMConfig.cmake in order to make it available for other LLVM packages to query. This is necessary to fix stand-alone testing of LLD. Differential Revision: https://reviews.llvm.org/D42252 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323107 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02[opt-viewer] Check for pygments.lexer.c_cppJonas Hahnfeld
Some systems still don't have this module which was introduced in version 2.0 (CentOS 7, sigh). Differential Revision: https://reviews.llvm.org/D41611 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321659 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-25[cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ↵Don Hinton
ones. Summary: Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones. This is important when cross compiling where --sysroot and -target were already added. In particular, this is needed when cross compiling from Darwin to Linux, since --sysroot is required to find headers and libraries. Cmake has a similar bug in check_include_file[_cxx] where CMAKE_REQUIRED_LIBRARIES isn't passed, which causes try_compile to fail. (please see https://gitlab.kitware.com/cmake/cmake/merge_requests/1620) Reviewers: compnerd, silvas, beanz, brad.king Reviewed By: compnerd Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D41568 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15[cmake] Fix clang-cl cross-compilation on macOSShoaib Meenai
macOS paths usually start with /Users, which clang-cl interprets as a macro undefine, leading to pretty much everything failing to compile. CMake should be taught to put a -- in its compilation rules for clang-cl (and I've been meaning to submit that upstream for a while). In the meantime, however, and to support older CMake versions, we can just create a custom make rules override to fix the compilation rules. Differential Revision: https://reviews.llvm.org/D41219 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[cmake] Only attempt to install MSVC system libraries on WindowsShoaib Meenai
Newer versions of CMake (I'm on 3.10, but I believe 3.9 behaves the same way) attempt to query the system for information about the VS 2017 install. Unfortunately, this query fails on non-Windows systems: cmake_host_system_information does not recognize <key> VS_15_DIR CMake isn't going to find these system libraries on non-Windows anyway (and we were previously silencing the resultant warnings in our cross-compilation toolchain), so it makes sense to just omit the attempted installation entirely on non-Windows. Differential Revision: https://reviews.llvm.org/D41220 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320724 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[CMake] Pass LLVM_HAVE_LINK_VERSION_SCRIPT to external projectsPetr Hosek
Some external projects depend on this LLVM CMake variable. Differential Revision: https://reviews.llvm.org/D41205 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320658 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[cmake] Add support for case-sensitive Windows SDKsShoaib Meenai
When the Windows SDK is hosted on a case-sensitive filesystem (e.g. when compiling on Linux and not using ciopfs), we can automatically generate a VFS overlay for headers and symlinks for libraries. Differential Revision: https://reviews.llvm.org/D41156 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[cmake] Support host architectures other than x64Shoaib Meenai
Allow building for other architectures when cross-compiling for Windows. Differential Revision: https://reviews.llvm.org/D41158 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[cmake] Explicitly set VS 2017 compatibilityShoaib Meenai
When cross-compiling using clang-cl 5.0 (which is currently the latest stable release of the compiler), the default MS compatibility level is set to VS 2013, which is too low to build LLVM. Explicitly set the compatibility level to VS 2017 to support cross-compiling LLVM for Windows using clang-cl 5.0. This will be a no-op when using clang-cl 6.0 and above, where the default MS compatibility level is already VS 2017. Differential Revision: https://reviews.llvm.org/D41157 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320616 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[cmake] Determine MSVC host triple correctly when cross-compilingShoaib Meenai
CMAKE_CL_64 will never be set when cross-compiling with clang-cl, since CMake relies on an actual VS environment in order to determine it. Instead, use the size of a void pointer to determine the bit width of the host compiler (and therefore the host triple), which works for both native and cross compilation. Note that, with the impending advent of Windows on AArch64, assuming that a 64-bit host == x86_64 isn't correct either, but that's something to be addressed in a follow-up. Differential Revision: https://reviews.llvm.org/D41155 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320615 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13[cmake] Fix host tools build in when LLVM_EXPERIMENTAL_TARGETS_TO_BUILD is setAlex Bradbury
r320413 triggered cmake configure failures when building with -DLLVM_OPTIMIZED_TABLEGEN=True and with LLVM_EXPERIMENTAL_TARGETS_TO_BUILD set (e.g. to RISCV). This is because that patch moved to passing through LLVM_TARGETS_TO_BUILD, and at that point LLVM_EXPERIMENTAL_TARGETS_TO_BUILD has been merged in to it. LLVM_EXPERIMENTAL_TARGETS_TO_BUILD must be also be passed through to avoid errors like below: -- Constructing LLVMBuild project information CMake Error at CMakeLists.txt:682 (message): The target `RISCV' does not exist. It should be one of AArch64;AMDGPU;ARM;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;Sparc;SystemZ;X86;XCore -- Configuring incomplete, errors occurred! See the thread http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171211/509225.html for discussion of this fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320556 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-11[cmake] Pass TARGETS_TO_BUILD through to host tools buildJustin Bogner
In r319620, the host build was changed to use Native for TARGETS_TO_BUILD because passing semicolons through add_custom_command is surprisingly difficult. However, Native really doesn't make any sense here, and it only works because we don't technically do any codegen in the host tools so pretty well anything will "work". The problem here is that passing something other than the correct value is very fragile - as evidence note how the llvm-config in the host tools acts differently than the target one now, and misreports the targets to build. Similarly, if there is any logic conditional on the targets in tablegen (now or in the future), it will do the wrong thing. To fix this, we need to escape the semicolons in the targets string and pass it through to the child cmake invocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320413 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08[cmake] Only pass CMAKE_SYSROOT if non-emptyShoaib Meenai
In my build environment (cmake 3.6.1 and gcc 4.8.5 on CentOS 7), having an empty CMAKE_SYSROOT in the cache results in --sysroot="" being passed to all compile commands, and then the compiler errors out because of the empty sysroot. Only set CMAKE_SYSROOT if non-empty to avoid this. Differential Revision: https://reviews.llvm.org/D40934 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320183 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08[cmake] Make setting of CMAKE_C(XX)_COMPILER flags overridable for cross-buildsPavel Labath
Summary: r319898 made it possible to override these variables via the CROSS_TOOLCHAIN_FLAGS setting, but this only worked if one explicitly specifies these variables there. If, instead, one uses CROSS_TOOLCHAIN_FLAGS to specify a toolchain file (as our internal builds do, to point cmake to a checked-in toolchain), the CMAKE_C(XX)_COMPILER flags would still win over the ones specified by the toolchain file. To fix is to make the mere presence of these flags overridable. I do this by putting them as a default value for the CROSS_TOOLCHAIN_FLAGS setting, so they can be overridden at cmake configuration time. Reviewers: hintonda, beanz Subscribers: bogner, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40947 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320138 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[CMake] Use PRIVATE when linking LLVM fuzzers.Matt Morehouse
More fuzzers missed by r319840. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[cmake] Remove unnecessary header include in atomics checkShoaib Meenai
The header include was required to work around PR19898, as noted in that comment. That PR has since been marked resolved fixed, and the configuration check passes without the header inclusion both when compiling on Windows with cl and when cross-compiling on Linux using clang-cl. I noticed this because the inclusion was cased incorrectly (Intrin.h instead of intrin.h), which when cross-compiling on a case sensitive file system would cause the intrin.h from the Windows SDK to be included (which LLVM can't handle) instead of the one from clang's resource directory, making the check fail. This is the same issue as r309980. Correcting the case of the inclusion makes the check pass when cross compiling, but it seems better to get rid of the inclusion entirely, since it appears to be unnecessary now. Differential Revision: https://reviews.llvm.org/D40910 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[cmake] Move CMAKE_(C|CXX)_COMPILER variables before CROSS_TOOLCHAIN_FLAGS soDon Hinton
they can be overridden when cross compiling. Summary: Since CROSS_TOOLCHAN_FLAGS can set CMAKE_(C|CXX)_COMPILER variables, move the compiler variables up front so they can be overridden. This is a followup to https://reviews.llvm.org/D40229 committed in rL319620. Thanks to Pavel Labath for reporting this issue. Reviewers: labath, beanz Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D40896 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319898 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai
We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05Re-commit "[cmake] Enable zlib support on windows"Pavel Labath
This recommits r319533 which was broken llvm-config --system-libs output. The reason was that I used find_libraries for searching for the z library. This returns absolute paths, and when these paths made it into llvm-config, it made it produce nonsensical flags. To fix this, I hand-roll a search for the library in the same way that we search for the terminfo library a couple of lines below. This is a bit less flexible than the find_library option, as it does not allow the user to specify the path to the library at configure time (which is important on windows, as zlib is unlikely to be found in any of the standard places cmake searches), but I was able to guide the build to find it with appropriate values of LIB and INCLUDE environment variables. Reviewers: compnerd, rnk, beanz, rafael Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40779 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319751 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[cmake] Modernize some conditionals. NFCShoaib Meenai
The "x${...}" form was a workaround for CMake versions prior to 3.1, where the if command would interpret arguments as variables even when quoted [1]. We can drop the workaround now that our minimum CMake version is 3.4. [1] https://cmake.org/cmake/help/v3.1/policy/CMP0054.html Differential Revision: https://reviews.llvm.org/D40744 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319723 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[CMake] Don't use comma as an alternate separatorPetr Hosek
Using comma can break in cases when we're passing flags that already use comma as a separator. Fixes PR35504. Differential Revision: https://reviews.llvm.org/D40761 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04Revert "[cmake] Enable zlib support on windows"Pavel Labath
This reverts commit r319533 as it broke llvm-config --system-libs output and everything that depends on it (which is mostly out of tree or downstream folks, but includes a couple of llvm buildbots as well). I think I have a fix for this in D40779, but I want someone to look review it first. In the mean time, I am reverting this change, as it seems to break a lot of people. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02[cmake] Re-commit: Remove redundant call to cmake when building host tools.Don Hinton
Also pass CMAKE_(C|CXX)_COMPILER to add_custom_command. Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Differential Revision: https://reviews.llvm.org/D40229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319620 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-02CMAKE: help CheckAtomic find check_library_existsMartell Malone
lldb fails to build standalone on x86 -- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Failed CMake Error at CheckAtomic.cmake:66 (check_library_exists): Unknown CMake command "check_library_exists". Call Stack (most recent call first): LLDBStandalone.cmake:90 (include) CMakeLists.txt:3 (include) Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D40220 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[cmake] Revert (rL319574): Resubmit Remove redundant call to cmake when ↵Don Hinton
building host tools. Still fails for some bots. Differential Revision: https://reviews.llvm.org/D40229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319582 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[cmake] Resubmit Remove redundant call to cmake when building host tools.Don Hinton
Only pass Native to LLVM_TARGETS_TO_BUILD. Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Differential Revision: https://reviews.llvm.org/D40229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319574 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[cmake] Enable zlib support on windowsPavel Labath
Summary: zlib support was hard-wired to off for (non-cygwin) windows targets. This disables some features, such as reading debug info from compressed dwarf sections. This has been this way since zlib support was added in 2013 (r180083), but there is no obvious reason for that. Zlib is perfectly capable of being compiled for windows (it even has a cmake file that works out of the box). This enables one to turn on zlib support on windows, if one has zlib avaliable. Reviewers: rnk, beanz Subscribers: mgorny, aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D40655 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[cmake] Expose opt-viewer availabilityAdam Nemet
This will be used in https://github.com/apple/swift/pull/12938 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[llvm] Add stripped installation targetsShoaib Meenai
CMake's generated installation scripts support `CMAKE_INSTALL_DO_STRIP` to enable stripping the installed binaries. LLVM's build system doesn't expose this option to the `install-` targets, but it's useful in conjunction with `install-distribution`. Add a new function to create the install targets, which creates both the regular install target and a second install target that strips during installation. Change the creation of all installation targets to use this new function. Stripping doesn't make a whole lot of sense for some installation targets (e.g. the LLVM headers), but consistency doesn't hurt. I'll make other repositories (e.g. clang, compiler-rt) use this in a follow-up, and then add an `install-distribution-stripped` target to actually accomplish the end goal of creating a stripped distribution. I don't want to do that step yet because the creation of that target would depend on the presence of the `install-*-stripped` target for each distribution component, and the distribution components from other repositories will be missing that target right now. Differential Revision: https://reviews.llvm.org/D40620 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[cmake] Include project name in Sphinx doctree dir to fix race conditionsMichal Gorny
Modify add_sphinx_target() to include the project name alongside builder in Sphinx doctree directory. This aims to avoid crashes due to race conditions between multiple Sphinx instances running in parallel that attempt to create or read that directory simultaneously. This problem has originally been addressed in r283188. However, that commit presumed that there will be only one target per builder being run. However, r314863 introduced a second manpage target, reintroducing the race condition. Differential Revision: https://reviews.llvm.org/D40656 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[cmake] Replace -Wall with /W4 in clang-cl options now that -Wall aliases ↵Greg Bedwell
-Weverything Instead, reuse the code-path for cl.exe that adds /W4 , which for clang-cl aliases clang's "-Wall -Wextra" which matches what clang-cl's /Wall previously aliased. This should restore the verbosity of a Windows selfhost build back to its previous levels. Differential Revision: https://reviews.llvm.org/D40603 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Add opt-viewer testingAdam Nemet
Detects whether we have the Python modules (pygments, yaml) required by opt-viewer and hooks this up to REQUIRES. This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer testing). It's also related to https://github.com/apple/swift/pull/12938 and the idea is to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake. Differential Revision: https://reviews.llvm.org/D40202 Fixes since the first commit: 1. Disable syntax highlighting as different versions of pygments generate different HTML 2. Use llvm-cxxfilt from the build git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Rollback r319176.Don Hinton
The ';' separators in LLVM_TARGETS_TO_BUILD disappear when list variables are evaluated in custom commands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29Revert "Add opt-viewer testing"Adam Nemet
This reverts commit r319188. Breaks when c++filt is not available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319262 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[cmake] Pass LLVM_USE_LINKER flag when building host tools, e.g.,Don Hinton
LLVM_OPTIMIZED_TABLEGEN=ON, and not crosscompiling. Differential Revision: https://reviews.llvm.org/D39734 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319228 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Add opt-viewer testingAdam Nemet
Detects whether we have the Python modules (pygments, yaml) required by opt-viewer and hooks this up to REQUIRES. This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer testing). It's also related to https://github.com/apple/swift/pull/12938 and the idea is to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake. Differential Revision: https://reviews.llvm.org/D40202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319188 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[cmake] Remove redundant call to cmake when building host tools.Don Hinton
Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Reviewers: beanz Reviewed By: beanz Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D40229 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319176 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28Revert "Add opt-viewer testing"Adam Nemet
This reverts commit r319073. Bot fails with a mismatch that looks like pygments-generated HTML. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[CMake] Pass LLVM_HOST_TRIPLE to external projectsPetr Hosek
LLVM runtimes rely on LLVM_HOST_TRIPLE being set in their builds and tests so make sure it's being passed down. Differential Revision: https://reviews.llvm.org/D40515 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319109 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloadingMichal Gorny
Prevent unloading shared libraries on Linux when dlclose() is called. This is necessary since command-line option parsing API relies on registering the global option instances in the option parser instance which can be loaded in a different shared library. Given that we can't reliably remove those options when a library is unloaded, the parser ends up containing dangling references. Since glibc has relatively complex library unloading rules, some of the LLVM libraries can be unloaded while others (including the Support library) stay loaded causing quite a mayhem. To reliably prevent that, just forbid unloading all libraries -- it's a very bad idea anyway. While the issue arguably happens only with BUILD_SHARED_LIBS, it may affect any library reusing llvm::cl interface. Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154. Previously hit by Fedora back in Feb 2016: https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html Differential Revision: https://reviews.llvm.org/D40459 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Use LIST_SEPARATOR rather than escaping in ExternalProject_AddPetr Hosek
Escaping ; in list arguments passed to ExternalProject_Add doesn't seem to be working in newer versions of CMake (see https://public.kitware.com/Bug/view.php?id=16137 for more details). Use a custom LIST_SEPARATOR instead which is the officially supported way. Differential Revision: https://reviews.llvm.org/D40232 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Revert r319069 - [cmake] Pass -Wl,-z,nodelete on Linux to prevent unloadingMichal Gorny
This breaks one of the unit tests. Need to find a good solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Add opt-viewer testingAdam Nemet
Detects whether we have the Python modules (pygments, yaml) required by opt-viewer and hooks this up to REQUIRES. This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer testing). It's also related to https://github.com/apple/swift/pull/12938 and the idea is to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake. Differential Revision: https://reviews.llvm.org/D40202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319073 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloadingMichal Gorny
Prevent unloading shared libraries on Linux when dlclose() is called. This is necessary since command-line option parsing API relies on registering the global option instances in the option parser instance which can be loaded in a different shared library. Given that we can't reliably remove those options when a library is unloaded, the parser ends up containing dangling references. Since glibc has relatively complex library unloading rules, some of the LLVM libraries can be unloaded while others (including the Support library) stay loaded causing quite a mayhem. To reliably prevent that, just forbid unloading all libraries -- it's a very bad idea anyway. While the issue arguably happens only with BUILD_SHARED_LIBS, it may affect any library reusing llvm::cl interface. Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154. Previously hit by Fedora back in Feb 2016: https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html Differential Revision: https://reviews.llvm.org/D40459 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319069 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17[CMake] Allow for Solaris ld -V output on stdoutMichal Gorny
In recent versions of Solaris 11.4 (previously 12), ld -V output went to stdout instead of stderr. Since AddLLVM.cmake only expects it on stderr, Solaris ld wasn't properly detected and options not understood by it are passed during the build. The following patch fixes this, allowing for both variants. Tested on i386-pc-solaris2.11.4 (on top of D35755 which is needed for proper Solaris support). Patch by Rainer Orth. Differential Revision: https://reviews.llvm.org/D39601 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[globalisel][tablegen] Generate rule coverage and use it to identify ↵Daniel Sanders
untested rules Summary: This patch adds a LLVM_ENABLE_GISEL_COV which, like LLVM_ENABLE_DAGISEL_COV, causes TableGen to instrument the generated table to collect rule coverage information. However, LLVM_ENABLE_GISEL_COV goes a bit further than LLVM_ENABLE_DAGISEL_COV. The information is written to files (${CMAKE_BINARY_DIR}/gisel-coverage-* by default). These files can then be concatenated into ${LLVM_GISEL_COV_PREFIX}-all after which TableGen will read this information and use it to emit warnings about untested rules. This technique could also be used by SelectionDAG and can be further extended to detect hot rules and give them priority over colder rules. Usage: * Enable LLVM_ENABLE_GISEL_COV in CMake * Build the compiler and run some tests * cat gisel-coverage-[0-9]* > gisel-coverage-all * Delete lib/Target/*/*GenGlobalISel.inc* * Build the compiler Known issues: * ${LLVM_GISEL_COV_PREFIX}-all must be generated as a manual step due to a lack of a portable 'cat' command. It should be the concatenation of all ${LLVM_GISEL_COV_PREFIX}-[0-9]* files. * There's no mechanism to discard coverage information when the ruleset changes Depends on D39742 Reviewers: ab, qcolombet, t.p.northover, aditya_nandakumar, rovka Reviewed By: rovka Subscribers: vsk, arsenm, nhaehnle, mgorny, kristof.beyls, javed.absar, igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D39747 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state optionHans Wennborg
In addition to the current ON and OFF options, this adds the FORCE_ON option, which causes a configuration error if libxml2 cannot be used. Differential revision: https://reviews.llvm.org/D40050 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13Move the setting of LLVM_BUILD_MODE to a macro so that we can re-use it in ↵Greg Bedwell
compiler-rt Differential Revision: https://reviews.llvm.org/D38470 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318034 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09Add a Cross-compilation toolchain file for MSVC.Zachary Turner
With this patch, you can now cross-compile for Windows on non-Windows hosts. Differential Revision: https://reviews.llvm.org/D39814 This allows cross-compiling for windows on other platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317830 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[CMake] Passthrough CMAKE_SYSROOT to external projectsPetr Hosek
Differential Revision: https://reviews.llvm.org/D39029 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317744 91177308-0d34-0410-b5e6-96231b3b80d8