Commit Graph

443 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
c63a93c37a Add SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS and SWIFT_STDLIB_EXTRA_C_COMPILE_FLAGS CMake options (#40171) 2021-11-15 10:27:50 -08: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
Kuba (Brecka) Mracek
367b4c1355 Enable -experimental-hermetic-seal-at-link for the stdlib on 'freestanding' (#39961) 2021-11-02 10:05:33 -07:00
Karoy Lorentey
2732765096 [CMake] Introduce availability macros for all known stdlib releases
Introduce "SwiftStdlib x.y"-style availability macros for all known releases of the stdlib, adding them to the swift flags of all Swift libraries and tests.
2021-10-28 18:31:54 -07:00
Doug Gregor
c9e1032480 Remove underscores from CFBundleIdentifier of libraries.
Underscores aren't permitted in these identifiers.
Fixes rdar://84645973.
2021-10-26 20:57:19 -07:00
Saleem Abdulrasool
15a5d2c54b Revert "[android] Update to NDK 23" 2021-10-16 11:07:23 -07:00
swift-ci
46f3cc9dd8 Merge pull request #39045 from buttaface/android-ndk-23 2021-10-15 20:55:19 -07:00
Kuba (Brecka) Mracek
99a24d47be Introduce a CMake flag to disable fast-path context descriptor lookup based on short manglings (#39729) 2021-10-14 08:08:07 -07:00
Kuba (Brecka) Mracek
557bf685be Don't include support for old mangling in runtimes without ObjC interop (#39675) 2021-10-13 19:47:05 -07:00
Kuba (Brecka) Mracek
7538949859 Split out CommandLine enum into a separate static library, allow removing it from stdlib (#39591)
This is for the 'freestanding' build to stop assuming the platform has argc/argv.

- Introduce a new sub-library, libswiftCommandLineSupport.a
- Move stubs/CommandLine.cpp into this library
- Conditionally embed it into libswiftCore
- Conditionally embed it into libswiftPrivateLibcExtras if not in libswiftCore to support testing
- Add SWIFT_STDLIB_HAS_COMMANDLINE CMake (and build-script) flag
2021-10-13 07:02:43 -07:00
Kuba (Brecka) Mracek
5ff64f8443 Introduce a CMake option to disable MetadataAllocator and use malloc+free instead, use it for freestandning preset (#39678) 2021-10-12 16:20:08 -07:00
Kuba (Brecka) Mracek
1147d08ae3 Disable stable ABI on freestanding stdlib (#39674) 2021-10-12 15:25:57 -07:00
Kuba (Brecka) Mracek
c2c1bfb053 Add SWIFT_STDLIB_HAS_ENVIRON to remove usage of getenv/environ from stdlib (#39599) 2021-10-12 07:16:36 -07:00
Kuba (Brecka) Mracek
653642df75 Add a SWIFT_STDLIB_HAS_DARWIN_ASL config flag to allow removing asl_log() usage in freestanding build (#39584) 2021-10-12 07:14:33 -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
Kuba (Brecka) Mracek
ca0dff803b Turn existing ifdefs around backtrace() API into a CMake SWIFT_SUPPORTS_BACKTRACE_REPORTING flag (#39598) 2021-10-06 14:46:08 -07:00
Meghana Gupta
83c023446a Use -enable-ossa-modules for all of stdlib/public (#39478)
With this, even non-transparent functions will have their ownership eliminated later in the pipeline
2021-09-30 10:20:08 -07:00
Kuba (Brecka) Mracek
c2a92722c6 Split the NO_DYLD CMake flag into separate HAS_DLADDR and STATIC_IMAGE_INSPECTION flags (#39339) 2021-09-29 19:57:05 -07:00
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
Alastair Houghton
8be084f30a Merge pull request #39187 from al45tair/problem/79725187
[Demangler] Improve remangler error handling
2021-09-27 17:03:49 +01:00
Egor Zhdan
e1c4ea50c8 Merge pull request #37806 from egorzhdan/clang-executable-path-reapply
ClangImporter: run Clang with a proper executable path (pt 2)
2021-09-24 21:46:03 +03:00
Kuba (Brecka) Mracek
6766824d51 Add a SWIFT_STDLIB_HAS_STDIN flag to compile out the Swift.readLine() API from the stdlib (for the 'freestanding' preset) (#39332) 2021-09-17 10:42:14 -07:00
swift-ci
6738c3e148 Merge pull request #39269 from akyrtzi/cmake-stdlib-line-directive-depends 2021-09-12 19:50:47 -07:00
Argyrios Kyrtzidis
f72cf2bdb5 [SwiftSource.cmake] Include the line-directive tool and its input as dependencies of the custom command 2021-09-12 16:40:03 -07:00
Argyrios Kyrtzidis
90448e77e1 [AddSwiftStdlib.cmake] Add the info.plist file as link dependency 2021-09-12 16:17:47 -07:00
Kuba (Brecka) Mracek
404badb49a Introduce SWIFT_ENABLE_REFLECTION to turn on/off the support for Mirrors and reflection (#33617) 2021-09-08 13:08:13 -07:00
Alastair Houghton
227b438963 [Demangling] Added DEMANGLER_ASSERT to replace assert() calls.
This returns an error code if we're in the runtime, rather than assert()ing.

rdar://79725187
2021-09-06 17:49:50 +01:00
Arnold Schwaighofer
a864d4ed04 Don't enable GlobalISel on arm64e
It is not well supported

rdar://82082527
2021-08-30 13:06:49 -07:00
Doug Gregor
9d4ce58ed6 Merge pull request #38930 from DougGregor/concurrency-compatibility-library
[concurrency] Implement a compatibility .a library for Concurrency.
2021-08-28 22:40:37 -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
bcbe8e7bff Remove SWIFTLIB_SINGLE_TARGET_LIBRARY (#38978)
* Remove SWIFTLIB_SINGLE_TARGET_LIBRARY

* Use NOSWIFTRT on BlocksRuntime
2021-08-24 07:46:43 -07:00
Kuba (Brecka) Mracek
aaff37ffb8 Add a SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC flag to allow/disallow uses of Darwin libmalloc APIs (malloc_default_zone, malloc_zone_malloc, etc.) (#33812) 2021-08-23 19:37: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
47f156fb21 Apply the CMake Apple Silicon workaround for the 'FREESTANDING' SDK too (#38956) 2021-08-21 14:31:07 -07:00
Kuba (Brecka) Mracek
14b3b38c53 Make SWIFT_STDLIB_ENABLE_LTO flag apply LTO to C/C++ compile flags too (#38959) 2021-08-21 14:30:42 -07:00
Kuba (Brecka) Mracek
2fad6265fe When building stdlib, pass -prespecialize-generic-metadata from CMake, and respect the flag in IRGenModule::shouldPrespecializeGenericMetadata (#38946) 2021-08-20 07:58:39 -07:00
Michael Gottesman
1bc94bfa6a [concurrency] Implement a compatibility .a library for Concurrency.
In a back deployment scenario, this will provide a place where one could provide
function implementations that are not available in the relevant stdlib.

This is just setting up for future work and isn't doing anything interesting
beyond wiring it up/making sure that it is wired up correctly with tests.
2021-08-18 09:35:37 -07:00
Arnold Schwaighofer
71f64ac348 Add option to enable global-isel on arm64 archs
LLVM will eventually switch over to using global-isel on arm64 archs.
Setting this option (SWIFT_ENABLE_GLOBAL_ISEL_ARM64) can be used to experiment
with that in Swift before the switch happens.
2021-08-17 13:41:46 -07:00
Argyrios Kyrtzidis
35f0744b1c [CMake] Declare the precise dependencies of the gyb custom command invocations 2021-08-10 13:51:54 -07:00
Mishal Shah
3722bcb85a Revert "[concurrency] Implement a compatibility .a library for Concurrency." 2021-07-29 11:26:51 -07:00
Michael Gottesman
8441871a04 [concurrency] Implement a compatibility .a library for Concurrency.
In a back deployment scenario, this will provide a place where one could provide
function implementations that are not available in the relevant stdlib.

This is just setting up for future work and isn't doing anything interesting
beyond wiring it up/making sure that it is wired up correctly with tests.
2021-07-23 17:30:18 -07:00
Eric Miotto
ec912086b8 [gardening] break long comment lines (#38444)
Takes review feedback from #38415
2021-07-19 07:50:19 -07:00
Eric Miotto
66bd9f80b4 [build] explicitly set OSX_ARCHITECTURES for targets in stdlib
Our custom build code already sets the architecture of compilation
commands by different means, and so far we were relying on setting
`CMAKE_OSX_ARCHITECTURES` to an empty value to avoid CMake doing the
same.

However, on Apple Silicon, CMake 3.19+ enforces a default value in this
scenario
(https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291/diffs),
and this would result in the inability to compile code for x86_64.

Addresses SR-14035, rdar://80613594
2021-07-15 15:18:43 -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
Saleem Abdulrasool
c0300296a7 Revert "[CMake] Better dependency checking" 2021-07-02 14:44:14 -07:00
David Zarzycki
1bbce7cf81 [CMake] Better dependency checking 2021-06-29 11:01:27 -04:00
Michael Gottesman
c0d6d8f190 [cmake] Respect SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER when compiling the stdlib if SWIFT_NATIVE_SWIFT_TOOLS_PATH is not set and CMake_Swift_COMPILER is.
Previously, no matter if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER was set, we
would use for swiftc SWIFT_NATIVE_SWIFT_TOOLS_PATH/bin/swiftc. This is correct
assuming that the user always passed in that flag. This will no longer always be
true since we are attempting to transition the stdlib slowly to use more
standard cmake. Instead, in that case if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
is set and SWIFT_NATIVE_SWIFT_TOOLS_PATH is not set /and/ we have a
CMAKE_Swift_COMPILER, we just use CMAKE_Swift_COMPILER. Hopefully with time we
get rid of SWIFT_NATIVE_SWIFT_TOOLS_PATH.
2021-06-27 16:40:20 -07:00
Egor Zhdan
64113270df ClangImporter: run Clang with a proper executable path (pt 2)
This change re-applies https://github.com/apple/swift/pull/36749 after it has been reverted in https://github.com/apple/swift/pull/37805 because of a broken standalone stdlib build.
2021-06-22 22:28:55 +03:00
3405691582
c0c93fa0bc [cmake] Copy Dispatch to the SDK subdir on host.
We have two directories for Swift libraries,
* `SWIFT_SDK_<platform>_LIB_SUBDIR`, a.k.a., the SDK subdir,
  a.k.a., `swift-<platform>-<arch>/lib/swift/<platform>`, and
* `SWIFTLIB_SINGLE_SUBDIR`,
  a.k.a., `swift-<platform>-<arch>/lib/swift/<platform>/<arch>`.

Through the Swift build, libraries are emitted to both
`.../lib/swift/<platform>` and `.../lib/swift/<platform>/<arch>`.
However, when building toolchains, only `.../lib/swift/<platform>/` is
populated with libraries.

None of this normally isn't a problem; the Swift libraries do not have
inherent interdependencies. This however changes with Concurrency:
Concurrency has an implicit dependency on libdispatch.

When Swift is built, we have two copies of `libswift_Concurrency.so`:
one in `.../lib/swift/<platform>` and one in
`.../lib/swift/<platform>/<arch>`. Prior to this commit, we
unconditionally copy `libdispatch.so` and `libBlocksRuntime.so` to only
_one_ place -- that is, `.../lib/swift/<platform>/<arch>`.

swiftc emits binaries on ELF systems with an rpath of
`.../lib/swift/<platform>`. These binaries implicitly import
Concurrency, so they link against `libswift_Concurrency.so` (whether
they use Concurrency features or not). The library's `$ORIGIN` is
searched to find `libdispatch.so`.

Now, nothing breaks on Linux because there the loader, when given an
rpath, searches both `.../lib/swift/<platform>` and
`.../lib/swift/<platform>/<arch>` even though the rpath only specifies
one directory..

However, on other platforms, only the given rpath is searched.
`libdispatch.so` does not reside next to `libswift_Concurrency.so`
because it has been copied to  `.../lib/swift/<platform>/<arch>`; not in
the rpath.

There are a few ways to solve this: change the way rpaths are
configured, only emit libraries into one place, copy `libdispatch.so`
only to the path matching the rpath, or copy `libdispatch.so` wherever
`libswift_Concurrency.so` is copied,

Because the toolchain file layout is different to the file layout when
only Swift is built, hacking the rpath is brittle. Presumably, the
reason why we have a `libswift_Concurrency.so` residing in two places is
to support builds where multiple architectures are supported in the one
build directory, so we cannot just copy `libdispatch.so` _only_ to
`.../lib/swift/<platform>`.

Ultimately, We need to ensure that every instance where
`libswift_Concurrency.so` can be used has `libdispatch.so` residing next
to it, which we do here.

Note that this implicit dependency resolution would not happen unless we
added a `-ldispatch` flag to make this all work, but other platforms are
instaed using `$ORIGIN` to get the search to work properly, so we also
do this for OpenBSD in this commit.
2021-06-08 22:20:47 -04:00
Saleem Abdulrasool
fe870d005a Revert "ClangImporter: run Clang with a proper executable path" 2021-06-05 16:13:40 -07:00