542 Commits

Author SHA1 Message Date
serge-sans-paille
527af302b9
Add support for dynamic libraries in CLANG_BOLT (#127020) 2025-03-02 20:21:44 +00:00
Tom Stellard
09832777d8
[CMake][Release] Statically link ZSTD on all OSes (#128554)
This will make the binaries more portable.
2025-02-25 16:10:20 -08:00
Tom Stellard
148111fdcf
[CMake][Release] Enable bolt optimization for clang on Linux (#128090)
Also stop buiding the bolt project on other platforms since bolt only
supports ELF.
2025-02-25 07:33:42 -08:00
Tom Stellard
f5b311e47d
[CMake][Release] Statically link clang with stage1 runtimes (#127268)
This change will cause clang and the other tools to statically link
against the runtimes built in stage1. This will make the built binaries
more portable by eliminating dependencies on system libraries like
libgcc and libstdc++.
2025-02-19 17:46:29 -08:00
Miguel A. Arroyo
165a3d6a9b
Revert "[Clang][CMake][MSVC] Install PDBs alongside executables" (#126934)
Reverts llvm/llvm-project#126675

Broke the following:
https://lab.llvm.org/buildbot/#/builders/107/builds/7929
2025-02-12 08:15:52 -08:00
Miguel A. Arroyo
acd34d90d3
[Clang][CMake][MSVC] Install PDBs alongside executables (#126675)
* Follows up on https://github.com/llvm/llvm-project/pull/120683
enabling PDBs for `clang`.
2025-02-11 19:41:34 -08:00
Paul Kirth
f290fc3df0
[Fuchsia] Disable building runtimes with LTO (#126306)
Temporarily disable LTO'd runtimes, while we investigate an issue
building Fuchsia with LTO.
2025-02-10 11:37:06 -08:00
Paul Kirth
3e2afe5f01
Revert "[Fuchsia] Support PGO" (#126293)
Reverts llvm/llvm-project#120323

This breaks some internal Fuchsia builders. We can reland again later,
once that is addresed.
2025-02-07 16:57:11 -08:00
Petr Hosek
1438c8d68d
[Fuchsia] Support PGO (#120323)
Enable 2-stage builds with PGO.
2025-02-07 08:49:18 -08:00
Sirraide
c4a019747c
[Clang] Remove ARCMigrate (#119269)
In the discussion around #116792, @rjmccall mentioned that ARCMigrate
has been obsoleted and that we could go ahead and remove it from Clang,
so this patch does just that.
2025-01-30 05:32:25 +01:00
Paul Kirth
6578790076
Reapply "[Fuchsia][cmake] Allow using FatLTO when building runtimes" (#119252) (#121820)
The previous failures were addressed with CMake changes in #121819
2025-01-27 13:44:18 -08:00
Paul Kirth
71ad9a958a
[fuchsia][cmake] Add runtimes for cortex-m4 for the Fuchsia toolchain (#123258) 2025-01-17 08:06:49 -08:00
Brian Cain
f325e4b2d8
[Hexagon] Add default clang symlinks to CLANG_LINKS_TO_CREATE (#123011)
Since this cache value overrides the defaults, we end up with `clang`
linked to `clang-20`, and some `${triple}-clang*` links, but we're
missing `clang++`. This makes for a toolchain with inconsistent behavior
when used in someone's `$PATH`.

We'll add the default symlinks to our list so that C and C++ programs
are both built as expected when `clang` and `clang++` are invoked.
2025-01-15 12:53:32 -06:00
Paul Bowen-Huggett
1842a3d833
Fix a cmake error when using the Xcode generator. (#119403)
I’m seeing a series of errors when trying to run the cmake configure
step on macOS when the cmake generator is set to Xcode. All is well if I
use the Ninja or Unix Makefile generators. Messages are all of the form:
~~~
CMake Error at …llvm-project/clang/cmake/modules/AddClang.cmake:120
(target_compile_definitions):
  Cannot specify compile definitions for target "obj.clangBasic" which
  is not built by this project.
Call Stack (most recent call first):
  …llvm-project/clang/lib/Basic/CMakeLists.txt:57 (add_clang_library)
~~~
The remaining errors are similar but mention targets obj.clangAPINotes,
obj.clangLex, obj.clangParse, and so on.

The regression appears to have been introduced by commit 09fa2f012fcc
(Oct 14 2024) which added the code in this area.

My proposed solution is simply to add a test to ensure that the obj.x
target exists before setting its compile definitions. There is precedent
doing just this in both clang/cmake/modules/AddClang.cmake and
clang/lib/support/CMakeLists.txt as well as in the “MSVC AND NOT
CLANG_LINK_CLANG_DYLIB” path immediately above the offending line.

I’ve also made a couple of grammatical tweaks in the comments
surrounding this code.

In case it's relevant, the cmake settings and definitions I've used to
trigger these errors is:
~~~bash
GENERATOR="Xcode"
OUTDIR=build_macos
cmake \
-S "$SCRIPT_DIR/llvm" \
-B "$SCRIPT_DIR/$OUTDIR" \
-G "$GENERATOR" \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_OSX_ARCHITECTURES=arm64 \
-D LLVM_PARALLEL_LINK_JOBS=1 \
-D LLVM_ENABLE_PROJECTS="clang;lld" \
-D LLVM_TARGETS_TO_BUILD=RISCV \
-D LLVM_DEFAULT_TARGET_TRIPLE=riscv32-unknown-elf \
-D LLVM_OPTIMIZED_TABLEGEN=Yes
~~~
(cmake v3.31.1, Xcode 16.1. I know that not all of these variables are
useful for the Xcode generator!)

Co-authored-by: Paul Bowen-Huggett <phuggett@keysom.io>
2025-01-09 11:26:07 -08:00
Petr Hosek
edf9439e00
[libcxx] Support for using timespec_get (#117362)
clock_gettime is a POSIX API that may not be available on platforms like
baremetal; timespec_get is the C11 equivalent. This change adds support
for using timespec_get instead of clock_gettime to improve compatibility
with non-POSIX platforms. For now, this is only enabled with LLVM libc
which implemented timespec_get in #116102, but in the future this can be
expanded to other platforms.

Related to #84879.
2024-12-17 08:16:55 -08:00
Petr Hosek
2e8ce30423
[libc] Support baremetal libc on aarch64 (#118691)
We have users that target baremetal aarch64.
2024-12-09 15:34:51 -08:00
Paul Kirth
1cbd67efe4
Revert "[Fuchsia][cmake] Allow using FatLTO when building runtimes" (#119252)
Reverts llvm/llvm-project#112277

This broke something on Fuchsia's Mac builders, 
so there's still something in the CMake that needs to be updated before
we reland.

Failed build: 

https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-mac-xarm64/b8729005878443108801/overview
2024-12-09 11:25:01 -08:00
Paul Kirth
57545dbbdb
[Fuchsia][cmake] Allow using FatLTO when building runtimes (#112277)
We'd like to build runtimes using FatLTO (see
https://llvm.org/docs/FatLTO.html for details). This gives us more
control over how libc++ can be consumed by users of our toolchain, like
the Fuchsia SDK.
2024-12-09 09:26:17 -08:00
Vladimir Vereschaka
a996a15b4c
[CMake] Allow parametrizing of the static libraries in Cross ARM CMake cache. NFC. (#118737)
In order to support the cross-arm remote tests for LLDB project

(see 'lldb-remote-linux-*' public builders for details).
2024-12-04 21:04:29 -08:00
Petr Hosek
8cffab821c
[Fuchsia] Remove libc from LLVM_ENABLE_PROJECTS (#118704)
This was only needed for old hdrgen which is no longer being used.
2024-12-04 13:58:41 -08:00
Petr Hosek
f7497b10f7
[Fuchsia][CMake] Enable new libc header gen (#116938)
All issues blocking this were resolved.
2024-11-21 11:01:55 -08:00
Vladimir Vereschaka
50e38cc856
[CMake] Update CMake cache file for the ARM/Aarch64 cross toolchain builds. NFC. (#116744)
Forcely disable the libc++ benchmarks on Windows build hosts. The
benchmark configuration currently does not support the cross builds on
Windows hosts.

Also removed unnecessary `CMAKE_CROSSCOMPILING` CMake option.
2024-11-19 17:42:26 -08:00
Petr Hosek
1e492285f3
[Fuchsia] Include runtimes for armv8.1m.main-none-eabi (#116420)
These are needed by some of our users.
2024-11-15 11:32:15 -08:00
Petr Hosek
627b8f87e2
Revert "[Fuchsia][CMake] Enable new libc header gen" (#116174)
Reverts llvm/llvm-project#102371
2024-11-13 23:32:20 -08:00
Petr Hosek
d492001bdc
[Fuchsia][CMake] Enable new libc header gen (#102371)
All issues blocking this were resolved.
2024-11-13 11:45:54 -08:00
Thomas Fransham
09fa2f012f
[Clang] Add explicit visibility symbol macros (#108276)
This is part of the effort to support for enabling plugins on windows by
adding better support for building llvm and clang as a DLL. These macros
are similar to the ones i added in #96630, but are for clang.
Added explicit symbol visibility macros definitions that are defined in
a new header and will be used to for shared library builds of clang to
export
symbols. 
Updated clang cmake to define a macro to enable the symbol visibility
macros and explicitly disable them for clang tools that always use
static linking.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-10-14 18:32:50 +03:00
Petr Hosek
b94c763b7c
[Fuchsia][CMake] Set output name for libc++ shared library (#111791)
This is a dependency of #80007.
2024-10-10 07:59:34 -04:00
Louis Dionne
7e31eaab57
[libc++] Remove unused HAVE_LIBCXXABI variable from Android cache (#111007)
This variable isn't used anymore in libc++'s build and hasn't been for a
few years, so this is likely a remnant of the past.
2024-10-08 13:16:47 -04:00
Brian Cain
ea62db0c03
[cmake] Add hexagon-linux cmake cache files (#98712)
These can be used to create a fully-bootstrapped toolchain to target
hexagon {baremetal,linux} with scripts like the ones in
https://github.com/quic/toolchain_for_hexagon
2024-10-03 08:11:34 -05:00
Keith Smiley
748f5404cc
workflows/release-binaries: Use static ZSTD on macOS (#109909)
On macOS the shared zstd library points to a homebrew install that isn't
very stable for users.
2024-10-01 10:02:20 -07:00
Konrad Kleine
b206bf0952
Fix CLANG_BOOTSTRAP_TARGETS in Release.cmake (#106407)
# Problem

Before this patch you could not build the `stage2-LLVM` for example
because you first had to manually add it to `CLANG_BOOTSTRAP_TARGETS` in
the `Release.cmake` and also add it to
`LLVM_RELEASE_FINAL_STAGE_TARGETS` in the cmake configure run. Now you
can just use `-DLLVM_RELEASE_FINAL_STAGE_TARGETS="LLVM;clang"` on the
cmake CLI and be able to build the targets `stage2-LLVM` and
`stage2-clang` without further changes to the cache file.

# Solution

Take all `LLVM_RELEASE_FINAL_STAGE_TARGETS` elements and append them
prefixed with `stage2-` to `CLANG_BOOTSTRAP_TARGETS`. Afterwards all
duplicates are removed.
2024-09-05 10:41:18 +02:00
Petr Hosek
26a4edf655
[CMake][compiler-rt] Support for using compiler-rt atomic library (#106603)
Not every toolchain provides and want to use libatomic which is a part
of GCC, some toolchains may opt into using compiler-rt atomic library.
2024-09-03 10:28:49 -07:00
Petr Hosek
332e6f86c5
[Fuchsia] Support F extension for riscv32-unknown-elf (#106808)
This is used by some targets we support.
2024-08-30 15:23:32 -07:00
Petr Hosek
8b77aa990b
[libc] Use correct names for locale variants in spec.td (#106806)
This addresses issue introduced in #105718.
2024-08-30 15:13:23 -07:00
Tom Stellard
8927576b8f
workflows/release-binaries: Enable flang builds on Windows (#101344)
Flang for Windows depends on compiler-rt, so we need to enable it for
the stage1 builds. This also fixes failures building the flang tests on
macOS.

Fixes #100202.
2024-08-28 18:22:57 -07:00
Vladimir Vereschaka
341d86dcd3
[CMake] Update CMake cache file for the ARM/Aarch64 cross toolchain builds. NFC. (#103552)
In order to build LLDB project added the following changes:

* enable LIBCXX_ENABLE_STATIC_ABI_LIBRARY option to link the ABI library statically.
* set LIBCXX_ABI_VERSION to 1 by default.
2024-08-20 22:13:16 -07:00
Steven Wu
b8c560f159
[CMake] Remove EXPORT_SYMBOLS_FOR_PLUGINS from #102138 (#102396)
Partially remove some of the changes from #102138 as
EXPORT_SYMBOLS_FOR_PLUGINS doesn't work on all the configurations.
2024-08-08 06:00:11 -07:00
Petr Hosek
fc0802a1d0
[Fuchsia][CMake] Remove new/delete from baremetal libc++ (#102415)
This is causing issues for some baremetal targets.
2024-08-07 19:53:21 -07:00
Steven Wu
01b488faab
Reapply "[CMake] Fold export_executable_symbols_* into function args. (#101741)" (#102138)
Fix the builds with LLVM_TOOL_LLVM_DRIVER_BUILD enabled.

LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES is not completely
compatible with export_executable_symbols as the later will be ignored
if the previous is set to NO.

Fix the issue by passing if symbols need to be exported to
llvm_add_exectuable so the link flag can be determined directly
without calling export_executable_symbols_* later.
2024-08-07 09:12:15 -07:00
Petr Hosek
22c06aa5e9
[Fuchsia][CMake] Check correct triple to set -mcpu (#101910)
We use armv8m.main-none-eabi now, not armv8m.main-unknown-eabi.
2024-08-04 16:35:56 -07:00
Petr Hosek
a2855f5120
[CMake][Fuchsia] Use standard spelling for Arm baremetal targets (#101302)
It's more common to use `none` rather than `unknown` for the OS
component in Arm baremetal targets.
2024-08-01 22:22:16 -07:00
Petr Hosek
9b017db6be
Revert "[CMake][Fuchsia] Include libunwind and libc++abi in baremetal build" (#101340)
Reverts llvm/llvm-project#100908
2024-07-31 07:26:45 -07:00
Petr Hosek
8300eaad0f
[CMake][Fuchsia] Include libunwind and libc++abi in baremetal build (#100908)
These are needed for baremetal targets as well.
2024-07-31 01:08:56 -07:00
Jon Roelofs
a982cabea3
[cmake][llvm] Limit the number of Xcode schemes created by default (#101243)
CMake -GXcode would otherwise offer to create one scheme for each
target, which ends up being a lot. For now, limit the default to the
`check-*` LIT targets, plus `ALL_BUILD` and `install`.

For targets that aren't in the default list, we now have a configuration
variable to promote an extra list of targets into schemes, for example
`-DLLVM_XCODE_EXTRA_TARGET_SCHEMES="TargetParserTests;SupportTests"` to
add schemes for `TargetParserTests` and `SupportTests` respectively.
2024-07-30 17:17:04 -07:00
Tom Stellard
247251aee0
Build release binaries for multiple targets (#98431)
This adds release binary builds for the 4 platforms currently supported
by the free GitHub Action runners:

* Linux x86_64
* Windows x86_64
* Mac x86_64
* Mac AArch64

The test stages for these are known to fail, but the creating and
upoading of the release binaries should pass.
2024-07-26 11:26:34 -07:00
PiJoules
38f2f95272
[Fuchsia] Apply armv8m flags for runtimes (#100656)
These are needed for cortex-m33. Ideally in the future we'd have
separate multilibs for different ABI configs and we wouldn't need to
explicitly set cortex-m33 manually. The driver should handle it.
2024-07-25 14:42:46 -07:00
Haowei
40954d7f9b
[Fuchsia] Disable new hdrgen in Fuchsia toolchain build (#100001)
We are seeing a PyYaml issue after the new libc_hdrgen was enabled by
default. This patch disables it in Fuchsia toolchain build so we restore
the builder while we are investigating.
2024-07-22 16:18:38 -07:00
Haowei
72d8c2737b
[Fuchsia] Remove linker flags from stage2 pass through (#99722)
This patch removes CMAKE_XXX_LINKER_FLAGS from list of flags that passed
through to stage2 build.
2024-07-19 21:42:57 -07:00
Petr Hosek
3b78dfa10c
[libc][libcxx] Support for building libc++ against LLVM libc (#99287)
Provide an option to build libc++ against LLVM libc and set the CMake
compile and link options appropriately when the option is enabled.
2024-07-18 22:17:42 -07:00
Petr Hosek
130ef73754
[CMake][Fuchsia] Install libc++ for baremetal targets (#99372)
We already build the library and want to install it also.
2024-07-17 11:46:17 -07:00