Commit Graph

207 Commits

Author SHA1 Message Date
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
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