Commit Graph

83 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith 6c63b07a55 Update Clang CMake cache to use cxx-headers, NFC
Apparently libcxx-headers is going away.  Fixes PR35584.

llvm-svn: 320271
2017-12-09 23:44:42 +00:00
Shoaib Meenai 669cae1f28 [clang] Use add_llvm_install_targets
Use this function to create the install targets rather than doing so
manually, which gains us the `-stripped` install targets to perform
stripped installations.

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

llvm-svn: 319489
2017-11-30 22:35:02 +00:00
Petr Hosek 86cc84d12e [CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain
It's used to determine whether terminal supports colors, but within LLVM
it's only used in handful of places and in Clang it's only used in AST
dumper, otherwise Clang relies on the -fcolor-diagnostics flag which we
pass explicitly from our build system anyway. This eliminates one of the
shared libraries dependencies making the toolchain less reliant on the
host environment.

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

llvm-svn: 319088
2017-11-27 20:29:13 +00:00
Petr Hosek 5668d83e0e [Driver] Make the use of relax relocations a per target option
The support for relax relocations is dependent on the linker and
different toolchains within the same compiler can be using different
linkers some of which may or may not support relax relocations.

Give toolchains the option to control whether they want to use relax
relocations in addition to the existing (global) build system option.

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

llvm-svn: 318816
2017-11-22 01:38:31 +00:00
Vitaly Buka 1efe7740ce [clang-fuzzer] Fix incremental builds of the fuzzer
Summary:
Don't use BUILD_IN_SOURCE keep git checkout clean
Don't forward CMAKE_GENERATOR as ExternalProject_Add should do it already
Reset UPDATE_COMMAND to avoid git checkout updates on each build

Reviewers: kcc, morehouse

Subscribers: cfe-commits, mgorny

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

llvm-svn: 317035
2017-10-31 20:49:57 +00:00
Petr Hosek 9f46ece85a [CMake] Build host builtins in Fuchsia toolchain even on Darwin
This is nedeeded for the toolchain to be actually usable as a host
toolchain on Darwin.

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

llvm-svn: 316542
2017-10-25 02:35:22 +00:00
Petr Hosek a9eaf1d226 [CMake] Include clang-refactor in Fuchsia toolchain
This includes the clang-refactor in the toolchain distribution.

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

llvm-svn: 316541
2017-10-25 02:31:38 +00:00
Matt Morehouse 54ffd1cfe8 [clang-proto-fuzzer] Use ToT protobuf-mutator.
llvm-svn: 316103
2017-10-18 18:38:04 +00:00
Petr Hosek 9e148e9590 [CMake] Build Fuchsia toolchain as -O3
Differential Revision: https://reviews.llvm.org/D39017

llvm-svn: 316053
2017-10-18 01:27:54 +00:00
Matt Morehouse 319b7716a8 [clang-fuzzer] Build with newer protobuf-mutator.
llvm-svn: 315506
2017-10-11 20:45:10 +00:00
Chris Bieneman 5d3caffe5e [CMake] Add install-distribution-toolchain to stage2 target list
This allows generating toolchains with just the distribution components instead of toolchains with everything.

llvm-svn: 315030
2017-10-05 22:48:34 +00:00
Chris Bieneman 2834b006a4 [CMake] Minor updates to Apple CMake caches
* Turn off embedded compiler-rt builds in stage1
* Support generating Xcode toolchains from Stage2 build configurations

llvm-svn: 314854
2017-10-03 21:59:53 +00:00
Petr Hosek b5d0cd89a5 [Fuchsia] Set ENABLE_X86_RELAX_RELOCATIONS for Fuchsia builds
This is a "Does your linker support it?" option, and all ours do.

Patch by Roland McGrath

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

llvm-svn: 313173
2017-09-13 19:17:41 +00:00
George Karpenkov aed7d74236 Remove LLVMFuzzer from list of bundled libraries for Fuchsia
As of now, libFuzzer is located in compiler-rt and is bundled with
Clang's toolchain by default.

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

llvm-svn: 311514
2017-08-23 00:09:33 +00:00
Vitaly Buka 46f15d3788 Update libprotobuf-mutator revision
llvm-svn: 311428
2017-08-22 05:18:28 +00:00
Petr Hosek 1ed7135e65 [CMake] Build sanitized C++ runtimes for Fuchsia
Differential Revision: https://reviews.llvm.org/D36349

llvm-svn: 311033
2017-08-16 19:06:04 +00:00
Petr Hosek 3450d7e7f7 [CMake] Include LLVMFuzzer in Fuchsia toolchain
Differential Revision: https://reviews.llvm.org/D36541

llvm-svn: 310901
2017-08-15 00:22:00 +00:00
Matt Morehouse f051f5d1e6 Integrate Kostya's clang-proto-fuzzer with LLVM.
Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs.  Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).

