mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead of using weak definitions of swift_retain_preservemost and swift_release_preservemost, use weak references and explicitly check them for NULL. Embedded Swift uses weak definitions for its runtime symbols. If swiftCore is able to override the weak definitions of the _preservemost functions, it will also override the Embedded symbols. They are not compatible, so this ends poorly.
28 lines
1.5 KiB
Plaintext
28 lines
1.5 KiB
Plaintext
// Ensure that we do not export any weak symbols from the dylibs.
|
|
//
|
|
// Weak symbols require additional work from the loader to resolve the symbol at
|
|
// load time and can cause ODR violations as well as unexpected symbol
|
|
// satisfaction because the weak symbol may be used from a separate module.
|
|
//
|
|
// Weak symbols in the runtime also conflict with the use of weak symbols in
|
|
// embedded Swift. The presence of any weak symbol in swiftCore will allow its
|
|
// strong symbols to override the weak symbols in the embedded runtime, and they
|
|
// are not compatible.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %llvm-nm --defined-only --extern-only --demangle %platform-dylib-dir/%target-library-name(swiftCore) > %t/swiftCore-all.txt
|
|
// RUN: %llvm-nm --defined-only --extern-only --no-weak --demangle %platform-dylib-dir/%target-library-name(swiftCore) > %t/swiftCore-no-weak.txt
|
|
// RUN: diff -u %t/swiftCore-all.txt %t/swiftCore-no-weak.txt
|
|
|
|
// RUN: %llvm-nm --defined-only --extern-only --demangle %platform-dylib-dir/%target-library-name(swiftRemoteMirror) > %t/swiftRemoteMirror-all.txt
|
|
// RUN: %llvm-nm --defined-only --extern-only --no-weak --demangle %platform-dylib-dir/%target-library-name(swiftRemoteMirror) > %t/swiftRemoteMirror-no-weak.txt
|
|
// RUN: diff -u %t/swiftRemoteMirror-all.txt %t/swiftRemoteMirror-no-weak.txt
|
|
|
|
// NOTE: swiftDemanging is not checked because it is incorporated into
|
|
// swiftCore and swiftRemoteMirror. Both of those checks ensure that the
|
|
// symbols are handled properly.
|
|
|
|
// REQUIRES: VENDOR=apple
|
|
// UNSUPPORTED: freestanding
|