Commit Graph

313 Commits

Author SHA1 Message Date
Petr Hosek 2a5afb4665 [CMake][Fuchsia] Use PIC for Fuchsia runtimes
Disabling PIC globally also disabled PIC for runtimes which was
undesirable, manually override it.

Differential Revision: https://reviews.llvm.org/D103919
2021-06-08 12:30:27 -07:00
Petr Hosek f673365e1c [CMake][Fuchsia] Include llvm-otool in Fuchsia toolchain
We want to use llvm-otool in our build.

Differential Revision: https://reviews.llvm.org/D103918
2021-06-08 11:25:17 -07:00
Petr Hosek de98da2ece [CMake] Only include LTO on Apple targets
We only need libLTO when using ld64.

Differential Revision: https://reviews.llvm.org/D103916
2021-06-08 11:00:01 -07:00
Petr Hosek 1dba2a0269 [Fuchsia] Update some of the Fuchsia toolchain flags
This should make the build more self-contained.

Differential Revision: https://reviews.llvm.org/D103875
2021-06-08 10:04:19 -07:00
Petr Hosek e237168341 Revert "[Fuchsia] Use libc++abi on Windows in Fuchsia toolchain"
This reverts commit b5dd421a3a which
broke Fuchsia downstream builders.
2021-06-03 01:18:22 -07:00
Petr Hosek b5dd421a3a [Fuchsia] Use libc++abi on Windows in Fuchsia toolchain
Don't use vcruntime, this makes our toolchain more hermetic and avoids
some compiler errors we've encountered in compiler-rt.

Differential Revision: https://reviews.llvm.org/D103555
2021-06-02 14:56:27 -07:00
Leonard Chan da1db49409 [Fuchsia] Add compat multilibs to cache file
Differential Revision: https://reviews.llvm.org/D103477
2021-06-01 15:14:56 -07:00
Haowei Wu 0ce58c52d5 [Fuchsia][CMake] Add missing include path.
This patch adds include path for missing header files from "sync".
This patch also fixes the build failures caused by scudo.

Differential Revision: https://reviews.llvm.org/D103218
2021-05-26 19:59:53 -07:00
Vladimir Vereschaka b5a80a0f37 [CMake] Update Cmake cache file for Win to ARM Linux cross builds. NFC
Parametrize the cache file with TARGET_TRIPLE parameter. Normalize
the target triple to follow the runtime library installation directory.

Explicity enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR option.
2021-05-18 20:29:16 -07:00
Shoaib Meenai 56f7e5a822 [cmake] Add support for multiple distributions
LLVM's build system contains support for configuring a distribution, but
it can often be useful to be able to configure multiple distributions
(e.g. if you want separate distributions for the tools and the
libraries). Add this support to the build system, along with
documentation and usage examples.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D89177
2021-05-12 11:13:18 -07:00
Petr Hosek 8cb191b724 [Fuchsia][CMake] Update OSX deployment target
Use correct spelling of CMAKE_OSX_DEPLOYMENT_TARGET and bump the
minimum version to 10.13 which matches what we use for host tools
in Fuchsia.

Differential Revision: https://reviews.llvm.org/D102013
2021-05-06 12:06:16 -07:00
Vladimir Vereschaka 74d9a76ad3 [CMake] Stop using c++ subdirectory for libc++ on Win to ARM Linux cross builds. NFC
Updated cross Win-x-ARM Linux toolchain cmake cache file in according of
the following changes: https://reviews.llvm.org/D100869

Stop using use c++ subdirectory for libc++ library
2021-04-29 14:23:33 -07:00
Petr Hosek ba631240ae [CMake] Set correct CXX_FLAGS for relative-vtables variants
We overrite CXX_FLAGS to enable relative vtables, but doing so
overwrites generic Fuchsia CXX_FLAGS leading to a build failure
on Windows.

Differential Revision: https://reviews.llvm.org/D101551
2021-04-29 10:34:37 -07:00
Petr Hosek 36430d44ed [Driver] Use normalized triples for per-target runtimes
This is a partial revert of b4537c3f51
based on the discussion in https://reviews.llvm.org/D101194. Rather
than using the getMultiarchTriple, we use the getTripleString.
2021-04-27 22:31:36 -07:00
Petr Hosek 3a3fbbe217 [Fuchsia] Use correct target triple for ARM
The Debian multiarch triple is arm-linux-gnueabihf, but the target
is armv7-linux-gnueabihf because some builtins require armv7.
2021-04-26 23:48:12 -07:00
Petr Hosek b4537c3f51 [Driver] Push multiarch path setup to individual drivers
Different platforms use different rules for multiarch triples so
it's difficult to provide a single method for all platforms. We
instead move the getMultiarchTriple to the ToolChain class and let
individual platforms override it and provide their custom logic.

Differential Revision: https://reviews.llvm.org/D101194
2021-04-26 22:17:26 -07:00
Dan Liew 4c0bc69490 Ship `llvm-cxxfilt` in the toolchain.
Originally done for rdar://problem/57155465.

rdar://76602859

Differential Revision: https://reviews.llvm.org/D100405
2021-04-13 11:58:33 -07:00
Dan Liew f66e05a720 Include `count` in AppleClang toolchains.
The motivation here is so we can run the compiler-rt tests
from a standalone build against AppleClang.

In particular the `Posix/halt_on_error-torture.cpp` and
`Posix/halt_on_error_suppress_equal_pcs.cpp` ASan test cases currently
require this binary for the tests to pass.

rdar://76366784

Differential Revision: https://reviews.llvm.org/D100087
2021-04-08 14:00:29 -07:00
Dan Liew 73cbc7f60e Include `llvm-config` and `not` in AppleClang toolchains.
The motivation here is so that we can configure and run compiler-rt
tests from a standalone build against AppleClang.

rdar://75975846

Differential Revision: https://reviews.llvm.org/D100086
2021-04-07 21:29:52 -07:00
Petr Hosek 39f3e9a9e0 [CMake][Fuchsia] Include llvm-lipo
We want to use llvm-lipo for building universal libraries.

Differential Revision: https://reviews.llvm.org/D99243
2021-03-24 14:21:40 -07:00
Timm Bäder d9ef6bc426 [clang] Disable LTO and LLD on SystemZ for stage3 builds
LLD does not support SystemZ, so it doesn't make sense to use it for
boostrap/stage3 builds, and using LTO in these cases won't work.