As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
- LLVM_USE_SANITIZER=Address  // needed for libFuzzer

In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON

clang-proto-fuzzer also requires the following dependencies:
- binutils  // needed for libprotobuf-mutator
- liblzma-dev  // needed for libprotobuf-mutator
- libz-dev  // needed for libprotobuf-mutator
- docbook2x  // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]

A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.

Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.

https://bugs.llvm.org/show_bug.cgi?id=33829

Reviewers: kcc, vitalybuka, bogner

Reviewed By: kcc, vitalybuka

Subscribers: thakis, mgorny, cfe-commits

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

llvm-svn: 310408
2017-08-08 20:15:04 +00:00
Petr Hosek b31582b196 Enable AddressSanitizer for Fuchsia targets
Patch by Roland McGrath

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

llvm-svn: 309999
2017-08-03 23:02:22 +00:00
Petr Hosek a350f656a5 [CMake] Include llvm-objcopy tool in Fuchsia toolchain
Differential Revision: https://reviews.llvm.org/D36194

llvm-svn: 309786
2017-08-02 02:49:09 +00:00
Petr Hosek c765035583 [Driver] Disable static C++ library support on Fuchsia
Don't support or build static C++ libraries for Fuchsia.

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

llvm-svn: 309778
2017-08-02 01:18:02 +00:00
Petr Hosek 836a64b53e [CMake] Include sancov tool in Fuchsia toolchain
Differential Revision: https://reviews.llvm.org/D35930

llvm-svn: 309724
2017-08-01 19:15:32 +00:00
Leo Li 42698d09b8 [CMake] Add Android toolchain CMake cache files.
Summary: Thoes files are used to build Android toolchain. D32816 makes it possible to build runtimes for targets.

Reviewers: beanz, srhines

Reviewed By: srhines

Subscribers: pirama, jroelofs, srhines, cfe-commits, mgorny

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

llvm-svn: 309407
2017-07-28 17:40:28 +00:00
Chris Bieneman 6b5851bb4a [CMake] NFC. Add clang-tablegen-targets utility target
By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first.

Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree.

llvm-svn: 309390
2017-07-28 15:33:47 +00:00
Petr Hosek 0f874d4ba5 [CMake] Use ABI version 2 for C++ library in Fuchsia
Fuchsia has always been using ABI version 2 but I forgot this option
when setting up the cache file for runtimes build.

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

llvm-svn: 308705
2017-07-21 00:59:38 +00:00
Petr Hosek dce1134c33 [CMake] Build runtimes for Fuchsia targets
This relies on the multi-target runtimes build support.

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

llvm-svn: 308412
2017-07-19 02:57:47 +00:00
Jonathan Roelofs 901c776d06 Don't defer to the GCC driver for linking arm-baremetal
Also comes with a cmake cache for building the runtime bits:

 $ cmake <normal cmake flags> \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

llvm-svn: 303873
2017-05-25 15:42:13 +00:00
NAKAMURA Takumi 25f1a6ed16 Fix two-stage build on windows using DistributionExample cmake cache
Thanks to Matthew Larionov <matthewtff@gmail.com>

llvm-svn: 302795
2017-05-11 13:19:24 +00:00
Adrian Prantl 4ca3139179 Partially revert r302685 and swith Apple-style full LTO builds to
-gline-tables-only. The memory consumption is apparently still too
much for some of the green dragon builders.

