Commit Graph

1635 Commits

Author SHA1 Message Date
Alejandro Alonso
86fec4011d Cleanup more of the build from Saleem's comments 2021-11-30 15:01:20 -08:00
Jonas Devlieghere
fccbaa8dc7 Merge pull request #40320 from apple/asan+ubsan
[CMake] Fix error: invalid value 'address -sanitize=undefined' in '-s…
2021-11-30 08:48:58 -08:00
Jonas Devlieghere
2f0cd218bf [CMake] Fix error: invalid value 'address -sanitize=undefined' in '-sanitize='
Currently, when having both ASan and UBSan enabled, the compiler is
passed "-sanitize=address -sanitize=undefined" which results in error:
invalid value 'address -sanitize=undefined' in '-sanitize='. Pass the
two flags separately to fix the issue.
2021-11-29 17:10:21 -08:00
Doug Gregor
c4ace6af6a Make sure we define availability macros for standalone library builds
Fixes rdar://85639438.
2021-11-29 11:11:11 -08:00
eeckstein
cbf3c5815b Merge pull request #40285 from eeckstein/libswift-build-fixes
cmake: three fixes for the libswift build
2021-11-29 09:14:02 +01:00
Saleem Abdulrasool
5bf4da88df SILOptimizer: avoid trawling through the directories for includes
Use the include search path for the header search rather than
constructing the path using relative paths.  This is important for
getting the interop to work properly as well.
2021-11-26 09:11:42 -08:00
Erik Eckstein
dbf74b56d2 cmake: need to link swiftrt.o for libswift-executables on linux
Otherwise dynamic metadata/conformance lookup does not work.
2021-11-26 11:54:31 +01:00
Erik Eckstein
61db072617 cmake: fix libswift build dependencies
Unfortunately using the convenient "bootstrapping0-all", etc. custom targets does not work.
For some reason it does not cause a dependent file (like libswift's SIL.o) being rebuilt when a depenency (like swift-frontend from the previous bootstrapping stage) changes.
Instead we have to list al library- and executable-targets explicitly.
2021-11-23 18:33:43 +01:00
buttaface
30c292ca87 [android] Update to NDK 23b (#39921)
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.
2021-11-17 20:58:42 -08:00
Erik Eckstein
83bfa1b0f3 cmake: export the libswift target and the LIBSWIFT_BUILD_MODE that the lldb build can see it. 2021-11-15 17:23:21 +01:00
Saleem Abdulrasool
127874edea Merge pull request #40124 from compnerd/root
build: allow building libswift with unified builds
2021-11-11 08:01:05 -08:00
Saleem Abdulrasool
f57c16700b build: allow building libswift with unified builds
When building with unified builds, `CMAKE_SOURCE_DIR` is not the Swift
repository.  Use the locally defined `SWIFT_SOURCE_DIR` variable to
reference the root of the Swift repository.  Because libswift uses
`project` in the CMakeLists, we cannot use `PROJECT_SOURCE_DIR` here.
2021-11-10 11:56:16 -08:00
Erik Eckstein
3c40ea5d77 cmake: allow more than one dependency for libswift targets 2021-11-10 13:03:49 +01:00
Michael Gottesman
ebafda86d3 Merge pull request #40076 from gottesmm/pr-0da05c4cb7f9d69304b5ee83efb24561958a0a14
[cmake] Add a new component llvm-toolchain-dev-tools and make FileCheck installation use it.
2021-11-09 11:20:13 -08:00
Erik Eckstein
581a41c377 cmake: Don’t add -lobjc in linux builds
Fixes a linux build error.
It doesn’t make sense to let add HAS_LIBSWIFT to add_swift_host_library(). This was added to work around a linker bug (d22b348adb). Instead do the workaround in libSwiftScan/CMakeLists.txt.
2021-11-09 09:16:08 +01:00
Robert Widmann
467c81d269 Merge pull request #39970 from Bo98/libdispatch-tests 2021-11-06 08:52:05 -07:00
Michael Gottesman
8b8abd6fa2 [cmake] Add a new component llvm-toolchain-dev-tools and make FileCheck installation use it.
This will let me reuse toolchain-dev-tools for tools useful in a just built
toolchain but that are from Swift rather than copied from LLVM.
2021-11-05 20:37:54 -07:00
Erik Eckstein
e30688da82 libswift: fix dependencies in the bootstrapping build mode
swiftDarwin and swiftOnoneSupport  didn't depend on building the Swift core library.
This was a subtle bug, because the compiler just picked up the module from the SDK instead of the (still building) Swift module.
It only resulted in compiler errors if the SDK swiftinterface was too new to be parsable by the compiler.
2021-11-05 18:33:21 +01:00
Erik Eckstein
09552abc44 libswift: improve the bootstrapping-with-hostlibs build mode
Don't build the swiftCore module files in the bootstrapping phases. Instead use the module files in the SDK.
This reduces the build time overhead from 3min -> 30seconds.
2021-11-05 18:32:25 +01:00
Erik Eckstein
78c4c3ff6d libswift: fixes for the linux bootstrapping build 2021-10-29 08:56:02 +02:00
Bo Anderson
6be2b40fdd [build] correct libdispatch test flag 2021-10-29 03:42:19 +01:00
Saleem Abdulrasool
cd610b83fa Merge pull request #39952 from apple/compnerd/foreign-cross-compiling
Update SwiftWindowsSupport.cmake
2021-10-28 16:51:36 -07:00
Saleem Abdulrasool
cca131258a Update SwiftWindowsSupport.cmake
Do not attempt to use a cross-compiled compiler for a foreign target.  This is not guaranteed to work (e.g. building for ARM on x64).  This at least surfaces the error properly.
2021-10-28 09:22:09 -07:00
Josh Learn
40da89c89d Undefine IB macros when building libswift 2021-10-27 14:51:38 -07:00
Artem Chikin
ec1ab7128c Merge pull request #39822 from artemcm/TryEarlyDriverCopyNoSymlink
[SR-15135] Copy over early `swift-driver` executable to the build dir instead of creating a symlink
2021-10-22 16:47:18 -07:00
Artem Chikin
f8427829dc [SR-15135] Copy over early swift-driver executable to the build dir instead of creating a symlink
The SwiftDriver searches `swift-frontend` based on `Bundle.main.executablePath` (which internally uses `CFGetProcessPath`). This search dir is resolved differently on macOS and Linux so swift-frontend can't be found on Linux, forcing the driver to fallback to using the host system toolchain instead of the just-built one.
2021-10-22 13:57:19 -07:00
Erik Eckstein
4383610ed3 cmake: some fixes for the libswift bootstrapping build
* fix a typo which prevented linking the right bootstrapping libs
* build swiftDarwin for bootstrapping
* disable COW checks if built with bootstrapping-with-hostlibs
2021-10-19 13:10:59 +02:00
Saleem Abdulrasool
15a5d2c54b Revert "[android] Update to NDK 23" 2021-10-16 11:07:23 -07:00
Butta
7fa1b4b2ac [android] Update to NDK 23
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.

Also, add the libatomic dependency for Android armv7, just as on linux.
2021-10-12 12:37:01 +05:30
Erik Eckstein
af71088d29 libswift: bootstrapping build
Adding build modes for libswift: off, hosttools, bootstrapping, bootstrapping-with-hostlibs
The two bootstrapping modes are new. For details see libswift/README.md
2021-09-28 18:51:42 +02:00
Konrad `ktoso` Malawski
e7342eb878 Merge pull request #39365 from kateinoigakukun/katei/fix-coop-executor-part-2
[Concurrency] repair cooperative executor and its tests
2021-09-27 09:47:09 +09:00
Zoe Carver
6300b8b4f8 Merge pull request #39356 from zoecarver/cxx-interop-lib-swift
[cxx-interop][libswift] Use `std::string` instead of `BridgedStringRef` 🚀
2021-09-23 15:06:19 -04:00
zoecarver
f063701f84 [cxx-interop][libswift] Use std::string instead of BridgedStringRef.
The first C-bridge to be removed! 🚀
2021-09-22 16:13:44 -07:00
Yuta Saito
1b56c037a3 [test] fix runtime unittests for single threaded runtime
Some headers switch their inline implementations based on
SWIFT_STDLIB_SINGLE_THREAD_RUNTIME definition.
This fixes linking failure while building runtime unittests
2021-09-19 14:37:29 +00:00
zoecarver
25e5bc22e6 [cxx-interop][libswift][build] Enable C++ interop when building libSwift 2021-09-17 18:00:13 -07:00
Max Desiatov
a723e6d4c2 CMake: disable libdispatch when targeting Wasm/WASI (#39274)
Wasm/WASI doesn't currently support multi-threading, and libdispatch should be disabled when building for this target.

Related to SR-12097.
2021-09-15 18:00:13 +01:00
Max Desiatov
8cd8ca01ad CMake: clean up WASI SDK sysroot paths (#39275)
Paths to WASI SDK sysroot should not assume `/share/wasi-sysroot` directory hierarchy. It's much more flexible to have this part hidden under the more general `SWIFT_WASI_SYSROOT_PATH` variable.
2021-09-13 16:36:10 +01:00
Saleem Abdulrasool
7aa00e889c build: repair the sub-build for libdispatch on Windows i686
When building on Windows i686 with a toolchain build for Windows x64, we
would try to build libdispatch for i686 as x86_64.  This obviously would
be incorrect.  Explicitly pass the target triple for the sub-builds.  We
can do this unconditionally since we always use `clang-cl` builds.  This
allows us to build the SDK only components for Windows i686 from a 64bit
build.
2021-08-30 13:48:40 -07:00
Argyrios Kyrtzidis
8224df3bb2 Merge pull request #38913 from akyrtzi/link-with-demangle-along-with-support
[cmake/AddSwift] When `support` is passed for LLVM_LINK_COMPONENTS also implicitly include `demangle`
2021-08-27 14:19:58 -07:00
Doug Gregor
3f749dc13b Add an option to build the concurrency library for back deployment.
Introduce an additional build product to build-script to build
back-deployable concurrency libraries. These libraries would need to
be embedded in apps deployed prior to macOS 12/iOS 15 to support
concurrency.

The built-script option `--back-deploy-concurrency` can be provided to
build these back-deployment libraries. They are built in addition to
the normal concurrency libraries, as a separate product that installs
into `lib/swift-5.5/<platform>` within the toolchain. The macro
`SWIFT_CONCURRENCY_BACK_DEPLOYMENT` is set when building the
concurrency library, so that we can adapt the implementation to older
OS's.
2021-08-26 08:49:43 -07:00
Kuba (Brecka) Mracek
c079c0897b Split SWIFT_DARWIN_PLATFORMS and SWIFT_APPLE_PLATFORMS in CMake. SWIFT_APPLE_PLATFORMS may contain 'FREESTANDING' when building the freestanding SDK and SWIFT_FREESTANDING_FLAVOR is set to 'apple'. (#38997) 2021-08-23 19:16:28 -07:00
Kuba (Brecka) Mracek
750ba09ef4 Introduce SWIFT_FREESTANDING_FLAVOR to select whether the FREESTANDING stdlib should be built/tested using an Apple SDK, or another SDK (e.g. Linux, not implemented yet) (#34450) 2021-08-19 15:56:04 -07:00
Argyrios Kyrtzidis
dea7f9f1c3 [cmake/AddSwift] When support is passed for LLVM_LINK_COMPONENTS also implicitly include demangle
Using `support` llvm component ends up adding `-Xlinker /path/to/lib/libLLVMDemangle.a`
to `LINK_FLAGS` but `libLLVMDemangle.a` is not added as an input to the linking ninja statement.
As a workaround, in order to setup precise inputs for the ninja link statement, include `demangle` component
whenever `support` is mentioned.
2021-08-17 14:54:09 -07:00
Argyrios Kyrtzidis
00d3f7d2d4 [CMake] Add some missing dependencies of the gyb custom command invocations 2021-08-16 15:24:02 -07:00
Argyrios Kyrtzidis
35f0744b1c [CMake] Declare the precise dependencies of the gyb custom command invocations 2021-08-10 13:51:54 -07:00
Xi Ge
d22b348adb cmake: add a workaround to rdar://77839981 2021-07-14 10:02:27 -07:00
Dario Rexin
7ed4ccf538 Merge pull request #37231 from 3405691582/DispatchGoesInLibSubdir
[cmake] Copy Dispatch to the SDK subdir on host.
2021-07-12 09:28:22 -07:00
Alastair Houghton
4b1978cff5 Merge pull request #38023 from al45tair/sr-14813
[SR-14813] [Fuzzers] Fix the mangler and reflection fuzzer build.
2021-06-29 09:38:45 +01:00
Michael Gottesman
c5fe4f0c18 [cmake] Add the SDK directory after the toolchain directory when compiling host swift code.
This ensures that we pick up libraries from the toolchain before picking up
libraries from the SDK we are using. Normally it would not matter the order that
we add these -L files since the contents of the SDK and toolchain are
disjoint. Once we begin performing stage2 swift builds though, we no longer have
this property since we pass in the stage1's installed libraries as the SDK
directory and we have not split the two sets of libraries yet. The end result is
that if we have the -L in the previous order, we will pick up just built
compatibility libraries before we pick up the actual compatibility libraries
from the actual toolchain we are using to compile. This results in compilation
breakage.
2021-06-27 16:40:19 -07:00
Evan Wilde
849ee7ac5e Merge pull request #37958 from etcwilde/ewilde/pass-sanitizer-flags-to-swift
Pass sanitizer flags to swift driver
2021-06-24 06:48:09 -07:00