-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[embedded] Mark all functions as 'nounwind' in embedded Swift, add dependency tests #70344
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
@swift-ci please test |
Nice! I can't wait to drop these hacks!
|
@swift-ci please test |
fa3b9e0
to
c076b58
Compare
@swift-ci please test |
@swift-ci please test |
@swift-ci please test |
Maybe a stupid question: what about C++ interop? Do we restrict C++ interop to not supporting exceptions with this? |
Changed the condition to only apply 'nounwind' if C++ interop is disabled. |
@swift-ci please test |
exceptions can be caught when C++ interop is enabled. |
|
||
if (Context.LangOpts.hasFeature(Feature::Embedded) && | ||
!Context.LangOpts.EnableCXXInterop) { | ||
Attrs.addAttribute(llvm::Attribute::NoUnwind); |
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.
Is that applied only to Swift functions, and not the imported C++ functions? In this case you can enable nounwind
for Swift functions even when C++ interop is enabled, as exceptions are always caught at the boundary between Swift and a call to C++.
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 think you're right, this only applies to SILFunctions, not imported C++ functions. @eeckstein is that correct?
34485ef
to
fdc69fb
Compare
@swift-ci please test |
@swift-ci please test Linux platform |
1 similar comment
@swift-ci please test Linux platform |
Currently, some (not all) IRGen'd functions end up emiting unwind info and referencing exception personality symbols, both of which is undesirable in embedded Swift. Let's mark all functions an NoUnwind and let's add a test that checks that a simple embedded Swift program in Mach-O and ELF files has exactly the expected dependencies.