<rdar://problem/28672159>

llvm-svn: 302740
2017-05-10 22:14:23 +00:00
Adrian Prantl dce1c1439e Build the Apple-style stage2 with full debug info
Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch switches the debug info generation from -gline-tables-only
to -g since full debug info does no longer cause any memory issues
even for full LTO builds [2].

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
[2] http://llvm.org/devmtg/2015-10/#talk19
rdar://problem/28672159

llvm-svn: 302685
2017-05-10 15:58:22 +00:00
Adrian Prantl 1cc3474ec1 Build the Apple-style stage2 with modules
Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch turns on LLVM_ENABLE_MODULES.

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
rdar://problem/28672159

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

llvm-svn: 302556
2017-05-09 17:27:03 +00:00
Petr Hosek ce0ea76f40 [CMake] Enable ARM target in Fuchsia toolchain
This is still used by some users of Fuchsia toolchain. Also include
llc and opt which is useful for development and testing.

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

llvm-svn: 300917
2017-04-20 23:06:53 +00:00
Petr Hosek 60f54ac8c5 [CMake] Support building Fuchsia toolchain on Darwin
This is already supported on Linux but on Darwin it requires some
extra flags.

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

llvm-svn: 300257
2017-04-13 21:09:42 +00:00
Michal Gorny 5ef8bf7369 [cmake] Support Gentoo install for z3
Add the 'z3' subdirectory to the list of possible path suffixes for
libz3 header search. The z3 headers are installed in /usr/include/z3
on Gentoo.

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

llvm-svn: 299813
2017-04-08 14:38:06 +00:00
Dominic Chen 08f943c563 [analyzer] Add new Z3 constraint manager backend
Summary: Implement new Z3 constraint manager backend.

Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun

Subscribers: mgorny, cfe-commits

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

llvm-svn: 299463
2017-04-04 19:52:25 +00:00
Guillaume Papin d2a64aa854 [CMake] fix CLANG_INCLUDE_DIRS CMake export
Summary:
This change should fixes the export of CLANG_INCLUDE_DIRS variable in ClangConfig.cmake.

Unlike for the other variables, CLANG_INSTALL_PREFIX wasn't escaped meaning CLANG_INCLUDE_DIRS
resulting in the path "/include" instead of "${CLANG_INSTALL_PREFIX}/include".

Reviewers: beanz

Subscribers: mgorny

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

llvm-svn: 298424
2017-03-21 19:17:53 +00:00
Mehdi Amini 7103b2ecfd Add a cmake cache file for a stage-2 build with ThinLTO
This is intended to be targetted by a Green Dragon stage-2 bot
I'm bringing up currently. WIP.

llvm-svn: 297351
2017-03-09 01:18:31 +00:00
Petr Hosek 367ad73aff [CMake] Add Fuchsia toolchain CMake cache files
These cache files can be used to build Fuchsia toolchain. They also
demonstrate the use of multi-target builtins build.

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

llvm-svn: 295480
2017-02-17 19:28:54 +00:00
Chris Bieneman c574297de6 [CMake] Add CLANG_INCLUDE_DIRS to CMake exports
This patch adds setting CLANG_INCLUDE_DIRS in the generated CMake package configuration files.

llvm-svn: 294207
2017-02-06 18:17:23 +00:00
Michal Gorny f103c0d7fd [cmake] Hint find_package() to prefer LLVM installed alongside clang
Include a path hint for find_package() in ClangConfig.cmake to ensure
that CMake prefers LLVM installed alongside clang over the default
search path.

If two versions of LLVM are installed in the system, and one of them is
in PATH, CMake's find_package() magic prefers the CMake directory
alongside that install by default. Adding a relative hint makes it
possible to prioritize to the install from which find_package() is
called.

