Commit Graph

235 Commits

Author SHA1 Message Date
Gabor Horvath 0458e63d28 [fuchsia] Enable Clang Static Analyzer
Differential Revision: https://reviews.llvm.org/D72188
2020-01-03 15:49:32 -08:00
Petr Hosek b63bc648a4 [CMake] clang-scan-deps in Fuchsia distribution
We would like to use clang-scan-deps in Fuchsia build so include it
in the toolchain distribution.

Differential Revision: https://reviews.llvm.org/D72113
2020-01-02 16:49:52 -08:00
Vladimir Vereschaka eadc97b0ec [CMake] Added remote test execution support into CrossWinToARMLinux CMake cache file.
Added two confguration argument to provide a host name and SSH user name
to run the tests on the remote target host.

* REMOTE_TEST_HOST  - remote host name or address.
* REMOTE_TEST_USER  - passwordless SSH account name.

Differential Revision: https://reviews.llvm.org/D71625
2019-12-29 20:36:19 -08:00
John McCall c82e4ef696 Always -I clang/include when tblgen'ing in Clang. 2019-12-16 13:33:59 -05:00
Petr Hosek 68a3a3b281 [Clang] Enable RISC-V support for Fuchsia
We don't have a full sysroot yet, so for now we only include compiler
support and compiler-rt builtins, the rest of the runtimes will get
enabled later.

Differential Revision: https://reviews.llvm.org/D70477
2019-11-21 16:02:26 -08:00
Vladimir Vereschaka 0f5aabb91a [CMake] Fix the path to CrossWinToARMLinux.cmake CMake cache.
The comment was slightly misleading.

Behalf: broadwaylamb (Sergej Jaskiewicz)

Differential Revision: https://reviews.llvm.org/D70499
2019-11-20 12:51:52 -08:00
Vladimir Vereschaka a264e85dd9 [CMake] Add cross Windows to ARM Linux toolchain CMake cache file.
This cache file can be used to build a cross Windows to ARM Linux
toolchain.

Differential Revision: https://reviews.llvm.org/D69651
2019-11-01 12:40:25 -07:00
Petr Hosek 7fff716ec4 [CMake] Update Fuchsia build configuration
This includes several changes to our toolchain build:
- Switch from RelWithDebInfo to Release as we don't currently use the
  debug info and therefore don't need to produce it.
- Disable unwind tables since we don't need them.
- Disable Clang static analyzer and ARCMT since we don't use it.
- Disable Go tests since we don't distribute Go bindings.
- Set the deployment target for macOS to 10.7 to make the toolchain
  usable on older systems.
- Restrict the targets we build runtimes for on Darwin only the ones
  we actually need.
- Drop llc and opt from the distribution since we don't need them.

Differential Revision: https://reviews.llvm.org/D69415
2019-10-24 16:35:29 -07:00
Jordan Rose 5fd467feb8 [CMake] Clang: Don't use object libraries with Xcode
Undoes some of the effects of r360946 when using the Xcode CMake
generator---it doesn't handle object libraries correctly at all.
Attempts to still honor BUILD_SHARED_LIBS for Xcode, but I didn't
actually test it. Should have no effect on non-Xcode generators.

https://reviews.llvm.org/D68430

llvm-svn: 373769
2019-10-04 18:17:58 +00:00
Petr Hosek 864fd44d8f [CMake][Fuchsia] Enable experimental pass manager by default
We plan on using experimental new pass manager for Fuchsia toolchain.

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

llvm-svn: 370421
2019-08-29 23:12:06 +00:00
Petr Hosek 20d34eacf3 [CMake][Fuchsia] Define asan+noexcept multilib
Using noexcept multilib with -fno-exceptions can lead to significant
space savings when statically linking libc++abi because we don't need
all the unwinding and demangling code.

When compiling with ASan, we already get a lot of overhead from the
instrumentation itself, when statically linking libc++abi, that overhead
is even larger.

