555 Commits

Author SHA1 Message Date
Tom Stellard
cff9ae7a15
[CMake][Release] Build with -ffat-lto-objects (#140381)
Fixes #133580
2025-07-29 15:33:49 -07:00
Haowei
38f63642fb
[Fuchsia] Add fputs workaround in baremetal targets (#150565)
When building LLVM baremetal targets with LLVM libcxx and LLVM libc,
certain FILE related C functions do not exist and this causes build
failures. This patch updates the workaround for this to mitigate a build
failure after d750c6de8a75cbe2bc16c136764195471be8f0b7 got landed.
2025-07-24 18:42:52 -07:00
gulfemsavrun
36a19c5bfe
[Fuchsia] Add BOOTSTRAP_BOOTSTRAP flags for PGO (#150448) 2025-07-24 19:50:39 +03:00
gulfemsavrun
f20130a8d4
[Fuchsia] Don't use LLVM build for PGO data (#149788) 2025-07-22 10:28:14 +03:00
Petr Hosek
30a2b8baca
[CMake][Fuchsia] Switch to RUNTIMES_USE_LIBC option (#147776)
LIBCXX_LIBC was renamed to RUNTIMES_USE_LIBC in #134893.
2025-07-09 10:10:34 -07:00
Steven Wu
2c9a727ae5
[CMake] Turn on LLVM_ENABLE_BACKTRACE for Apple stage1 compiler (#141872) 2025-05-28 17:32:29 -07:00
Miguel A. Arroyo
795e889037
[Clang][CMake][MSVC] Install PDBs alongside executables (#126961)
Fixes the changes introduced in
https://github.com/llvm/llvm-project/pull/126675 and subsequently
reverted by https://github.com/llvm/llvm-project/pull/126934 .

Originally, I mistakenly put the `install` in the wrong location (should
have been in the `add_clang_tool` macro) which slipped through testing.
I've verified locally using the same CMake configure options.


For reference:
* **CMake Configure**
```
 cmake -B build -S llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;compiler-rt" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PDB=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
```
* **Error**
```
TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
```
2025-05-23 12:58:56 -07:00
Petr Hosek
70cf616b33
[Fuchsia] Support PGO (#128680)
Enable 2-stage builds with PGO.
2025-05-07 11:28:57 -07:00
gulfemsavrun
a27f7ac5c4
Revert "[Fuchsia] Disable PIC" (#136617)
Reverts llvm/llvm-project#136376 because it broke Fuchsia Clang
toolchain builders.
2025-04-21 14:34:43 -07:00
Petr Hosek
846986f35b
[Fuchsia] Disable PIC (#136376)
We aren't distributing any shared libraries so we don't need PIC and
using PIE instead of PIC can improve performance.
2025-04-21 11:04:47 -07:00
Paul Kirth
9af61f500c
Revert "[Fuchsia] Not building llvm-mt when LIBXML2 is not enabled." (#136216)
Reverts llvm/llvm-project#135877

This is causing some problems on Fuchsia's windows CI. We'll need a
different solution to triage other builders.


https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8717476961063994817/overview
2025-04-17 15:43:57 -07:00
Haowei
860d0383db
[Fuchsia] Not building llvm-mt when LIBXML2 is not enabled. (#135877)
This patch prevents including the llvm-mt to `LLVM_TOOLCHAIN_TOOLS` in the
Fuchsia toolchain when LIBXML2 is not explicitly enabled.
2025-04-15 16:23:53 -07:00
Justin Bogner
48bad5bbcd
[HLSL] Include SPIRV in LLVM_TARGETS_TO_BUILD in the HLSL cmake cache (#133287)
Since SPIRV is no longer an experimental target this wasn't actually
enabling it any more.
2025-04-08 00:07:15 +09:00
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