If you want to build e.g. LLDB against another install of LLVM, you can
pass LLVM_CONFIG override. In this case, LLDB queries the prefix from
llvm-config and uses the CMake files located there. However, when
including ClangConfig, the implicit find_package() nevertheless prefers
PATH-found LLVM over the one used previously by LLDB, and two versions
of LLVMConfig end up being loaded.

This could be fixed on LLDB end up by explicitly forcing custom package
search location. However, it seems simpler and safer to add a hint to
ClangConfig than to track every usage of ClangConfig.

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

llvm-svn: 293632
2017-01-31 14:15:40 +00:00
Justin Bogner 5ca4d5f5fe cmake: Don't try to install exports if there aren't any
When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for clang's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

llvm-svn: 286210
2016-11-08 05:02:33 +00:00
Justin Bogner 66b326bc55 cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS
We need to apply the same export logic in clang as in llvm for
LLVM_DISTRIBUTION_COMPONENTS, or the clang exports will be invalid
when we use this config.

This makes using distribution components without setting
LLVM_TOOLCHAIN_ONLY=On work correctly.

llvm-svn: 286181
2016-11-07 23:46:05 +00:00
Chris Bieneman 7e0f03ecf2 [CMake] Adding example distribution CMake cache files
These cache file are provided as an example of how to set up simple multi-stage CMake builds. I have a batch of documentation updates for LLVM.org which reference these files.

llvm-svn: 285206
2016-10-26 15:41:38 +00:00
Michael Gottesman 66cc2d5210 [cmake] Follow LLVM's lead in creating exported tool targets for clang tools.
This is needed by downstream projects such as swift to get proper cmake
dependency information for LLVM/Clang targets.

A few months ago I added support for exporting this information for Clang
libraries. In order to be incremental, I did not add support for exporting clang
tools as well at that time. Now such support is needed, so I am committing this
incremental code.

llvm-svn: 284658
2016-10-19 22:46:06 +00:00
Chris Bieneman ebe8b83fbc [CMake] Support thin LTO in PGO CMake cache
This allows you to set PGO_INSTRUMENT_LTO=Thin and have it work correctly.

llvm-svn: 284646
2016-10-19 21:12:04 +00:00
Chris Bieneman 981618da53 [CMake] Adding toolchain targets to PGO and Apple CMake caches
The Xcode toolchain targets are useful on OS X hosts because you can construct and install multiple toolchians that can be used seamlessly.

llvm-svn: 278987
2016-08-17 21:51:38 +00:00
Chris Bieneman a1aa4069d9 [CMake] Workflow improvements to PGO generation
This patch adds a few new convenience options used by the PGO CMake cache to setup options on bootstrap stages. The new options are:

PGO_INSTRUMENT_LTO - Builds the instrumented and final builds with LTO
PGO_BUILD_CONFIGURATION - Accepts a CMake cache script that can be used for complex configuration of the stage2-instrumented and stage2 builds.

The patch also includes a fix for bootstrap dependencies so that the instrumented LTO tools don't get used when building the final stage, and it adds distribution targets to the passthrough.

llvm-svn: 278862
2016-08-16 22:16:29 +00:00
Chris Bieneman 31cc8b3887 [CMake] [Apple Cache] Set CLANG_VENDOR_UTI for Apple builds
This is just a minor update to the Apple packaging configuration.

llvm-svn: 278849
2016-08-16 20:44:58 +00:00
Chris Bieneman bba9ee3b76 [CMake] Apple stage1 doesn't need to set libcxx options
LibCXX settings are configured in stage2 so we don't need them here.

llvm-svn: 278729
2016-08-15 20:15:22 +00:00
Michael Gottesman eb396a6cbf Add CLANG_BUILD_TOOLS as a clang counterpart for LLVM_BUILD_TOOLS
LLVM_BUILD_TOOLS is a boolean variable that controls whether or not generated
targets for llvm tools are built by the "all" target. CLANG_BUILD_TOOLS is an
analogous variable for clang targets.

This is useful functionality for selectively disabling the building of clang
targets by default to speed up builds.

In terms of implementation, I just followed the model of LLVM's implementation
of this functionality.

llvm-svn: 275006
2016-07-10 01:44:00 +00:00