Having the noexcept variant for ASan can help significantly, we've seen
more than 50% size reduction in our system image, which offsets the cost
of having to build another multilib.

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

llvm-svn: 365994
2019-07-13 08:07:10 +00:00
Tom Stellard a196469e67 cmake: Add INSTALL_WITH_TOOLCHAIN option to add_*_library macros
Summary:
This will simplify the macros by allowing us to remove the hard-coded
list of libraries that should be installed when
LLVM_INSTALL_TOOLCHAIN_ONLY is enabled.

Reviewers: beanz, smeenai

Reviewed By: beanz

Subscribers: aheejin, mehdi_amini, mgorny, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 365902
2019-07-12 14:40:18 +00:00
Petr Hosek 803b994e9a [CMake][Fuchsia] Use RelWithDebInfo to build runtimes
We want to preserve debug info in our runtimes to aid symbolization and
debugging; for shared libraries this will be stripped away during
install-stripped step and distributed via .build-id, for static archives
it's part of the archive and it's a responsibility of the consumer to
strip it away in the final binary if not needed.

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

llvm-svn: 365845
2019-07-11 23:49:39 +00:00
Sylvestre Ledru 76b26550e9 Rename libclang_shared to libclang-cpp
Summary: Fix bug 42475

Reviewers: beanz, tstellar

Reviewed By: beanz

Subscribers: kimgr, mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 365831
2019-07-11 21:42:55 +00:00
Tom Stellard 2e97d2aa1b cmake: Add CLANG_LINK_CLANG_DYLIB option
Summary:
Setting CLANG_LINK_CLANG_DYLIB=ON causes clang tools to link against
libclang_shared.so instead of the individual component libraries.

Reviewers: mgorny, beanz, smeenai, phosek, sylvestre.ledru

Subscribers: arphaman, cfe-commits, llvm-commits

Tags: #clang

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

llvm-svn: 365092
2019-07-03 22:45:55 +00:00
Chris Bieneman b67cb3cda0 Use LTO capable linker
Summary:
In DistributionExample.cmake be sure we use a LTO
capable linker, the easiest to choose is lld.

Reviewers: beanz

Reviewed By: beanz

Patch By: winksaville

Subscribers: mgorny, mehdi_amini, inglorion, dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 362624
2019-06-05 17:35:38 +00:00
Petr Hosek 9d8d0f68fb [CMake][Fuchsia] Use libc++ ABIv2 for the first stage build
This also unifies flags between macOS and Linux builds.

llvm-svn: 362585
2019-06-05 06:58:41 +00:00
Petr Hosek 2ab7af29c6 [CMake] Provide an option to use relative paths in debug info
CMake always uses absolute file paths in the generated compiler
invocation which results in absolute file paths being embedded in debug
info. This is undesirable when building a toolchain e.g. on bots as the
debug info may embed the bot source checkout path which is meaningless
anywhere else.

This change introduces the LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO which uses
-fdebug-prefix-map (where supported) options to rewrite paths embedded
into debug info with relative ones. Additionally, LLVM_SOURCE_PREFIX can
be used to override the path to source directory with a different one.

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

llvm-svn: 362185
2019-05-31 01:34:51 +00:00
Petr Hosek a35c50c9a4 [CMake][Fuchsia] Use libc++ ABI v2 on Darwin as well
Since we share headers between host and target builds, we need to use
the same version for both.

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

llvm-svn: 362181
2019-05-31 01:16:43 +00:00
Don Hinton 3e8b9d4a57 [cmake] Remove old unused version of FindZ3.cmake from clang [NFC]
Summary: This file was moved to llvm in D54978, r356929, but the old
file was never removed.

Reviewed By: beanz

Tags: #clang

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

llvm-svn: 361663
2019-05-24 19:21:21 +00:00
Petr Hosek a86c889f05 [CMake][Fuchsia] Use cannonical triples for runtimes
This ensures that whether the user uses short or cannonical version
of the triple, Clang will still find the runtimes under the cannonical
triple name.

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