Differential Revision: https://reviews.llvm.org/D89942
2021-03-17 15:15:41 +01:00
Petr Hosek 75cdeff43b [Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS
This is necessary so we can run Polly tests in 2 stage build.

Differential Revision: https://reviews.llvm.org/D98572
2021-03-12 18:31:20 -08:00
Petr Hosek 3cd2f42521 [Fuchsia] Enable Polly for first stage as well
We want Polly enabled for both stages of the toolchain build.

Differential Revision: https://reviews.llvm.org/D98018
2021-03-05 14:35:57 -08:00
Petr Hosek 1d1983f2d0 [CMake] Enable Polly for Fuchsia toolchain build
We want to enable the use of Polly in Fuchsia.

Differential Revision: https://reviews.llvm.org/D97819
2021-03-02 16:51:16 -08:00
Ryan Prichard 729899f7b6 [libunwind] unw_* alias fixes for ELF and Mach-O
Rename the CMake option, LIBUNWIND_HERMETIC_STATIC_LIBRARY, to
LIBUNWIND_HIDE_SYMBOLS. Rename the C macro define,
_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS, to _LIBUNWIND_HIDE_SYMBOLS,
because now the macro adds a .hidden directive rather than merely
suppress visibility annotations.

For ELF, when LIBUNWIND_HIDE_SYMBOLS is enabled, mark unw_getcontext as
hidden. This symbol is the only one defined using src/assembly.h's
WEAK_ALIAS macro. Other unw_* weak aliases are defined in C++ and are
already hidden.

Mach-O doesn't support weak aliases, so remove .weak_reference and
weak_import. When LIBUNWIND_HIDE_SYMBOLS is enabled, output
.private_extern for the unw_* aliases.

In assembly.h, add missing SYMBOL_NAME macro invocations, which are
used to prefix symbol names with '_' on some targets.

Fixes PR46709.

Reviewed By: #libunwind, phosek, compnerd, steven_wu

Differential Revision: https://reviews.llvm.org/D93003
2021-02-22 16:54:05 -08:00
Fangrui Song 02413b097e [CMake] Delete LLVM_RUNTIME_BUILD_ID_LINK_TARGETS
Announcement: https://lists.llvm.org/pipermail/llvm-dev/2021-February/148446.html

Differential Revision: https://reviews.llvm.org/D96360
2021-02-15 11:06:23 -08:00
Andrzej Warzynski 62e4f22e29 [clang] Add AddClang.cmake to the list of the CMake modules that are installed
This makes sure that AddClang.cmake is installed alongside other Clang
CMake modules. This mirrors LLVM and MLIR in this respect and is
required when building the new Flang driver out of tree (as it depends
on Clang and includes AddClang.cmake).

Reviewed By: bogner

Differential Revision: https://reviews.llvm.org/D94533
2021-02-04 12:38:38 +00:00
Leonard Chan c0e94e9974 [clang][Fuchsia] Add relative-vtables + asan multilibs
We're choosing to take an opt-in approach for landing Relative VTables, so we'll
need asan-equivalent multilibs with relative vtables enabled. Afterwards, we can
just flip the switch in our build.

Differential Revision: https://reviews.llvm.org/D95253
2021-01-25 15:24:16 -08:00
Roland McGrath 70764c02e4 [CMake][Fuchsia] Install llvm-elfabi
The canonical Fuchsia toolchain configuration installs llvm-elfabi.

Reviewed By: haowei

Differential Revision: https://reviews.llvm.org/D92444
2020-12-02 11:59:14 -08:00
Leonard Chan 1e91803c67 Recommit "[clang][Fuchsia] Add relative-vtables multilib"
This recommits fdbd84c6c8 whose initial
build issues were fixed in 19bdc8e5a3.
2020-12-01 17:03:13 -08:00
Leonard Chan 7bc944c102 Revert "[clang][Fuchsia] Add relative-vtables multilib"
This reverts commit fdbd84c6c8.

Reverting due to failing CI builders for Fuchsia's toolchain:
https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-linux-x64/b8862150211240186992?
2020-11-30 19:21:35 -08:00
Leonard Chan fdbd84c6c8 [clang][Fuchsia] Add relative-vtables multilib
This adds multilibs for Fuchsia that is built with the relative vtables ABI,
one with and another without exceptions.

Differential Revision: https://reviews.llvm.org/D85576
2020-11-30 18:21:10 -08:00
Leonard Chan a160189c5d Revert "[clang][Fuchsia] Add relative-vtables multilib"
This reverts commit 7c2bc3b71d.

Forgot to add the ifferential revision.
2020-11-30 18:20:01 -08:00
Leonard Chan 7c2bc3b71d [clang][Fuchsia] Add relative-vtables multilib
This adds a multilib for Fuchsia that is built with the relative vtables
ABI.
2020-11-30 18:17:38 -08:00
Vladimir Vereschaka b09154ebf9 [CMake] Explicity set up RPATH for the runtime libs on Win to ARM Linux cross builds.
Since RPATH initialization was disabled for the runtime libraries to
avoid overwriting RPATH unconditionally we need to explicity set up it
for the Win to Arm Linux cross builds.

See some details here: https://reviews.llvm.org/D91099
2020-11-13 14:32:35 -08:00
Alex Orlov 8aaafa06b2 Added remotely ran compiler-rt tests.
Use LLVM/utils/remote-exec.py to run compiler-rt tests remotely on the target.

Reviewed By: vvereschaka

Differential Revision: https://reviews.llvm.org/D90054
2020-10-30 00:11:16 +04:00
Jonas Devlieghere 27a909a24f [Apple-stage2] Install FileCheck and yaml2obj in the toolchain
rdar://70274446

Differential revision: https://reviews.llvm.org/D89763
2020-10-20 13:46:44 -07:00
Louis Dionne eaa928b71a [libc++] Explicitly request new/delete in libc++ for Win to ARM Linux builds
Since 9b40ee8eb0, new/delete must be requested explicitly during the
CMake configuration if one wants these definitions to appear in libc++.

Differential Revision: https://reviews.llvm.org/D89793
2020-10-20 10:51:05 -04:00
Petr Hosek b72813f4d6 [CMake][Fuchsia] Start building arm64 Darwin runtimes
This enables arm64 Darwin support in Fuchsia toolchain.
2020-10-13 19:50:45 -07:00
Serge Guelton b4ffc40d62 Update documentation and implementation of stage3 build
Have the build work out of the box by forcing an LLD build.

That way, we don't require an external LTO-aware linker,
as we build one.

Also remove reference to the seemingly dead builder.

Differential Revision: https://reviews.llvm.org/D88990
2020-10-08 07:55:37 +02:00
Petr Hosek de47e7122f [CMake][Fuchsia] Don't set WIN32 API, rely on autodetection
We prefer autodetection here to avoid persisting this configuration
in the generated __config header which is shared across targets.

Differential Revision: https://reviews.llvm.org/D88694
2020-10-01 12:35:52 -07:00
Nico Weber 33c9dbbd38 Add an explicit toggle for the static analyzer in clang-tidy
Instead of using CLANG_ENABLE_STATIC_ANALYZER for use of the
static analyzer in both clang and clang-tidy, add a second
toggle CLANG_TIDY_ENABLE_STATIC_ANALYZER.

This allows enabling the static analyzer in clang-tidy while
disabling it in clang.

Differential Revison: https://reviews.llvm.org/D87118
2020-09-10 10:48:17 -04:00
Alexandre Ganea 98e01f56b0 Revert "Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record"
This reverts commit a3036b3863.

As requested in: https://reviews.llvm.org/D80833#2221866
Bug report: https://crbug.com/1117026
2020-08-17 15:49:18 -04:00
Alexandre Ganea a3036b3863 Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record
This patch adds the missing information to the LF_BUILDINFO record, which allows for rebuilding a .CPP without any external dependency but the .OBJ itself (other than the compiler).

Some external tools that we are using (Recode, Live++) are extracting the information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO stores a full path to the compiler, the PWD (CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variables). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

Differential Revision: https://reviews.llvm.org/D80833
2020-08-10 13:36:30 -04:00
Petr Hosek 3ff7dcded2 [CMake][Fuchsia] Include additional tools in the toolchain
These are needed on Windows.

Differential Revision: https://reviews.llvm.org/D83999
2020-07-30 13:08:02 -07:00
Alexandre Ganea b71499ac9e Revert "Re-land [CodeView] Add full repro to LF_BUILDINFO record"
This reverts commit add59ecb34 and 41d2813a5f.
2020-07-10 19:46:16 -04:00
Alexandre Ganea 41d2813a5f [PDB] Attempt fix for debug-info-codeview-buildinfo.c test
This is a bit a shot in the dark, as it doesn't occur on my Windows 10 machines, nor on x64 Linux Ubuntu 18.04.
This patch tries to fix the following kind of error:
- http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/31511/steps/cmake%20stage%201/logs/stdio
- http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/25150/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adebug-info-codeview-buildinfo.c
- http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/7947/steps/check/logs/stdio
2020-07-10 18:52:52 -04:00
Petr Hosek ceb76d2fe7 [CMake][Fuchsia] Move runtimes to outer scope
This is needed for runtimes to be properly configured, addressing an
issue introduced in 53e38c85.
2020-07-09 21:07:44 -07:00
Petr Hosek 53e38c85a8 [CMake][Fuchsia] Support for building with MSVC
This change adds the necessary flags for building the full Fuchsia
toolchain on Windows with MSVC.

Differential Revision: https://reviews.llvm.org/D73810
2020-07-09 13:07:12 -07:00
Petr Hosek a378c04495 [Fuchsia] Set projects and runtimes in the cache file
We make assumptions about what projects and runtimes are enabled
when configuring our toolchain build, so we should enable those in
the cache file as well rather than relying on those being set
externally.

Differential Revision: https://reviews.llvm.org/D81514
2020-07-05 14:48:52 -07:00
serge-sans-paille 05c479491c Make it possible for client code to consume CLANG_LINK_CLANG_DYLIB
If a client code wants to consume clang libraries, it needs to know
CLANG_LINK_CLANG_DYLIB value in order to decide whether to use the DYLIB or
individual components.

Differential Revision: https://reviews.llvm.org/D82291
2020-06-30 15:13:53 +02:00
Sergej Jaskiewicz c310d0de39 [cmake] Invoke ssh.py using Python interpreter, not as executable in CrossWinToARMLinux.cmake
The issue is that Windows doesn't support shebangs. This caused issues
with libc++ tests.
2020-06-15 23:59:06 +03:00
Vladimir Vereschaka f8d87ce9ca [CMake] Use 'ssh.py' executor to run the remote library tests.
In order to support the libcxx new format changes SSHExecutor was
replaced with ssh.py script in the following way:

LIBxxx_EXECUTOR="<llvm-root>/libcxx/utils/ssh.py --host <username>@<host>"

See 96e6cbbf94 commit for details.
2020-06-12 12:31:59 -07:00
Alex Lorenz 5eedf07ab9 [apple clang] disable in-process CC1 to preserve crashlog compatibility
The in-process CC1 currently doesn't interoperate with the macOS crash analytics,
which we would like to keep enabled for Apple clang. This commit restores the
out-of-process CC1 to the Apple clang CMake configuration for now.

Differential Revision: https://reviews.llvm.org/D80849
2020-06-05 10:55:42 -07:00
Sergej Jaskiewicz 3873d0b3d8 Re-commit "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"
https://reviews.llvm.org/D78200 has been re-committed, so we can now
enable building std::filesystem and running tests for it.
2020-05-25 19:14:54 +03:00
Leonard Chan 592303a53e [Fuchsia] Do not enable the Z3 solver for a fuchsia toolchain
gLinux started shipping incompatible versions of Z3, which can lead to a
missing `z3.h` header when building the Z3 solver locally. This patch
disables the Z3 solver when building a clang toolchain for Fuchsia.

Differential Revision: https://reviews.llvm.org/D79974
2020-05-14 17:03:58 -07:00
Sergej Jaskiewicz ddfe58822e Revert "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"
This reverts commit 67175d8dc5.

https://reviews.llvm.org/D78200 has been reverted, so our bot is red.
Make it green by turning off std::filesystem.
2020-05-07 15:01:39 +03:00
Han Zhu 0c9230dad1 Reland [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
f8990feb12 enabled installing PIC version of both libclang.a and
libclang.so when LIBCLANG_BUILD_STATIC is ON. But it broke the no-PIC
build when LLVM_ENABLE_PIC=OFF with the following error:

```
CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type
```

This is because as the code loops through ${name} and ${name}_static, it
introduced a side effect, which is adding an empty libclang_static to
targets. Later target_compile_definitions is called on libclang_static.
That function requires that target must have been created by a command
such as add_executable() or add_library(), so it crashed.

The solution is to not naively loop through both libclang and
libclang_static, but only the ones that are actually added by
llvm_add_library(). Here's the library build type to library target name
mapping:

| SHARED only | libclang |
| STATIC only | libclang |
| SHARED and STATIC | libclang and libclang_static |

So only when SHARED and STATIC are both set should we loop through two
targets. Explicitly parse the STATIC argument and set the list
accordingly.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D79059
2020-05-06 19:33:58 -07:00
Sergej Jaskiewicz 67175d8dc5 [cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake
Now that https://reviews.llvm.org/D78200 has landed, there should be
no problem with those tests. If there is, it is OK to revert this.
2020-05-06 01:31:32 +03:00
Hans Wennborg f03b505ee7 Revert f8990feb12 "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"
This broke builds configured with

$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release '-DLLVM_ENABLE_PROJECTS=clang' '-DLLVM_TARGETS_TO_BUILD=X86' -DLLVM_ENABLE_PIC=OFF ../llvm

CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type

This reverts commit f8990feb12.
2020-04-28 10:10:33 +02:00
Han Zhu f8990feb12 [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON
When LIBCLANG_BUILD_STATIC=ON and LLVM_ENABLE_PIC=ON, PIC version of
libclang.a and libclang.so are built as expected. However libclang.a is
not installed. Looking at the macro llvm_add_library(), when both SHARED
and STATIC are set, it renames the static library to ${name}_static and
then adds it to targets. But when add_clang_library() calls install, it
only checks if ${name} is in targets.

To work around this issue, loop through both ${name} and ${name}_static
and install both of them if they're in targets. This is still correct if
only shared or static library is built. In those cases, only ${name} is
added to targets and cmake install will generate the right install
script depending on the library's type.

Test Plan:
cmake with LIBCLANG_BUILD_STATIC=ON and then ninja install, from master
and this diff. Compare the result directory trees. Confirm that only
difference is the added libclang.a.

Differential Revision: https://reviews.llvm.org/D78534
2020-04-27 13:37:07 -07:00
Petr Hosek 063128f979 [Fuchsia] Build compiler-rt builtins for 32-bit x86
While we don't support 32-bit architectures in Fuchsia, these are needed
in the early boot phase on x86, so we build just these to satisfy that
use case.

Differential Revision: https://reviews.llvm.org/D78687
2020-04-24 12:18:30 -07:00
Sergej Jaskiewicz 7ce4e65231 [cmake] Temporarily disable building std::filesystem in CrossWinToARMLinux.cmake 2020-04-18 00:29:44 +03:00
Stephen Neuendorffer 0c0831f74b [CMAKE] Plumb include_directories() into tablegen()
Previously, the tablegen() cmake command, which defines custom
commands for running tablegen, included several hardcoded paths.  This
becomes unwieldy as there are more users for which these paths are
insufficient.  For most targets, cmake uses include_directories() and
the INCLUDE_DIRECTORIES directory property to specify include paths.
This change picks up the INCLUDE_DIRECTORIES property and adds it
to the include path used when running tablegen.  As a side effect, this
allows us to remove several hard coded paths to tablegen that are redundant
with specified include_directories().

I haven't removed the hardcoded path to CMAKE_CURRENT_SOURCE_DIR, which
seems generically useful.  There are several users in clang which apparently
don't have the current directory as an include_directories().  This could
be considered separately.

The new version of this path uses list APPEND rather than list TRANSFORM,
in order to be compatible with cmake 3.4.3. If we update to cmake 3.12 then
we can use list TRANSFORM instead.

Differential Revision: https://reviews.llvm.org/D77156
2020-04-03 11:23:38 -07:00
Stephen Neuendorffer f288c21687 Revert "[CMAKE] Plumb include_directories() into tablegen()"
This reverts commit ae044c5b0c.

This breaks the buildbots, which use an older version of cmake.
2020-04-03 10:47:36 -07:00
Stephen Neuendorffer ae044c5b0c [CMAKE] Plumb include_directories() into tablegen()
Previously, the tablegen() cmake command, which defines custom
commands for running tablegen, included several hardcoded paths.  This
becomes unwieldy as there are more users for which these paths are
insufficient.  For most targets, cmake uses include_directories() and
the INCLUDE_DIRECTORIES directory property to specify include paths.
This change picks up the INCLUDE_DIRECTORIES property and adds it
to the include path used when running tablegen.  As a side effect, this
allows us to remove several hard coded paths to tablegen that are redundant
with specified include_directories().

I haven't removed the hardcoded path to CMAKE_CURRENT_SOURCE_DIR, which
seems generically useful.  There are several users in clang which apparently
don't have the current directory as an include_directories().  This could
be considered separately.

Differential Revision: https://reviews.llvm.org/D77156
2020-04-03 10:38:25 -07:00
Sergej Jaskiewicz 9a6a696817 [cmake] Link libc++ tests against static libc++/libc++abi in CrossWinToARMLinux.cmake
Summary: Now that D72687 has landed, we can enable this setting in our cache file.

Reviewers: vvereschaka

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76774
2020-03-31 23:36:36 +03:00
Petr Hosek 98223f7931 [Fuchsia] Use -ffile-prefix-map
This makes toolchain independent of the path it was built in by
rewriting all absolute paths embedded in sources and debug info
into relative ones.

Differential Revision: https://reviews.llvm.org/D76189
2020-03-19 15:14:15 -07:00
Petr Hosek c682a605eb [Fuchsia] Include llvm-gsymutil tool in the Fuchsia toolchain
This tool is used for generating and manipulating GSYM files.

Differential Revision: https://reviews.llvm.org/D76204
2020-03-18 13:51:47 -07:00
Sergej Jaskiewicz 03993f3b6f [CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake
Summary:
D69169, which was necessary for running libc++ tests on remote host, got reverted. I couldn't think of a less invasive way to achieve this behavior but specify libc++abi paths in our cache file.

Reviewers: vvereschaka, aorlov, andreil99, EricWF

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, ldionne, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74347
2020-03-13 17:58:02 +03:00
Vladimir Vereschaka 828fe7916f Revert "Temporarily re-apply https://reviews.llvm.org/D74347"
This reverts commit 0197eac333.

The changes break Armv7/Aarch64 toolchain builders:
* http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/5570
* http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/5600
2020-03-11 15:00:56 -07:00
Sergej Jaskiewicz 0197eac333 Temporarily re-apply https://reviews.llvm.org/D74347
It was reverted in 35367e06b8
because it broke the buildbot due to missing libc++abi headers.

https://reviews.llvm.org/D75991 improves the diagnostics, so I hope
the build log will be more informative.
2020-03-11 21:35:14 +03:00
Sergej Jaskiewicz 35367e06b8 Revert "[CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake"
This reverts commit 801627ee49.
2020-02-17 16:06:30 +03:00
Sergej Jaskiewicz 801627ee49 [CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake
Summary:
D69169, which was necessary for running libc++ tests on remote host, got reverted. I couldn't think of a less invasive way to achieve this behavior but specify libc++abi paths in our cache file.

Reviewers: vvereschaka, aorlov, andreil99, EricWF

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, ldionne, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74347
2020-02-17 15:24:04 +03:00
Petr Hosek 67f4e0011d [CMake][Fuchsia] Enable in-process cc1
This is now supported by Goma so we can re-enable it.
2020-02-12 14:05:24 -08:00
Petr Hosek 635cbef505 [CMake][Fuchsia] Disable in-process cc1
The in-process cc1 currently breaks Goma client and therefore prevents
the use of tip-of-tree Clang with Goma, so we disable the in-process cc1
in our toolchain until this issue is resolved.
2020-01-22 10:11:54 -08:00
Sergej Jaskiewicz 383ff4eac1 [CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux cmake cache
Summary: Depends on D72847

Reviewers: vvereschaka, aorlov, andreil99

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72850
2020-01-18 01:29:09 +03:00
Sergej Jaskiewicz e44dedd363 [CMake] Support running libc++abi tests in CrossWinToARMLinux cache file
Summary:
Now that D71894 has landed, we're able to run libc++abi tests remotely.

For that we can use the same CMake command as before. The tests can be run using `ninja check-cxxabi`.

Reviewers: andreil99, vvereschaka, aorlov

Reviewed By: vvereschaka, aorlov

Subscribers: mgorny, kristof.beyls, ldionne, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72459
2020-01-10 12:59:05 +03:00
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