Commit Graph

7 Commits

Author SHA1 Message Date
Eric Miotto
d546222f57 [CMake] Use separate namespace for demangling symbols used by runtime
This matches the behavior introduced with #30733 -- quoting the
explanation here for the sake of convenience:

> Since libDemangling is included in the Swift standard library,
> ODR violations can occur on platforms that allow statically
> linking stdlib if Swift code is linked with other compiler
> libraries that also transitively pull in libDemangling, and if
> the stdlib version and compiler version do not match exactly
> (even down to commit drift between releases). This lets the
> runtime conditionally segregate its copies of the libDemangling
> symbols from those in the compiler using an inline namespace
> without affecting usage throughout source.

Addresses rdar://142550635
2025-01-08 09:28:46 -08:00
Evan Wilde
db5ed99b8a CMake: SwiftCore: SWIFT_STDLIB_HAS_ASL
Hooking up the `SWIFT_STDLIB_HAS_ASL` build macro.

rdar://142440689
2025-01-06 18:36:34 -08:00
Saleem Abdulrasool
8bf26a795c Runtime: control swiftCore_EXPORTS based on the build
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).
2024-12-12 10:06:21 -08:00
Evan Wilde
dad1ea8ed2 Shuffle definitions around
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.
2024-11-06 21:27:54 -08:00
Evan Wilde
03ba118bf3 Add swiftCore library
This patch hooks up the swiftCore library build and gets it installing.
This means that we have library evolution hooked up and vector types.

Building it dynamically found that we had duplicate symbols, so fixed
the swiftDemanglingCR library.

Needed to hook up the availability macros.

The flag configuration is for macOS, so we'll need to go through and
figure out what it should look like for the other platforms too.
2024-11-06 21:27:53 -08:00
Evan Wilde
96429952bb Build runtime library
Getting the runtime libraries building, while also ironing out more of
the macro definitions and flags.
2024-11-06 21:27:53 -08:00
Evan Wilde
b95e3cb47b Add SwiftDemangling 2024-11-06 14:17:52 -08:00