llvm-svn: 361456
2019-05-23 02:35:12 +00:00
Chris Bieneman dbc2a12c73 Fix BUILD_SHARED_LIBS for clang which broke in D61909
llvm_add_library ignores `BUILD_SHARED_LIBS` `STATIC` is explicitly specified. This restores the `BUILD_SHARED_LIBS` behavior to the clang build.

llvm-svn: 361271
2019-05-21 15:56:17 +00:00
Chris Bieneman c1ad143f95 [CMake] Update DistributionExample for mono repo
This just updates the DistributionExamples from my 2016 Dev Meeting talk to work more seamlessly with the monorepo.

llvm-svn: 361184
2019-05-20 18:10:20 +00:00
Chris Bieneman 876e39937e Re-land: Add Clang shared library with C++ exports
Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

llvm-svn: 360985
2019-05-17 04:20:01 +00:00
Nico Weber 457d7caac8 Revert r360946 "Add Clang shared library with C++ exports"
It breaks LLVM_ENABLE_PIC=OFF builds, and it's not clear
if the object library approach doesn't impact the normal
clang binary.

llvm-svn: 360973
2019-05-17 01:42:37 +00:00
Chris Bieneman 10fba12e50 Add Clang shared library with C++ exports
Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

Reviewers: tstellar, winksaville

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 360946
2019-05-16 22:06:07 +00:00
Petr Hosek fbcce9fe9d [CMake] Replace the sanitizer support in runtimes build with multilib
This is a more generic solution; while the sanitizer support can be used
only for sanitizer instrumented builds, the multilib support can be used
to build other variants such as noexcept which is what we would like to use
in Fuchsia.

The name CMake target name uses the target name, same as for the regular
runtimes build and the name of the multilib, concatenated with '+'. The
libraries are installed in a subdirectory named after the multilib.

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

llvm-svn: 358935
2019-04-22 23:31:39 +00:00
Louis Dionne 491ff04a49 Explicitly say we don't define new/delete in libc++ during Apple stage1 bootstrap
This is not necessary in stage2 because we don't even build libc++.dylib
there.

llvm-svn: 358582
2019-04-17 14:58:59 +00:00
Matt Morehouse 59df934b3a [clang-fuzzer] Include ExternalProject before using it.
Some versions of CMake require ExternalProject to be included before we
can use ExternalProject_Add.

llvm-svn: 357803
2019-04-05 19:47:17 +00:00
Julie Hockett dd0c7d88c6 [fuchsia] Add clang-doc to Fuchsia distribution
Differential Revision: https://reviews.llvm.org/D5997

llvm-svn: 357275
2019-03-29 16:56:37 +00:00
Shoaib Meenai 19c45546fc [cmake] Reset variable before using it
A bunch of macros use the same variable name, and since CMake macros
don't get their own scope, the value persists across macro invocations,
and we can end up exporting targets which shouldn't be exported. Clear
the variable before each use to avoid this.

Converting these macros to functions would also help, since it would
avoid the variable leaking into its parent scope, and that's something I
plan to follow up with. It won't fully address the problem, however,
since functions still inherit variables from their parent scopes, so if
someone in the parent scope just happened to use the same variable name
we'd still have the same issue.

llvm-svn: 357036
2019-03-26 22:16:53 +00:00
Petr Hosek 1b1523c6ff [CMake][Fuchsia] Merge static libunwind and libc++abi into libc++ on Darwin
We want to distribute only a single archive so -lc++ does the right
thing and users don't have to explicitly link -lc++abi and -lunwind.

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

llvm-svn: 356970
2019-03-26 00:43:29 +00:00
Mikhail R. Gadelha db695c834f Moved everything SMT-related to LLVM and updated the cmake scripts.
Differential Revision: https://reviews.llvm.org/D54978

