Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[_AtomicShims] On Darwin, ensure we link against libswiftCore using assembly shenanigans #97

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Sources/_AtomicsShims/src/_AtomicsShims.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
// like calls to swift_retain_n/swift_release_n appearing in Swift code, not
// even when imported through C. (See https://bugs.swift.org/browse/SR-13708)

#if defined(__APPLE__) && defined(__MACH__)
// Ensure we link with libswiftCore.dylib even when the build system decides
// to build this module as a standalone library.
// (See https://github.com/apple/swift-atomics/issues/55)
__asm__(".linker_option \"-L/usr/lib/swift\"\n");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, -L doesn't actually work, but (for some reason) it also seems unnecessary, at least on 5.9.

__asm__(".linker_option \"-lswiftCore\"\n");
#endif

void _sa_retain_n(void *object, uint32_t n)
{
extern void *swift_retain_n(void *object, uint32_t n);
Expand Down