Skip to content

(Arm32) Fix 32-bit Variable Offset Issues with CoreFoundation #1689

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion CoreFoundation/Base.subproj/CFInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ extern void __CFGenericValidateType_(CFTypeRef cf, CFTypeID type, const char *fu
#define __CFBitfield64GetValue(V, N1, N2) (((V) & __CFBitfield64Mask(N1, N2)) >> (N2))
#define __CFBitfield64SetValue(V, N1, N2, X) ((V) = ((V) & ~__CFBitfield64Mask(N1, N2)) | ((((uint64_t)X) << (N2)) & __CFBitfield64Mask(N1, N2)))

#if __LP64__ || DEPLOYMENT_TARGET_ANDROID
#if defined(__LP64__) || defined(__LLP64__)
typedef uint64_t __CFInfoType;
#define __CFInfoMask(N1, N2) __CFBitfield64Mask(N1, N2)
#else
Expand Down
2 changes: 1 addition & 1 deletion CoreFoundation/Base.subproj/CFRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ typedef struct __CFRuntimeBase {
// This matches the isa and retain count storage in Swift
uintptr_t _cfisa;
uintptr_t _swift_rc;
// This is for CF's use, and must match _NSCFType layout
// This is for CF's use, and must match _CFInfo / _NSCFType layout
#if defined(__LP64__) || defined(__LLP64__)
_Atomic(uint64_t) _cfinfoa;
#else
Expand Down
10 changes: 2 additions & 8 deletions Foundation/NSObjCRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,10 @@ internal func NSInvalidArgument(_ message: String, method: String = #function, f

internal struct _CFInfo {
// This must match _CFRuntimeBase
var info: UInt32
var pad : UInt32
var info: UInt
init(typeID: CFTypeID) {
// This matches what _CFRuntimeCreateInstance does to initialize the info value
info = UInt32((UInt32(typeID) << 8) | (UInt32(0x80)))
pad = 0
}
init(typeID: CFTypeID, extra: UInt32) {
info = UInt32((UInt32(typeID) << 8) | (UInt32(0x80)))
pad = extra
info = (typeID << 8) | 0x80
}
}

Expand Down
4 changes: 2 additions & 2 deletions Foundation/NSSwiftRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ extension ObjCBool : CustomStringConvertible {
#endif

internal class __NSCFType : NSObject {
private var _cfinfo : Int32
private var _cfinfo : _CFInfo

override init() {
// This is not actually called; _CFRuntimeCreateInstance will initialize _cfinfo
_cfinfo = 0
_cfinfo = _CFInfo(typeID: 0)
}

override var hash: Int {
Expand Down