Commit Graph

1468 Commits

Author SHA1 Message Date
Alex Hoppen
ef8e4ac0f3 [AST] Remove gyb_syntax_support
We are no longer using these Python files to generate anything in SwiftSyntax. We can just remove them and instead commit the generated `.def` files.
2023-08-01 17:20:14 -07:00
Evan Wilde
669285fd17 Merge pull request #65534 from stephank/fix/cmake-3.25
build: fix accidental cmake expansions
2023-07-24 09:44:14 -07:00
AlexDenisov
a5f2f76716 CMake: expose Swift version through CMakeConfig.cmake (#67152)
Rationale: we are using Swift compiler as a library in a downstream project and having these exposed would streamline version detection for our use case.
Additionally, this PR makes CMake config a bit more uniform with LLVM/Clang configs.
2023-07-22 13:12:15 -07:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Alastair Houghton
e5ece81cc9 [Freestanding] Remove uses of stat() and dlsym().
We shouldn't be using stat() or dlsym() in the freestanding
runtime.

rdar://111214571
rdar://106555012
2023-06-23 17:05:59 +01:00
Alastair Houghton
4f4d0147ca Merge pull request #66721 from al45tair/eng/PR-110665213
[Threading][TSan] Fix TSan errors from lazy init on Linux.
2023-06-22 20:03:00 +01:00
Saleem Abdulrasool
53e4e19e71 build: add a workaround for ARM64 Windows
MSVC 17.6p3 introduced new ARM64 intrinsics for atomic
(load-acquire/store-release) operations.  Since clang does not support
this yet, force the fallback path to temporarily unblock the build while
we implement support for the `__stlr[8|16|32|64]` intrinsics in clang.

See: llvm/llvm-project#62103
2023-06-21 22:08:59 -04:00
Alastair Houghton
3f0018df97 [Threading][TSan] Fix linkage issue.
We need to pick up the `_swift_tsan_xxx` symbols from libswiftCore in
most cases, but sometimes we're statically linked and in that case we
want to use a local copy.

rdar://1106655213
2023-06-19 17:24:35 +01:00
Max Desiatov
8499aa044c SwiftConfigureSDK.cmake: support freebsd-arm64 2023-06-15 01:11:47 +01:00
Ben Barham
b0b9705ae0 [CMake] Prevent rebuilds of pure swift libraries and executables
`.swiftmodule` is listed as an output of pure swift libraries, but it
isn't updated if there's been no changes (just like the library and
its object files). Add it to the touch hack as well.

Swift *executables* also list `.swiftmodule` as an output, even though
one isn't generated at all. Add a new POST_BUILD command to touch it
regardless.
2023-06-08 20:43:40 -07:00
Ben Barham
7dcebb249c [CMake] Allow install_name_tool to edit pure swift library load paths 2023-06-06 14:02:22 -07:00
Doug Gregor
a41c36934b [CMake] Fix host library builds and rpaths for testing macros
This enables running macro tests on Linux.
2023-05-28 22:20:25 -07:00
Doug Gregor
c9383ff619 [CMake] Add paths for building Swift code against host toolchain
When building Swift code into the compiler (e.g, the new Swift parser
along with macros support), make sure we always add the appropriate
paths to (1) link against the host Swift toolchain, and (2) find the
host Swift libraries (such as SwiftSyntax) at runtime.

The CMake code for doing this was only running for Darwin builds, so
generalize it to also work on Linux.
2023-05-28 17:01:01 -07:00
Kuba (Brecka) Mracek
683985e824 Add missing armv7 variants into the lists of allowed CPU types for the 'freestanding' stdlib builds (#65633) 2023-05-04 08:36:43 -07:00
Alex Langford
7c52fe21d6 [CMake] Workaround sanitizer flag bug in swift driver
Some versions of the swift driver have a bug where passing `-sanitize=`
does not emit the correct `-fsanitize=` flag for the clang link step.
Although this is being fixed, we must be able to correctly build with older
versions of the swift driver for some period of time. We workaround that
issue by explicitly passing the correct `-fsanitize=` argument
ourselves.

This works around rdar://107733898
2023-04-06 16:58:01 -07:00
Rintaro Ishizaki
d5565c9855 [CMake] Add correct sanitizer options to pure Swift libs/tools
rdar://107056349
2023-03-22 13:05:20 -07:00
Rintaro Ishizaki
93e25d2935 Merge pull request #64376 from rintaro/macros-plugin-server 2023-03-20 07:52:08 -07:00
Rintaro Ishizaki
d28e1c963c [CMake] Fix swift_supports_implicit_module failure
swift_supports_implicit_module invokes /path/to/toolchain/usr/bin/swiftc
directly without using `xcrun`. That fails to set necessary
environmental variables to make swiftc infer the SDK path. Because of
that swift_supports_implicit_module used to fail because the test
compilation fails to load the stdlib. This PR workaround it by passing
`-parse-stdlib` to avoid implicit stdlib loading.
2023-03-16 16:13:50 -07:00
Ben Barham
e137b32c73 Merge pull request #64409 from bnbarham/add-link-path
[CMake] Add lib to swift host libraries link directories
2023-03-16 14:42:20 -07:00
Rintaro Ishizaki
025d8746fe [CMake] Set correct RPATH in add_pure_swift_host_tool
Also, build pure swift library/tool with install RPATH like non Swift
things.
2023-03-16 14:00:45 -07:00
Ben Barham
4186d628e1 [CMake] Add lib to swift host libraries link directories
Our libraries have a `LC_LINKER_OPTION` for eg. `-lswiftLLVMJSON`.
This is resolved (probably just based on the actual libswiftLLVMJSON.a
added to the link command) by ld, but not by lld. Add in a link
directory so that these libraries can be found.
2023-03-15 16:55:01 -07:00
Rintaro Ishizaki
f9fba6ce3e [CMake] Move add_pure_swift_host_library to a file
* Move `add_pure_swift_host_library()` from lib/CMakeLists.txt to
  AddPureSwift.cmake so that code outside `lib` can use it
* Add `add_pure_swift_host_tool()` function to make a pure Swift
  host executable target (for future usages)
* Specify depending `SwiftSyntax` modules explicitly because not all
  Swift libraries uses all SwiftSyntax libraries
2023-03-13 19:28:13 -07:00
Rintaro Ishizaki
9004fd24d4 [ASTGen] Separate JSON serialization module from ASTGen
For future usage from other host libraries written in Swift

For CMake:
 * Explicitly specify LINKER_LANGAGE to CXX in existing components so
   that 'swiftc' is not used when linking with 'swiftASTGen'
 * Add 'EMIT_MODULE' argument to 'add_pure_swift_host_library' to emit
   .swiftmodule usable from other Swift libraries.
2023-03-09 19:15:45 -08:00
Daniel Rodríguez Troitiño
b4090419ea [cmake] Modify libedit target name to match LLVM's FindLibEdit
For unified builds, LLVM with the update to stable/20221013 includes its
own FindLibEdit, which shares many of the same names than Swift's
FindLibEdit, except that they differ in the target name.

Match both LLVM and Swift target names, so unified builds can find
LibEdit::LibEdit correctly and not try to link against libedit
mistakenly.

This should not affect Darwin/Linux builds from upstream Swift, since
they build non-unified in most people setups (including CI).
2023-03-07 17:10:11 -08:00
Alastair Houghton
1258d45152 [Backtracing] Build work.
Additional shimming required for some builds, as well as a few other build
related tweaks.

rdar://106234311
2023-03-04 15:46:30 +00:00
Alastair Houghton
44783e72c6 [Frontend] Add support for implicit import of _Backtracing
Once the API has gone through Swift Evolution, we will want to implicitly
import the _Backtracing module.  Add code to do that, but set it to off
by default for now.

rdar://105394140
2023-03-04 08:00:06 +00:00
Mishal Shah
41a903c425 Fix the bad merge from main to rebranch in cmake/modules/AddSwift.cmake 2023-03-01 22:28:05 -08:00
Arnold Schwaighofer
ed9da31fc6 Revert "Merge pull request #63650 from al45tair/backtracing/add-libexec"
This reverts commit b88f3b6545, reversing
changes made to be4caa5b93.
2023-02-28 10:08:56 -08:00
swift-ci
8c1e33acd8 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-28 06:35:01 -08:00
Alastair Houghton
f68c4b40f3 Add support for building target executables into libexec.
We're going to add a program, `swift-backtrace`, that gets built alongside
the stdlib and the runtime, and that needs to be installed in libexec/swift
alongside the libraries in lib/swift.

It wants to be built with the stdlib/runtime because there's an internal
interface between `swift-backtrace` and the runtime, so the program needs
to stay in lock-step with the runtime library.

rdar://105390807
2023-02-13 20:04:37 +00:00
swift-ci
db6b4d0e60 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-06 21:33:17 -08:00
Eric Miotto
6b2809ab19 [CMake] Assume watchOS and watchSimulator SDKs support 32 bit (#63472)
Update to match SDKSettings.json in watchOS 9.0

Addresses rdar://104967031
2023-02-06 21:29:56 -08:00
swift-ci
53edbec88e Merge remote-tracking branch 'origin/main' into rebranch 2022-12-16 08:55:12 -08:00
Alex Hoppen
1ebe7ef6a2 Copy files from SwiftSyntax’s gyb_syntax_support that are relevant to the compiler to this repo
This allows us to evolve e.g. token kinds and how attributes are modelled independently between SwiftSyntax and the compiler. It also makes it easier to e.g. add an attribute because you don’t need to create PRs for two repositories.
2022-12-15 16:40:28 +01:00
swift-ci
fcdbbfe6d8 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-09 16:23:24 -08:00
Rintaro Ishizaki
d05f45b7f0 [CMake] Don't add unnecessary gyb support .py files
'add_gyb_target' can accept 'DEPENDS'. Utilize it.
2022-12-08 14:49:08 -08:00
swift-ci
84236ec390 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-04 01:13:44 -08:00
Anthony Latsis
d553d0466a Merge pull request #62355 from AnthonyLatsis/sr-no-sr
[NFC] Migrate remnant Jira issue references to GitHub issues
2022-12-04 12:08:25 +03:00
Anthony Latsis
4cb63c8a0f [NFC] Migrate remnant Jira issue references to GitHub issues 2022-12-04 08:20:34 +03:00
swift-ci
9638cd3de8 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-02 12:37:21 -08:00
Saleem Abdulrasool
70a148dc2f Merge pull request #62367 from compnerd/clang-cl
build: honour `SWIFT_CLANG_LOCATION`
2022-12-02 12:30:42 -08:00
Saleem Abdulrasool
6c384e0b78 build: honour SWIFT_CLANG_LOCATION
We would previously use `clang-cl` without the explicit path which could
find an alternative `clang-cl` instance.  This manifested as a failure
to build libdispatch as part of the compiler when cross-compiling x64 to
arm64.
2022-12-02 09:14:56 -08:00
swift-ci
21b2cf9c50 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-01 20:14:31 -08:00
Erik Eckstein
d89c6b2d70 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-01 07:48:51 +01:00
Doug Gregor
8f7b303e83 Set host libraries rpath correctly for bootstrapped builds 2022-11-30 18:11:02 -08:00
Doug Gregor
b338472a2b Start building libswift_CompilerPluginSupport into lib/swift/host. 2022-11-30 13:54:03 -08:00
Doug Gregor
20013181e1 [CMake] Link to swift-syntax libriares from lib/swift/host. 2022-11-30 13:54:03 -08:00
Saleem Abdulrasool
d0a7ceab4c Merge pull request #61816 from mhjacobson/freebsd-strip-version-suffix
build: add missing `REGEX` to properly strip {Free,Open}BSD version suffixes
2022-11-30 07:24:51 -08:00
swift-ci
9d3c3443a8 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-28 20:14:05 -08:00
Robert Widmann
269dfb4c3b Adapt to the Removal of SerializationCodes.py
See https://github.com/apple/swift-syntax/pull/1089
2022-11-28 16:16:51 -07:00