Commit Graph

1742 Commits

Author SHA1 Message Date
Doug Gregor
c72d939e46 Revert "[CMake] Explicitly disable LTO if no LTO option is provided (#85621)"
This reverts commit 51d2f2b61d.
2025-12-02 08:29:43 -08:00
Daniel Rodríguez Troitiño
51d2f2b61d [CMake] Explicitly disable LTO if no LTO option is provided (#85621)
When compiling Swift as an LLVM external project (not the non-unified
workflow from the build-script), if one tries to enable LTO for LLVM
projects it will end up affecting Swift and the Swift standard library,
even if the options `SWIFT_TOOLS_ENABLE_LTO` and
`SWIFT_STDLIB_ENABLE_LTO` are disabled or using their default values,
because [HandleLLVMOptions] modifies the `CMAKE_C/CXX_FLAGS` globally.

By setting `-fno-lto` explicitly when those options are disabled or
using their default values, the options from `CMAKE_C/CXX_FLAGS` are
overriden, and the `SWIFT_*_ENABLE_LTO` controls the usage or not of LTO
optimizations and the presence of bitcode in the object files.

[HandleLLVMOptions]:
b58b2a34d5/llvm/cmake/modules/HandleLLVMOptions.cmake (L1278-L1310)
2025-12-01 09:40:59 -08:00
3405691582
0158137afc Supply -z,nobtcfi on x86_64 as well.
On older x86_64 hardware, this isn't a problem since CET IBT hardware
support may not have been available. However, newer x86_64 hardware
supports the feature, which will lead to BTCFI failures. Therefore ensure
the same BTCFI disabling logic applies on x86_64 as well as aarch64.
2025-10-20 21:23:45 -04:00
Rintaro Ishizaki
65505d197b [ASTGen/CMake] Link swiftOnoneSupport in "Debug" build
When building the swift compler with "Debug" configuration, modules
written in Swift must be linked to swiftOnoneSupport. Explicitly link it
as some linker doesn't auto-link it.

rdar://162631685
2025-10-15 09:58:47 -07:00
Mishal Shah
63ef5a0cc7 Bump the Swift version to 6.3 2025-08-14 23:06:49 -07:00
Kavon Farvardin
771c99f895 cmake: add support for bootstrapping with swiftly
For hosts that have a swiftly-managed Swift compiler, we could not
bootstrap using those tools, because of some hardcoded assumptions
about where the `/lib` directory lives, relative to the `/bin`
directory that contains the detected `swiftc`.

This patch adds specific support for detecting when the `swiftc`
is coming from a swiftly install and uses the correct paths.

I've tested this patch on my Linux machine that has swiftly 1.0.1,
with the Swift 6.1.2 toolchain.
2025-08-13 14:41:01 -07:00
Evan Wilde
f009cfa785 FreeBSD: Remove extra '}' in triple
Accidentally included an extra closing brace in the FreeBSD triple.
2025-08-08 14:09:10 -07:00
Evan Wilde
8f3341e7be FreeBSD: Set runtime module triple correctly
LLVM FreeBSD triples include the version number, which gets encoded into
the swiftmodule. The filename should not include the version number
though. This patch drops the version number from the filename, but not
from the target triple.

This fixes several tests which uses the computed target triple as the
flag to pass to `-target`. Since it was missing the version number, the
compiler assumed it defaulted to zero and would report
"compiling for freebsd 0, but module 'Dispatch' has a minimum deployment
target of freebsd 14.3"

Fixes: rdar://156163594
2025-08-07 10:29:26 -07:00
Eric Miotto
0869919eca Test: allow different deployment target versions for tests on Darwin
Currently we are using the same versions we use to build compiler and
standard library. This is an unnecessary coupling especially when
testing the generation of backdeployed executables for macOS -- here
we have interest in being able to run the tests on previous OSes, not
the compiler itself.

To support this, add new `--darwin-test-deployment-version-<platform>`
flags to build-script, which by default take the same value as the
matching `--darwin-deployment-version-<platform>` ones.

Addresses rdar://156724078
2025-07-31 08:19:13 -07:00
Yuta Saito
3a0d5fd0a1 [wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 2025-07-18 02:03:16 +00:00
finagolfin
b2f52524c5 [android] Disable a couple Reflection tests and fix an install path (#82620)
The tests broke on the community Android CI since #82325, and I just
noticed the install issue when cross-compiling Testing with a
freshly-built compiler, which I'd never done before. Also, fix the NDK
path shown in the CMake output.
2025-07-02 09:41:59 +05:30
(null)
9d915c68da libc++ is the default standard library on FreeBSD 2025-06-17 16:13:38 -04:00
Alastair Houghton
df35df17ce [Build] Fix the minimal-stdlib build by setting a deployment version.
We need to set a deployment version, not just blank, because otherwise
we don't know the correct deployment target to use for the standard
library.
2025-06-05 13:09:43 +01:00
Alastair Houghton
d5ed335339 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-06-03 15:01:22 +01:00
Konrad `ktoso` Malawski
31b6ae2fcf Merge pull request #80984 from ktoso/task-names-update
[Concurrency][SE-review update] Task names update
2025-05-28 06:23:49 +09:00
Ian Anderson
0027779029 Merge pull request #81726 from ian-twilightcoder/remove_darwin_overlay
[CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
2025-05-26 12:19:28 -07:00
Ian Anderson
15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07:00
Evan Wilde
fd2ba8b95d Fix the ARM architecture on FreeBSD
The 64-bit ARM architecture spelling on FreeBSD is aarch64, not arm64.
This results in a build failure about a missing
`freebsd/arm64/swiftrt.o` while building the runtimes.
2025-05-20 21:38:41 -07:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
3405691582
79e0b6a7e0 Unconditionally add -z,origin on OpenBSD. (#80897)
This is a little less than ideal, since as I understand it, it only
makes sense to add -z,origin when $ORIGIN expansion is required, but
doing this surgically per target is rather cumbersome. I don't believe
there are any significant drawbacks to doing it unconditionally like
this, however.
2025-04-30 19:46:29 +05:30
Evan Wilde
bca1378fdb SILOptimizer: Disable invalid passes in C++-only compiler
The SimplifyCFG and LoopRotate passes result in verification failures
when built in a compiler that is not built with Swift sources enabled.

Fixes: rdar://146357242
2025-04-21 12:46:01 -07:00
Doug Gregor
607c7c595a Merge pull request #80553 from 3405691582/nobtcfi_part2
Use -z,nobtcfi when BTCFI is disabled on OpenBSD.
2025-04-15 12:43:22 -07:00
3405691582
2c35bca3f8 Use -z,nobtcfi when BTCFI is disabled on OpenBSD.
This was accidentally left off from #80389, and will properly ensure
BTCFI enforcement is disabled on the platform when required.
2025-04-04 18:13:01 -04:00
Jeff
b0bbf921fe cmake: Remove LLVM_ENABLE_ASSERTIONS from Windows cmake cache. 2025-03-24 18:44:41 -07:00
Rintaro Ishizaki
90340a069a Merge pull request #79918 from rintaro/cmake-no-emit-module-separately
[CMake] '-no-emit-module-separately-wmo' for swift modules
2025-03-17 11:38:18 -07:00
Rintaro Ishizaki
ca5a020e21 [CMake] '-no-emit-module-separately-wmo' for swift modules
Emitting modules in separate frontend job doesn't give any benefits
because single add_library is just a single job from CMake's point of
view. Clients need to wait for `.dylib`/`.so` being emitted before using
the `.swiftmodule`. *Not* emitting modules separately is actually faster
in CMake because it doesn't parse and typecheck the source code twice.
2025-03-11 13:33:34 -07:00
Rintaro Ishizaki
860ea2c967 [CMake] Fix package CMO capability chekcing logic
Package CMO requires '-enable-library-evolution' in 6.1+ compilers.
Otherwise:
  <unknown>:0: error: Library evolution must be enabled for Package CMO

rdar://146673779
2025-03-10 11:09:47 -07:00
Yuta Saito
9595425717 Merge pull request #79344 from kateinoigakukun/pr-c16855f8d94328f5545bcc3105985cd5286ce69f
[build] Configure library naming conventions for WebAssembly platforms
2025-02-14 13:32:43 +09:00
Yuta Saito
bf008af355 Merge pull request #79343 from kateinoigakukun/pr-fba68e2574f281558869dcf2006c48d8cf894e99
[build] Add initial support for Emscripten SDK
2025-02-14 13:32:20 +09:00
Yuta Saito
720327727f [build] Configure library naming conventions for WebAssembly platforms
Use the same conventions used in wasi-libc and Emscripten
2025-02-13 00:54:13 +00:00
Yuta Saito
9d4e5b6911 [build] Add initial support for Emscripten SDK
This patch adds initial support for Emscripten SDK alongside the existing
support for WASI SDK. This is a first step towards building a part of
Swift compiler for Emscripten target (which will be used to build LLDB
with Swift to WebAssembly target).
2025-02-13 00:53:45 +00:00
Yuta Saito
6e3d401b41 [build] Stop assuming llvm is always the top-level in unified build
Even with unified build, llvm is not always the top-level project but it
can be a part of a larger build. (e.g. [^1]) In that case,
`CMAKE_BINARY_DIR` is not the binary directory of llvm but the binary
directory of the top-level project. This patch fixes the issue by using
`LLVM_BINARY_DIR` instead.

[^1]: 9b4b907079/extensions/cxx_debugging/CMakeLists.txt (L105)
2025-02-13 00:27:02 +00:00
Hamish Knight
d260bd8ddb [build-script] Remove Xcode generation support
This was quite brittle and has now been superseded
by swift-xcodegen. Remove the CMake/build-script
logic for it, leaving the option behind to inform
users to switch to using xcodegen instead.
2025-02-12 12:19:21 +00:00
Michael Chiu
c6d9efa553 Remove FreeBSD version from SDK triple 2025-02-01 12:05:39 -08:00
Cyndy Ishida
3232df4d67 Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)' (#79018)
* Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)'

    * [BuildSystem] Stop building for i386-watch-simulator

    In Xcode16 it is not supported.

This initially broke client projects who were still building the legacy
architecture but now that's resolved.
2025-01-31 15:04:28 -08:00
Stefan Gränitz
76243a25db [windows][toolchain] Build sanitizers and builtins standalone for all SDKs (#78861)
Unified builds of compiler-rt together with LLVM failed for the Android SDKs. It got too complicated to redirect the way LLVM would configure the nested build-trees. Standalone builds slightly increase build time, but they turned out much simpler and we end up with less duplication of definitions.
2025-01-28 22:08:07 +01:00
Rintaro Ishizaki
6f6742f060 Merge pull request #78622 from rintaro/sanitizer-rdar142516855
[CMake] Globally set sanitizer options for Swift targets
2025-01-28 04:56:44 -08:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Saleem Abdulrasool
4ea5c33224 Merge pull request #78687 from Steelskin/fabrice/add-stdlib-cache-macos
[caches] Add cache files for macOS Runtime builds
2025-01-22 17:00:28 -08:00
Saleem Abdulrasool
7d6ff86132 Merge pull request #78688 from Steelskin/fabrice/use-correct-darwin-arm64-triple
[caches] Use `arm64-apple-darwin` triple
2025-01-22 17:00:02 -08:00
Saleem Abdulrasool
78ec9a7af6 Merge pull request #78774 from compnerd/unknown-silence
build: silence C4067 on Windows (NFCI)
2025-01-22 08:26:16 -08:00
Saleem Abdulrasool
6b58947382 build: silence C4067 on Windows (NFCI)
This silences a warning that the MSVC compiler emits about unknown
pragmas. This helps clear up the build a small amount so real issues do
not get hidden.
2025-01-21 09:37:11 -08:00
Saleem Abdulrasool
c9e4dff925 build: only add compiler flag if it is supported
This ensures that we only add the flag if it is supported by the
compiler rather than doing it unconditionally.
2025-01-21 09:35:24 -08:00
Alastair Houghton
18496c5626 [Backtracing] Remove support for implicit import of _Backtracing.
We're going to rename the module to Runtime, and it isn't going to be an
implicit import, so we don't need any of this.

rdar://124913332
2025-01-17 10:09:36 +00:00
Fabrice de Gans
982f934f0d [caches] Use arm64-apple-darwin triple
`LLVM_DEFAULT_TARGET_TRIPLE` was previously set to
`aarch64-apple-darwin` for Darwin Arm64 platforms. The correct value
should be `arm64-apple-darwin`.
2025-01-16 12:19:48 -08:00
Fabrice de Gans
5d90af9f23 [caches] Add cache files for macOS Runtime builds 2025-01-16 12:11:00 -08:00
Rintaro Ishizaki
84a09071cb [CMake] Globally set sanitizer options Swift targets
For C/CXX targets, sanitizer options are set by 'CMAKE_{C|CXX}_FLAGS' in
HandleLLVMComfig.cmake. However for Swift targets, they are set for each
target. That caused some mismatch issues. Instead set them globally for
Swift targets too.

rdar://142516855
2025-01-13 15:54:39 -08:00
Hiroshi Yamauchi
32832dd1e1 Revert "[windows][toolchain] Enable builtins and sanitizers"
Revert https://github.com/swiftlang/swift/pull/77770

To fix CI https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/785/consoleText
2024-12-06 14:22:30 -08:00
Saleem Abdulrasool
3ab2a3ee4c Merge pull request #77770 from weliveindetail/windows-toolchain-sanitizers
[windows][toolchain] Enable builtins and sanitizers
2024-12-05 15:46:46 -08:00
Cyndy Ishida
1b869ef828 Revert "[BuildSystem] Stop building for i386-watch-simulator" (#77911)
* Revert "[Build] Fix swift_build_support tests."

This reverts commit fc2d1b3b23.

* Revert "[BuildSystem] Stop building for i386-watch-simulator (#77692)"

This reverts commit 1ab968d2b6.

This change can't be made without other issues fixed downstream first.
2024-12-03 23:17:12 -08:00