Closed
Description
Previous ID | SR-5271 |
Radar | None |
Original Reporter | @spevans |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, Linux |
Assignee | None |
Priority | Medium |
md5: a6d7c57d30f3e5c418c7e873e72b29e1
relates to:
- SR-2755 False objc_autoreleaseReturnValue dependency building on Linux
- SR-5986
swift test
induces an error "undefined reference to 'objc_retainAutoreleasedReturnValue'" when callsCFStringConvertEncodingToIANACharSetName(_: )
on Linux
Issue Description:
As per the comment in https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Base.subproj/CFRuntime.c#L1702
For CF functions with 'Get' semantics, the compiler currently assumes that
the result is autoreleased and must be retained. It does so on all platforms
by emitting a call to objc_retainAutoreleasedReturnValue. On Darwin, this
is implemented by the ObjC runtime. On Linux, there is no runtime, and
therefore we have to stub it out here ourselves. The compiler will eventually
call swift_release to balance the retain below.
This is a workaround until the compiler no longer emits this callout on Linux.
The stub just calls swift_retain() but the compiler should be fixed properly so that this workaround can be removed.