Commit Graph

826 Commits

Author SHA1 Message Date
swift-ci
601e353c81 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-16 00:34:21 -08:00
Doug Gregor
52b64e53ae [SourceKit] Make sure we link the compiler plugin support library 2022-11-15 20:52:40 -08:00
Doug Gregor
c0d53c4a47 [CMake] Fixup build for compiler plugin support library 2022-11-15 19:32:20 -08:00
swift-ci
662f51f7db Merge remote-tracking branch 'origin/main' into rebranch 2022-11-10 06:54:04 -08:00
Eric Miotto
21c0c465c6 [rebranch] Adapt to new signature for llvm_install_symlink...
and match the usage pattern employed by other LLVM projects.

For context about the underlying change see  https://reviews.llvm.org/D117977

Addresses rdar://101396797

(cherry picked from #61769, commit 2763cc3911)
2022-11-04 20:44:18 +01:00
Matt Jacobson
61cf0970a1 build: support bootstrapped build on FreeBSD
Fixes failures to link and run the bootstrapping1 compiler.
2022-11-03 17:34:26 -04:00
Doug Gregor
962e330e9a [CMake with Swift] Add toolchain lib path for stage != 0 bootstrapping builds.
Fixes a linker failure where we cannot find the compatibility libraries.
2022-09-27 14:40:21 -07:00
Doug Gregor
c50d16634d [CMake with Swift] Set rpath for stage != 0 bootstrapping builds. 2022-09-23 09:19:54 -07:00
Alex Hoppen
b1040649f2 Merge pull request #61226 from ahoppen/ahoppen/move-gyb-syntax-support
Move gyb_syntax_support in swift-syntax from Sources/generate-swift-syntax-builder to Code-Generation
2022-09-23 14:17:44 +02:00
Alex Hoppen
3bb4d4d65d Move gyb_syntax_support in swift-syntax from Sources/generate-swift-syntax-builder to Code-Generation 2022-09-23 11:04:27 +02:00
Doug Gregor
328fcdf754 [CMake] Bootstrap stagae 0 also needs the host Swift libraries 2022-09-22 19:09:11 -07:00
Doug Gregor
c50b142a14 [Build] Ensure that we link in SwiftSyntax and Swift for all executables 2022-09-22 12:03:19 -07:00
Doug Gregor
b247c6d9f3 Enable build of Swift Swift parser even when bootstrapping is OFF.
The Swift Swift parser doesn't require any bootstrapping, so allow it to
be built even when bootstrapping is off.
2022-09-07 17:52:21 -07:00
Evan Wilde
0d1c33674c Merge pull request #60711 from etcwilde/ewilde/reapply-backdeploy56
Revert reverting the 5.6 backdeploy
2022-09-06 14:58:17 -07:00
Doug Gregor
9e387148d1 Ensure to link unit tests against the Swift libraries when using the new parser 2022-09-01 11:57:35 -07:00
Evan Wilde
312d392d16 Include host compatibility library build directory
The SDK doesn't have the new compatibility library and the
crosscompile-with-hostlibs bootstrap configuration is failing.

This bootstrap configuration is the only one that does not fall back on
the host built compatibility libraries if it is not available in the
SDK.
2022-09-01 10:07:47 -07:00
Doug Gregor
5ea5f3b45d Optional support for round-trip testing the new Swift parser.
When enabled, compile in support for round-trip testing the new
SwiftSyntax-provided Swift parser alongside the existing parser. Right
now, this means parsing every source file with the new parser and
ensuring that the resulting syntax tree can reproduce the input source
precisely. Over time, this is expected to grow.

Opt in to this behavior by passing the following to build-script:

    build-script --early-swiftsyntax --extra-cmake-options=-DSWIFT_SWIFT_PARSER_MODE:STRING=ROUNDTRIP
2022-09-01 08:56:22 -07:00
Robert Widmann
f9cff13604 Move All the Gyb Support for Syntax out of Swift
Make libSyntax depend on swift-syntax: the new home for all
of this infrastructure. This greatly simplifies the addition and
amending of syntax nodes as only the swift-syntax paired with a
swift checkout will need to be changed. This is in contrast to
the existing build flow where a paired PR to both repos must be
made to change anything here.

Note that a paired PR may still be required if the legacy parser
needs to be adjusted in response to syntax nodes changing, but I
anticipate this to be a much more infrequent event now that
the C++ end of libSyntax is deprecated.
2022-08-31 13:10:24 -07:00
Eric Miotto
b6878ce752 Link all compatibility libraries when cross compiling and bootstrapping (#60728)
Refactor the logic so to have a single target to reference the
compatibility libraries for the host, and use that when needed.

The main driver for this change is supporting the cross-compilation of
x86-64 on Apple Silicon.

Supports rdar://90307965
2022-08-31 02:18:19 -07:00
Alastair Houghton
b5735559eb [Threading] Fix threading package defaults.
These are better done via the SwiftConfigureSDK mechanism rather than
how I was doing them previously.  Additionally, I've changed the way
that the swift-threading-package option works.  In addition to
specifying just a single package name, you can specify it as a CMake
list (i.e.  separate by semicolons) of colon-separated `sdk:package`
pairs, e.g.  `osx:darwin;linux:pthreads`.  You can also override it
for all SDKs and then specify for a given SDK; specifications for a
particular SDK take precedence over the global override.  For instance
`pthreads;osx:darwin` says to use `pthreads` except on the OS X SDK
where we should use `darwin`.
2022-06-30 16:07:00 +01:00
Alastair Houghton
a9fe9716da Merge pull request #59287 from al45tair/eng/PR-90776105-2
[Build][Runtime] Add a new threading library.
2022-06-09 02:41:53 -07:00
Alastair Houghton
f5bdb858e0 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-06-07 07:39:51 +01:00
Rintaro Ishizaki
9f4ce612a2 [SwiftCompilerModules] Link lib_InternalSwiftSyntaxParser to libswift
To use _RegexParser from SwiftSyntax.

* Create 'libswiftCompilerModules_SwiftSyntax.a' which is a subset of
  'libswiftCompilerModules.a'
* Link 'lib_InternalSwiftSyntaxParser' to
  'libswiftCompilerModules_SwiftSyntax.a'
* Factor out swift runtime linking logic in CMake so that dynamic
  libraries can link to Swift runtime, in addition to executables
* Link 'lib_InternalSwiftSyntaxParser' to swift runtime
2022-06-02 12:23:03 -07:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
63a09007a1 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-05-24 14:57:39 +01:00
Egor Zhdan
6332edb98b Merge pull request #42297 from apple/egorzhdan/libswift-std-string
Reapply [cxx-interop][libswift] Use `std::string` instead of `BridgedStringRef`
2022-05-05 16:42:06 +01:00
Josh Soref
b5b33d42f0 Spelling cmake (#58569)
* spelling: and

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intentionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simulator is

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-04 19:23:16 -07:00
Egor Zhdan
67a28c78d5 [cxx-interop][SwiftCompilerSources] Enable libstdc++ on platforms that use it
Since libstdc++ doesn't come with a Clang modulemap, Swift provides its own modulemap for libstdc++. This change makes the modulemap available while building SwiftCompilerSources.
2022-05-03 19:48:14 +01:00
Eric Miotto
c43f60a219 Use the correct platform toolchain folder... (#58416)
...when bootstrapping with hosttools.

This would align with how the SDK path is calculated.

Addresses rdar://92298536
2022-04-27 14:50:25 -07:00
Alsey Coleman Miller
b85e673a78 [stdlib] Added Armv5 support 2022-03-06 00:56:32 -05:00
Eric Miotto
f417630054 Add option to reduce build times when using ThinLTO and ld64 (#41058)
Internal configurations targeting Darwin employ ThinLTO to
improve compiler performance, however using it on all executable
causes build time to increase with no matching benefit.

To reduce build times in such configurations, we allow some
ancillary targets to opt out of LLVM IR optimizations when linking
ThinLTO with ld64 (e.g. tools used for bootstrapping or debugging the
Swift compiler) -- this behaviour is opt in through a new flag
`--swift-tools-ld64-lto-codegen-only-for-supporting-targets`.

Addresses rdar://76702687
2022-02-09 08:22:02 -08:00
Eric Miotto
64bc16abd5 [CMake] set target architecture for Darwin idiomatically (#41059)
Previously we were setting `-arch` explicitly and unsetting
`CMAKE_OSX_ARCHITECTURES`; however this approach does not work when
building on Apple Silicon, since in there CMake 3.19+ enforces a default
value
(https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291/diffs),
and this would result in the inability to compile code for x86_64.

This is a similar approach used for stdlib targets in #38415

Addresses rdar://88100025
2022-01-31 12:46:53 -08:00
Alexander Smarus
4cc528d844 [cmake] Add support for external clang/clang-cl
We need an option to pass external host clang location in case
we can't use just-built clang, e.g. when we are building for
different target architecture.

Also, this adds target options for clang-cl, enabling us to
build for arm64 on Windows@amd64.
2022-01-17 16:50:06 +02:00
Erik Eckstein
3d33f11e6c cmake/build-script: rename the libswift option to "bootstrapping"
In cmake, rename LIBSWIFT_BUILD_MODE to BOOTSTRAPPING_MODE.
Also, rename the lit feature "libswift" to "swift_in_compiler".
2021-12-22 11:31:52 +01:00
Erik Eckstein
ba364a17ef libswift: rename cmake targets and functions
libswift -> swiftCompilerModules or swiftCompilerSources
2021-12-22 11:31:52 +01:00
Michael Ilseman
7bff9da67d Revert "Revert "Merge pull request #40595 from hamishknight/straw-bales"" 2021-12-19 10:08:48 -07:00
Arnold Schwaighofer
9511994e52 Revert "Merge pull request #40595 from hamishknight/straw-bales"
This reverts commit a67a0436f7, reversing
changes made to 9965df76d0.

This commit or the earlier commit this commit is based on (#40531) broke the
incremental bot.
2021-12-18 11:02:37 -08:00
Richard Wei
300cbaba31 Integrate experimental string processing modules and enable end-to-end regex.
- Checkout apple/swift-experimental-string-processing using a tag.
- Build `_MatchingEngine` as part of libswift (`ExperimentalRegex`) using sources from the package.
- Parse regex literals using the parser from `_MatchingEngine`.
- Build both `_MatchingEngine` and `_StringProcessing` as part of core libs using sources from the package.
- Use `Regex<DynamicCaptures>` as the default regex type until we finalize apple/swift-experimental-string-processing#68.
2021-12-17 10:33:07 +00:00
Alexander Smarus
8eaaace5ae cmake: Windows, adjust compiler identification on compiler swap
The latest CMake on Windows doesn't add `_CRT_USE_BUILTIN_OFFSETOF`
flag after we swap the compiler to clang-cl for targets like SourceKit. Also
`_add_host_variant_c_compile_flags` doesn't do so, because compiler
identification still points to MSVC compiler.

`_CRT_USE_BUILTIN_OFFSETOF` flag is necessary for `offsetof` calls to be
accepted as an integral constant expression.

This patch adjusts compiler identification on compiler swap and also
addresses some configuration issues related to clang-cl.
2021-12-14 18:58:41 +02:00
eeckstein
307251a803 Merge pull request #40421 from eeckstein/remove-host-swiftlib-support
cmake: remove support for non-libswift swift support in host libraries/executables.
2021-12-07 09:32:30 +01:00
eeckstein
1b2ac8cccb Merge pull request #40277 from buttaface/boot
libswift: add support for Android and OpenBSD in the CMake config
2021-12-06 20:10:31 +01:00
Erik Eckstein
6199876be7 cmake: remove support for non-libswift swift support in host libraries/executables.
This is not needed anymore because all swift code will be contained in libswift.
Also, remove the corresponding tests.
2021-12-05 19:06:00 +01:00
Erik Eckstein
1bf49ae9c8 cmake: fix a wrong library search directory order when building swift-frontend with bootstrapping 2021-12-02 19:57:35 +01:00
Butta
4c493ef5d3 libswift: add support for Android and OpenBSD in the CMake config
Add a new libswift build mode for cross-compilation in the process, that currently
only works for non-Darwin hosts.
2021-12-01 15:27:40 +05:30
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
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
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