Skip to content

[4.2 EARLY] Autolink libraries referenced from default arguments and @inlinable bodies #16332

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

jrose-apple
Copy link
Contributor

  • Explanation: If module A uses some inlinable code from module B (including function default arguments), and that code uses a symbol in module C, but module A doesn't itself import module C, we'll get a link error. This change records any modules that are used within inlinable code and makes sure they get added to the autolinking list for clients.
  • Scope: As described in the explanation. We've seen this on at least one Apple-internal project.
  • Issue: rdar://problem/39338239
  • Risk: Medium-low. This isn't a small patch, but the first two parts are just moving things around, and the last two mostly don't touch anything but the autolinking logic they're modifying.
  • Testing: Added compiler regression tests.
  • Reviewer: Me (all patches by @slavapestov)

Note: This isn't a complete solution, because rather than using a symbol from module C, the inlinable code might use a symbol from a module re-exported by module C. We're still trying to come up with a solution to that problem.

slavapestov and others added 4 commits May 2, 2018 19:28
IRGen: Remove collectLinkLibrariesFromExternals()
(cherry picked from commit 15afed5)
…anup

Serialization cleanup

(cherry picked from commit af87582)
…autolinking

Plumb through support for 'usable from inline' imports

(cherry picked from commit bb16ee0)
…m inlinable functions (swiftlang#16326)

Basic fix for <rdar://problem/39338239>, but there are still some more cases we haven't handled yet.

(cherry picked from commit ee6e190)
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@jrose-apple
Copy link
Contributor Author

This is the same content as #16331, just targeted at the early branch off of 4.2.

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2018

Build failed
Swift Test Linux Platform
Git Sha - 60c5abf

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2018

Build failed
Swift Test OS X Platform
Git Sha - 60c5abf

@jrose-apple
Copy link
Contributor Author

Oof, right, there's an LLDB patch that goes with this. My bad.

@jrose-apple
Copy link
Contributor Author

Source compat is the same 16 failures that are XFAILed on the regular 4.2 branch. We shouldn't worry about that here.

@jrose-apple
Copy link
Contributor Author

apple/swift-lldb#600
@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

Closing in favor of #16349.

@jrose-apple jrose-apple closed this May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants