The Swift runtime requires the CMPXCHG16B ISA extension on x86. This is
controlled by the `-mcx16` flag when targeting the CPU baseline that we
use. Add a check and pass along the flag to repair the build.
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.