Skip to content

Commit 38a8ccd

Browse files
authored
Merge pull request #97 from lorentey/autolink-libswiftCore
[_AtomicShims] On Darwin, ensure we link against libswiftCore using assembly shenanigans
2 parents 2ff28f8 + 5603f61 commit 38a8ccd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/_AtomicsShims/src/_AtomicsShims.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
// like calls to swift_retain_n/swift_release_n appearing in Swift code, not
1717
// even when imported through C. (See https://bugs.swift.org/browse/SR-13708)
1818

19+
#if defined(__APPLE__) && defined(__MACH__)
20+
// Ensure we link with libswiftCore.dylib even when the build system decides
21+
// to build this module as a standalone library.
22+
// (See https://github.com/apple/swift-atomics/issues/55)
23+
__asm__(".linker_option \"-lswiftCore\"\n");
24+
#endif
25+
1926
void _sa_retain_n(void *object, uint32_t n)
2027
{
2128
extern void *swift_retain_n(void *object, uint32_t n);

0 commit comments

Comments
 (0)