Pass `-nostartfiles` to the driver as a staged toolchain would attempt
to link the Swift registrar which may not exist if the SDK is not
integrated. Furthermore, the registrar to be used is locally built and
not the one from the previous build.
Enable the non-escapeable types and lifetime dependence features when
building swiftCore. While we do not enable all the same features being
used in the current standard library, this allows us to build the
runtime.
Windows core modules require the `-fbuiltin-headers-in-system-modules`
flag to be passed to the clang importer. Adjust the build flags for the
platform.
This is required for the non-Darwin targets as `SWIFT_THREADING_DARWIN`
does not enable any additional code. However, that macro is used in
other places that are not yet integrated. This was identified by
building for Windows.
This define is meant to be present only when performing a build of a
dynamic library. The general pattern for this is:
```c
#if defined(LIBRARY_STATIC)
# define LIBRARY_ABI /**/
#else
# if defined(_WIN32)
# if defined(LIBRARY_EXPORTS)
# define LIBRARY_ABI __declspec(dllexport)
# else
# define LIBRARY_ABI __declspec(dllimport)
# endif
# elseif defined(__linux__) && !defined(__ANDROID__)
# define LIBRARY_ABI __attribute__((__visibility__("protected")))
# else
# define LIBRARY_ABI __attribute__((__visibility__("default")))
# endif
#endif
```
For AIX this would require an additional flag to be specified
(`-mdefault-visibility-export-mapping=explicit`). The same applies for
other non-AIX, non-Windows platforms with a different set of flags:
`-fvisibility=hidden -fvisibility-inlines-hidden`.
This is required to start trying to build the standard library
statically on Windows (which also requires further changes to the
Swift compiler).
`defaulted_set` wasn't expanding the default variable, just setting the
value of the variable the name of the variable that should have been
doing the defaulting.
The `DebugDescription` macro has been accepted. Additionally, the `DebugDescriptionMacro` feature was not providing conditional declaration as I originally intended. References to the feature are not needed and can be removed.
(cherry-picked from #77738)
Stubs has a macro define for enabling or disabling the embedded
unicode data tables, which are required for doing things like counting
characters in strings. Add that option and default it to 'on' for full
unicode support.
Making a more in-depth pass over the definition macros and flags in
SwiftSource.cmake _add_target_variant_swift_compile_flags.
These are only flags that actually matter for swiftCore though. This
does not include concurrency flags.
The Swift stdlib shouldn't be exposing C/C++ symbols by default.
There are select functions that should be exposed, like the
`_swift_allocObject` and the retain/release functions, but this should
be an explicit decision in the sources.
Set the SWIFT_STDLIB_HAS_COMMANDLINE macro when the stdlib has command
line support. This is needed while building SwiftCore to ensure that it
exports the appropriate symbols.
Adding vendor-specific extension points to the build system, giving
vendors a place to put their internal settings and defaults, without
having to modify the build directly. This helps reduce the chances of
merge conflicts and public changes breaking internal settings.
The location of the macros are set with `SwiftCore_PRIVATE_MODULE_DIR`,
so vendors can keep their private extensions in a separate location if
desired. Otherwise, it defaults to `cmake/modules/private`, which
intentionally does not exist at this time.
Currently, we have extensions for the default settings and global
settings.
This patch cleans up the handling of WMO-forcing in the workaround file.
`-wmo` is passed in each of the link jobs in the non-CMP0157-enabled
configuration to keep it matching the behavior of the CMP0157-enabled
builds.
This also moves the commentary about num-threads and WMO to the top of
the file to make it clearer what is going on. Ideally the file wouldn't
have to exist, but it does.
The file also contains the target install-name fix that landed in CMake
3.29.8 and CMake 3.30.2, so earlier versions of CMake 3.29 will work
with this build as well.
De-duping some of the definitions. We can pass most of the definitions
to both the Swift and C/C++ compilers in the same form if we don't
assign anything. C/C++ will set the macro value to `1` if there is no
`=` as part of the definition, and `#if` recognizes a non-existent macro
to be false. With this logic, we can unify some of these.
This patch causes the convenient flow to automatically populate the
sources into the new runtime directory layout. This is run at build-time
so that it repopulates on each build. Since the resync script uses
`COPY_IF_DIFFERENT`, only files that change in the main source directory
are copied over, so incremental builds should still work.
Fixed a small bug in the resync script to ensure that it creates the
subdirectories in the right places.
Fixing some of the comments in DefaultSettings.cmake and
PlatformInfo.cmake.
I haven't added any vendor cache files yet, so the comment doesn't point
anywhere. Also fixing the reference to the location of the clang
resource headers in PlatformInfo.cmake.
Moving the rest of the references to the compiler source directory to
use the `SwiftCore_SWIFTC_SOURCE_DIR` variable instead of
`${PROJECT_SOURCE_DIR}/../../`.
This patch makes it simpler to setup reasonable defaults for a given
platform. The standard library has many knobs for configuration
purposes. This is great for providing cache files to configure specific
builds, but the build system should still generally work if someone runs
a minimal CMake invocation against the build without futzing with
various options.