llvm-svn: 356929
2019-03-25 17:47:45 +00:00
Louis Dionne c156306bf7 [CMake] Tell libc++ that we're using compiler-rt on Apple platforms
Reviewers: beanz, arphaman, EricWF

Subscribers: dberris, mgorny, jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 355927
2019-03-12 15:32:00 +00:00
Petr Hosek aac819b844 [CMake] Support stripping and linking output to .build-id directory
When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

llvm-svn: 355765
2019-03-09 01:26:55 +00:00
Francis Visoiu Mistrih b1e36564c6 [cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS
Add this in the Apple-stage2.cmake to ship the remark tooling library
with the compiler.

llvm-svn: 355440
2019-03-05 20:47:34 +00:00
Shoaib Meenai c2b3f62315 [cmake] Create exports for umbrella library targets
When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

llvm-svn: 355354
2019-03-05 00:38:32 +00:00
Shoaib Meenai 5be71faf4b [build] Rename clang-headers to clang-resource-headers
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

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

llvm-svn: 355340
2019-03-04 21:19:53 +00:00
Shoaib Meenai 2d13dcacfb [clang] Add CMake target for installing clang's CMake exports
This mirrors LLVM's install-cmake-exports target.

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

llvm-svn: 354527
2019-02-20 23:16:15 +00:00
Shoaib Meenai defb5a383b [clang] Switch to LLVM_ENABLE_IDE
r344555 switched LLVM to guarding install targets with LLVM_ENABLE_IDE
instead of CMAKE_CONFIGURATION_TYPES, which expresses the intent more
directly and can be overridden by a user. Make the corresponding change
in clang. LLVM_ENABLE_IDE is computed by HandleLLVMOptions, so it should
be available for both standalone and integrated builds.

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

llvm-svn: 354525
2019-02-20 23:08:43 +00:00
Shoaib Meenai d705864074 [clang] Add build and install targets for clang libraries
This is modeled after the existing llvm-libraries target. It's a
convenient way to include all clang libraries in a distribution.

This differs slightly from the llvm-libraries target in that it adds any
library added via add_clang_library, whereas llvm-libraries only
includes targets added via add_llvm_library that didn't use the MODULE
or BUILDTREE_ONLY arguments. add_clang_library doesn't appear to have
any equivalents of those arguments, so the conditions don't apply.

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

llvm-svn: 354141
2019-02-15 15:59:04 +00:00
Shoaib Meenai b4ff1abae2 [clang] Create install targets for non-shared libraries
I don't see a reason for these to not have install targets created,
which in turn allows them to be bundled in distributions. This doesn't
affect the "install" target, since that just runs all CMake install
rules (and we were already creating install rules for these).

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

llvm-svn: 354140
2019-02-15 15:59:02 +00:00
Petr Hosek f9fe483eb5 [CMake][Fuchsia] Pass -ldl -lpthread LDFLAGS to second stage
We're using static libc++ for the second stage which requires explicitly
linking -ldl and -lpthread.

llvm-svn: 353853
2019-02-12 16:24:46 +00:00
Petr Hosek f8067f79dc [CMake][Fuchsia] Drop libclang.so from distribution
This is no longer needed now that all users have switched to clangd.

llvm-svn: 353658
2019-02-11 05:38:01 +00:00
Mikhail R. Gadelha 3289ccd848 This reverts commit 1440a848a635849b97f7a5cfa0ecc40d37451f5b.
and commit a1853e834c65751f92521f7481b15cf0365e796b.

They broke arm and aarch64

llvm-svn: 353590
2019-02-09 00:46:12 +00:00
Mikhail R. Gadelha eac500f0c3 Move the SMT API to LLVM
Moved everything SMT-related to LLVM and updated the cmake scripts.

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

llvm-svn: 353373
2019-02-07 03:19:45 +00:00
Petr Hosek 1a1418bfcb [CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard
Turned out this is used by Flutter which uses Fuchsia Clang toolchain.

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

llvm-svn: 352586
2019-01-30 02:06:06 +00:00
Petr Hosek eb6b5ece58 [CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia
In addition to libc++abi and libc++, we also want to use hermetic
static libunwind on Fuchsia.

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

llvm-svn: 352584
2019-01-30 02:02:25 +00:00
Petr Hosek 6868d537e3 [CMake][Fuchsia] Temporarily disable modules for second stage
This is breaking some of builders, disable modules until it's resolved.

llvm-svn: 352449
2019-01-29 03:38:26 +00:00
Petr Hosek c414065013 [CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia
Similarly to libc++, we want to use hermetic static libc++abi.

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

llvm-svn: 352018
2019-01-24 03:24:37 +00:00
Petr Hosek 6d58c9e2b2 [CMake][Fuchsia] Drop -DNDEBUG, re-enable modules
-DNDEBUG is no longer needed now that we don't enable assertions,
modules should improve build times for the second stage.

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

llvm-svn: 351709
2019-01-21 01:06:50 +00:00
Petr Hosek ba2a2fba05 [CMake][Fuchsia] Disable modules for the second stage build
This made the toolchain build 50% slower.

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

llvm-svn: 351415
2019-01-17 04:12:30 +00:00
Petr Hosek 649af77b9e [CMake][Fuchsia] Synchronize first and second stage builds
This reorders options between the first and second stage builds to make
them better lined up. The change also re-enables tests for first stage
which is useful e.g. for cross-compiling when we cannot run tests for
second stage directly (i.e. without emulation).

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

llvm-svn: 351145
2019-01-15 01:15:00 +00:00
Petr Hosek 0f65ac2aee [CMake] Use hidden visibility for static libc++ in Fuchsia
This is enables the use of libc++ in contexts such as device drivers.

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

llvm-svn: 350491
2019-01-06 08:23:56 +00:00
Petr Hosek 42af135e0d [CMake][Fuchsia] Enable build ID, relaxations for first stage
We want these to be used for the second stage compiler as well.

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

llvm-svn: 350486
2019-01-06 04:14:51 +00:00
Petr Hosek 9dabf6ac70 Revert "[CMake][Fuchsia] Enable experimental new pass manager by default"
This reverts commit r350461 as it causes many of the Clang tests to fail.

llvm-svn: 350484
2019-01-05 23:45:31 +00:00
Petr Hosek 43fc2e4590 [CMake][Fuchsia] Enable experimental new pass manager by default
This change enableds experimental new pass manager.

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

llvm-svn: 350461
2019-01-05 07:57:53 +00:00
Petr Hosek 97a245f8e7 [CMake][Fuchsia] Enable x86 relaxation by default
This enables x86 relaxation by default. This depends on a linker new
enough to support the new reloc types but since we default to lld we
don't worry about host system linkers that might be too old to support
the new reloc types.

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

llvm-svn: 350460
2019-01-05 07:57:46 +00:00
Petr Hosek 4bb647d2a3 [CMake][Fuchsia] Enable --build-id linker flag by default
This enables passing --build-id to linker by default.

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

llvm-svn: 350459
2019-01-05 07:57:38 +00:00
Petr Hosek 88778109a0 [CMake][Fuchsia] Include check-lld in the list of bootstrap targets
This allows running lld tests when doing 2-stage toolchain build.

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

llvm-svn: 350202
2019-01-02 05:11:57 +00:00
Petr Hosek da91431842 [Driver] Support XRay on Fuchsia
This enables support for XRay in Fuchsia Clang driver.

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

llvm-svn: 347444
2018-11-22 02:36:47 +00:00
Petr Hosek 4fd065a4ac [CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia
When cross-compiling the second stage to a different target, we need to
make sure that the first-stage compiler can produce binaries for that
target. Using lld and llvm-objcopy as the default linker and objcopy
tool eliminates some of the dependencies on the host toolchain.

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

llvm-svn: 347108
2018-11-16 23:07:03 +00:00
Petr Hosek d63e846212 [CMake] Support cross-compiling with Fuchsia toolchain build
When second stage is being cross-compiled for a different platform
we need to build enough of first stage runtimes to get a working
compiler.

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

llvm-svn: 347026
2018-11-16 04:50:12 +00:00
Petr Hosek 1ee2987abc [CMake] Use the correct spelling for armv7 in Fuchsia's toolchain
We need to explicitly specify the architecture version.

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

llvm-svn: 347021
2018-11-16 04:09:47 +00:00
Petr Hosek 54e9735824 [CMake] Explicitly list Linux targets for Fuchsia toolchain
Not all Linux targets use the ${arch}-linux-gnu spelling, so instead
specify the list of Linux explicitly.

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

llvm-svn: 346997
2018-11-15 21:55:59 +00:00
Petr Hosek e913415d1b [CMake] Include clang-apply-replacements in Fuchsia toolchain
This is needed for run-clang-tidy.py.

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

llvm-svn: 346827
2018-11-14 04:06:47 +00:00
Petr Hosek 869af342c7 [CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
We set lld as the default linker on non-Darwin platforms, but we still
need to set -fuse-ld=lld explicitly in to support cross-compiling Linux
runtimes on Darwin.

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

llvm-svn: 346056
2018-11-02 23:49:36 +00:00
Petr Hosek 8487d22d12 [CMake][Fuchsia] Don't restrict Linux runtimes to UNIX
This allows building Linux runtimes on any platform if the correct
sysroot is provided via CMake option.

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

llvm-svn: 345889
2018-11-01 20:36:33 +00:00
Petr Hosek 02882b93ad [CMake][Fuchsia] Drop the LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
Now that libc++ uses __exclude_from_explicit_instantiation__ attribute,
this is no longer needed.

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

llvm-svn: 345552
2018-10-29 23:10:49 +00:00
Petr Hosek d3265358b4 [Driver] Support direct split DWARF emission for Fuchsia
This enables the driver support for direct split DWARF emission for
Fuchsia in addition to Linux.

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

llvm-svn: 344556
2018-10-15 21:30:32 +00:00
Enrico Steffinlongo 11b6cedb8e [analyzer] Improved cmake configuration for Z3
Summary:
Enhanced support for Z3 in the cmake configuration of clang; now it is possible to specify any arbitrary Z3 install prefix (CLANG_ANALYZER_Z3_PREFIX) to cmake with lib (or bin) and include folders. Before the patch only in cmake default locations
were searched (https://cmake.org/cmake/help/v3.4/command/find_path.html).

Specifying any CLANG_ANALYZER_Z3_PREFIX will force also CLANG_ANALYZER_BUILD_Z3 to ON.

Removed also Z3 4.5 version requirement since it was not checked, and now Clang works with Z3 4.7

Reviewers: NoQ, george.karpenkov, mikhail.ramalho

Reviewed By: george.karpenkov

Subscribers: rnkovacs, NoQ, esteffin, george.karpenkov, delcypher, ddcc, mgorny, xazax.hun, szepet, a.sidorin, Szelethus

Tags: #clang

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

llvm-svn: 344464
2018-10-13 19:45:48 +00:00
Petr Hosek ed8311da5a [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain
We don't need to provide stable ABI and hence we can use the v2.

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

llvm-svn: 343652
2018-10-03 01:27:00 +00:00
Haojian Wu 06098849c6 Build clang-headers when building clang tools.
Summary:
clang tools require clang headers to work on real project, e.g. when we
build clangd via `ninja clangd`, we expect the binary can run on
real-world project (without running another command `ninja clang-headers`).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, kadircet, cfe-commits

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

llvm-svn: 343459
2018-10-01 12:16:38 +00:00
Petr Hosek b2de4b39be [CMake] Use internal_linkage rather than always_inline for libc++
This is a workaround for PR39053 which was uncovered by D50652 when
the default attribute has been changed from internal_linkage to
always_inline.

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

llvm-svn: 342833
2018-09-23 08:46:31 +00:00
Petr Hosek 427b895e2f [CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain
When building libc++ for Fuchsia, we want to distribute shared libc++,
libc++abi and libunwind as separate libraries, but for static versions
we would like to link all of them into libc++ so -lc++ flag has the same
effect whether shared or static library is being used.

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

llvm-svn: 337877
2018-07-25 01:44:22 +00:00
Petr Hosek ada5119c39 [CMake] Use libc++ and compiler-rt for sanitizers
When building runtimes for Linux as part of Fuchsia toolchain, use
libc++ and compiler-rt for sanitizers.

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

llvm-svn: 337117
2018-07-15 03:11:43 +00:00
Petr Hosek 0b9629b286 [CMake] Don't build Linux targets on Darwin in Fuchsia toolchain
This is currently breaking because Linux target sysroots rely on
case sensitive filesystem which is not by default enabled on macOS.

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

llvm-svn: 335919
2018-06-28 20:33:18 +00:00
Petr Hosek e52b752973 [CMake] Build static runtimes for host in Fuchsia first stage
First stage build is only a minimal build where we don't need
a complete multiarch support, but we need enough to build the
second stage.

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

llvm-svn: 335917
2018-06-28 20:19:11 +00:00
Petr Hosek 2423c16935 [CMake] Use explicit targets for building Linux runtimes
Previously we were using default logic when building Linux runtimes
in Fuchsia toolchain, but that leads to various issues due to how
the CMake logic in compiler-rt for determining the platform support
is implemented. With this change, we will use explicit target for
every provided Linux sysroot.

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

llvm-svn: 335812
2018-06-28 05:15:46 +00:00
Petr Hosek 7636840b87 [CMake] Support passing FUCHSIA_SDK as the only variable
Now that the structure of Fuchsia SDK has been formalized, we no
longer need to pass all the different CFLAGS/LDFLAGS to the CMake
build separately, we can simply set the FUCHSIA_SDK variable and
derive all the necessary variables from that one inside the cache
file.

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

llvm-svn: 335708
2018-06-27 05:50:43 +00:00
Petr Hosek 7e5e3edc95 [CMake] Provide direct support for building sanitized runtimes
This avoids having to rely on magic separators and special parsing.

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

llvm-svn: 335704
2018-06-27 03:35:53 +00:00
Francis Visoiu Mistrih 081568fb2d Revert "[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename."
This reverts commit r334550. Try to fix the stage2 build failing on
Green Dragon for a while.

http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/11124/console

llvm-svn: 335628
2018-06-26 17:05:01 +00:00
Petr Hosek 96917d7912 [Fuchsia] Enable static libc++, libc++abi, libunwind
This is needed for building Fuchsia drivers.

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

llvm-svn: 335410
2018-06-23 03:15:07 +00:00
Ahmed Bougacha 5d89760ea4 [CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename.
This was changed in r334477.

llvm-svn: 334550
2018-06-12 21:27:36 +00:00
Petr Hosek 5e1f49e89b [CMake] Use libc++ and compiler-rt for bootstrap Fuchsia Clang
We want to build the second stage compiler with libc++ and compiler-rt,
also include builtins and runtimes into extra bootstrap components to
ensure these get built.

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

llvm-svn: 334445
2018-06-11 22:06:44 +00:00
Petr Hosek 8084f91e92 [Fuchsia] Include install-distribution-stripped in bootstrap targets
This enables the use of install-distribution-stripped target in the
2-stage builds.

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

llvm-svn: 334063
2018-06-06 05:18:39 +00:00
Petr Hosek cfa9854830 Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes
This doesn't make any difference since we don't use RPATH/RUNPATH
on Fuchsia but it avoids the CMake error when re-linking libraries
while building with Ninja.

Differntial Revision: https://reviews.llvm.org/D46610

llvm-svn: 331833
2018-05-09 00:58:12 +00:00
Petr Hosek 9befdb8814 [CMake] Include llvm-strip in Fuchsia toolchain distribution
Now that llvm-strip is available, include it in the Fuchsia toolchain.

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

llvm-svn: 331826
2018-05-09 00:05:28 +00:00
Petr Hosek 403793e7b5 [CMake] Pass additional CMake flags in Fuchsia cache files
This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

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

llvm-svn: 331717
2018-05-08 02:47:13 +00:00
Petr Hosek edb6ff8c06 [CMake][Cache] Stop pretending that Fuchsia is UNIX
This changes some aspects of the build that are not relevant or useful
for Fuchsia like setting the RPATH/RUNPATH.

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

llvm-svn: 331425
2018-05-03 01:44:03 +00:00
Petr Hosek 17fdef6606 [CMake] Enable libc++ for Fuchsia toolchain on Darwin
This is necessary in order to get a working C++ compiler on Darwin
since Clang expects libc++ headers to be part of the toolchain.

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

llvm-svn: 330855
2018-04-25 18:30:55 +00:00
Petr Hosek 35ad9ee3cb [CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia
This is now set automatically in libc++ config header.

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

llvm-svn: 329984
2018-04-13 02:02:13 +00:00
Alexander Kornienko 2a8c18d991 Fix typos in clang
Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

  archtype
  cas
  classs
  checkk
  compres
  definit
  frome
  iff
  inteval
  ith
  lod
  methode
  nd
  optin
  ot
  pres
  statics
  te
  thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

Differential revision: https://reviews.llvm.org/D44188

llvm-svn: 329399
2018-04-06 15:14:32 +00:00
Petr Hosek a664dac0eb [Fuchsia] Don't install libc++, libc++abi or libunwind on Darwin
The Clang driver doesn't currently know how to use the libraries
that are shipped as part of the toolchain so there's no reason to
ship them at all.

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

llvm-svn: 328114
2018-03-21 16:48:26 +00:00
Petr Hosek 0f0fb0a06f [CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain
Fuchsia already defaults to libc++ and compiler-rt, but we want to use
these as default runtimes even on the host platform.

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

llvm-svn: 327860
2018-03-19 15:19:19 +00:00
Jonas Devlieghere a6ef1abc09 [dsymutil] Rename llvm-dsymutil -> dsymutil
Now that almost all functionality of Apple's dsymutil has been
upstreamed, the open source variant can be used as a drop in
replacement. Hence we feel it's no longer necessary to have the llvm
prefix.

Differential revision: https://reviews.llvm.org/D44527

llvm-svn: 327790
2018-03-18 11:38:41 +00:00
Petr Hosek 0d9c9bef4e [Fuchsia] Include libClang and clang-include-fixer in the toolchain
libClang is used by other Clang based tools such as cquery while
clang-include-fixer is generally a useful tool.

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

llvm-svn: 325665
2018-02-21 04:39:15 +00:00
Vassil Vassilev e151501615 Revert r323051 "[cmake] Use CLANG_BINARY_DIR to determine the build directory."
This broke swift builds.

Thanks for the post-commit review of Chris Bieneman and Davide Italiano!

llvm-svn: 323368
2018-01-24 19:26:50 +00:00
Vassil Vassilev 5829d8f1f7 [cmake] Use CLANG_BINARY_DIR to determine the build directory.
The patch puts the ClangConfig.cmake in the expected location  when clang is
embedded into a framework.

llvm-svn: 323051
2018-01-20 21:43:35 +00:00
Petr Hosek 98a57ad6ce [Fuchsia] Remove LLDB from the toolchain distribution
This is currently not being used so disable it to reduce toolchain size.

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

llvm-svn: 322253
2018-01-11 04:25:30 +00:00