Skip to content

Commit 95988ac

Browse files
authored
Merge pull request swiftlang#1740 from millenomi/cfprivate
Fix linkage for Linux and BSD symbol declarations that use `CF_PRIVATE`
2 parents 9909165 + d1503a6 commit 95988ac

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ static CFRuntimeClass const * __CFRuntimeClassTable[__CFRuntimeClassTableSize] _
229229

230230
#if TARGET_OS_MAC
231231
[_kCFRuntimeIDCFMachPort] = &__CFMachPortClass,
232+
[_kCFRuntimeIDCFMessagePort] = &__CFMessagePortClass,
232233
#endif
233234

234235

235-
[_kCFRuntimeIDCFMessagePort] = &__CFMessagePortClass,
236236
[_kCFRuntimeIDCFRunLoopMode] = &__CFRunLoopModeClass,
237237
[_kCFRuntimeIDCFRunLoop] = &__CFRunLoopClass,
238238
[_kCFRuntimeIDCFRunLoopSource] = &__CFRunLoopSourceClass,

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef int boolean_t;
145145

146146
#if DEPLOYMENT_TARGET_LINUX
147147

148-
#define CF_PRIVATE __attribute__((visibility("hidden")))
148+
#define CF_PRIVATE extern __attribute__((visibility("hidden")))
149149
#define __weak
150150

151151
#define strtod_l(a,b,locale) strtod(a,b)
@@ -235,7 +235,7 @@ CF_INLINE uint64_t mach_absolute_time() {
235235
#if DEPLOYMENT_TARGET_FREEBSD
236236
#define HAVE_STRUCT_TIMESPEC 1
237237

238-
#define CF_PRIVATE __attribute__((visibility("hidden")))
238+
#define CF_PRIVATE extern __attribute__((visibility("hidden")))
239239
#define __strong
240240
#define __weak
241241

@@ -455,7 +455,7 @@ CF_EXPORT int64_t OSAtomicAdd64Barrier( int64_t __theAmount, volatile int64_t *_
455455
#endif
456456

457457
#if !defined(CF_PRIVATE)
458-
#define CF_PRIVATE __attribute__((__visibility__("hidden"))) extern
458+
#define CF_PRIVATE extern __attribute__((__visibility__("hidden")))
459459
#endif
460460

461461
// [FIXED_35517899] We can't currently support this, but would like to leave things annotated

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ 1
1313

1414
#if !defined(CF_PRIVATE)
15-
#define CF_PRIVATE __attribute__((__visibility__("hidden")))
15+
#define CF_PRIVATE extern __attribute__((__visibility__("hidden")))
1616
#endif
1717

1818
#include <CoreFoundation/CFBase.h>

CoreFoundation/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ target_compile_options(CoreFoundation
362362
-fblocks
363363
-fconstant-cfstrings
364364
-fdollars-in-identifiers
365-
-fexceptions)
365+
-fexceptions
366+
-fno-common)
366367
if(CF_DEPLOYMENT_SWIFT)
367368
target_compile_options(CoreFoundation
368369
PRIVATE

CoreFoundation/Stream.subproj/CFStreamPriv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct _CFStream;
5656
CF_EXPORT void* _CFStreamGetInfoPointer(struct _CFStream* stream);
5757

5858
#if !defined(CF_PRIVATE)
59-
#define CF_PRIVATE __attribute__((__visibility__("hidden")))
59+
#define CF_PRIVATE extern __attribute__((__visibility__("hidden")))
6060
#endif
6161

6262
// cb version must be > 0

build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
'-Wno-int-conversion',
6464
'-Wno-unused-function',
6565
'-I./',
66+
'-fno-common',
6667
'-fcf-runtime-abi=swift',
6768
])
6869

0 commit comments

Comments
 (0)