-
Notifications
You must be signed in to change notification settings - Fork 471
Export objc_retainAutoreleasedReturnValue() #258
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
Conversation
I'm not sure we want to propagate the lie of this function on Linux. It promises autorelease behavior but can't deliver it. |
@parkera Its really just a temporary fix, |
dispatch seems like the wrong place for it though - it doesn't have any of the API which requires it. |
Seems like the logical temporary fix (if one is needed) would be to have a single symbol in the swift runtime that both dispatch and foundation could link against on linux. |
Yah I've long thought the runtime would be the place for both this stuff and the blocks as well. Putting it in dispatch is convenient but doesn't seem quite right. |
I can do a PR to put it in the runtime instead, it will just need to be merged at the same time it is removed completely from libdispatch to avoid duplicate symbol issues |
8e96d2b
to
45e331b
Compare
~~This PR will need to be tested/ merged at the same time as the swift PR~~~ Adding it to the runtime was rejected as this is not the correct full solution, it is only a workaround. Ive gone back to the original solution of exporting it from libdispatch so it can be removed from corelibs-foundation and will open a Jira to work on a proper fix for the runtime. |
45e331b
to
a7d94d0
Compare
Is there any objection to this PR? I know it is a temporary work around but removing the duplicated symbol will be helpful in simplifying the linker commands used for SR-648. If this change is OK I will open a followup to remove the duplicate from I opened https://bugs.swift.org/browse/SR-5271 for a correct fix for this problem which probably requires a compiler change but Im not sure how much work is involved there. |
Is this function actually used anywhere in dispatch? If not, maybe a better answer is to simply remove it and let Foundation use its own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of this but ok with it as a short term workaround
please fix the comment I mentioned and I will merge
src/swift/DispatchStubs.cc
Outdated
extern "C" void swift_retain(void *); | ||
|
||
SWIFT_CC(swift) DISPATCH_RUNTIME_STDLIB_INTERFACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be conditional to Linux ? (like other things are conditional to linux above)
though I guess it is really for non-Darwin, in which case I would amend the comment above to not mention Linux, this seems applicable to other potential targets that don't have an ObjC runtime (*bsd etc)
- This allows it to be used by Foundation so that the duplicate function can be removed.
a7d94d0
to
b756329
Compare
looks good, thanks! |
Export objc_retainAutoreleasedReturnValue() Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
This allows it to be used by Foundation so that the duplicate
function can be removed from CFRuntime.c in corelibs-foundation.
This also makes the export match the symbol in libdispatch.a.
Since SwiftFoundation depends on libdispatch, there is no reason to have the function defined in both libraries. It shouldnt break the build as Foundation uses the linker argument
--allow-multiple-definition
but once this PR has been merged the duplicate function can be removed from Foundation and the linker argument eliminated.At some point in the future the swift compiler may be fixed to not require this work around and then it can be removed from libdispatch as well.