-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[windows] Enable symbolic references in PE/COFF. #28547
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
There's another Windows error at the moment, so this will not report a success anyway. @swift-ci please test Windows platform |
@swift-ci please smoke test |
@swift-ci please clean test Windows platform |
Maybe metatype lookup by mangled name for private types is not working. The reason why it should work is because metaypes are now referenced by symbolic addresses in the mangled name. This was done recently by @jckarter. Maybe for some reason there is a problem with that on Windows. If this is really the case, there are 2 possibilities to fix that:
The first thing what you could do is to debug the runtime and see if swift_getTypeByMangledName works or fails. |
Under no circumstances should we try to demangle private type names from strings. The issue with Windows is likely that always-use-symbolic-references is not enabled on Windows, because https://github.com/apple/swift/blob/master/lib/IRGen/IRGenMangler.cpp#L122 though this will in turn break some Reflection tests until swift-reflection-dump is updated for PE. |
Thanks for the answers. I will try to see if that change makes a difference. Breaking more tests is not the perfect solution, though. It seems that we are crashing into the same problem with swift-reflection-dump, but I don't know if I have the knowledge or the time to deal with it. |
From an engineering tradeoffs point of view, my judgment would be that getting the performance, memory, and code size benefits of compacted mangled names and cross-module optimization is probably more important than swift-reflection-dump. It is hopefully straightforward to update swift-reflection-dump, though, since for PE you should hopefully be able to recognize indirect references into the import table and map those to import entries to extract the symbol name they're referring to. |
Thanks for the clue. Effectively removing that block makes the test pass in Windows. In exchange it breaks at least two tests in the Reflection folder. We will try to work on swift-reflection-dump, but I don't think we can promise any timeline. Would anyone have a problem XFAIL-ing this test for the time being? |
XFAILing the affected reflection tests on Windows seems fine to me. |
In order for the cross-module optimization to work, it needs to generate symbolic references, which were disabled in PE/COFF. This commit enables them and marks some Reflection tests with XFAIL since swift-reflection-dump still doesn't handle symbolic references.
20a258b
to
ada8217
Compare
@swift-ci please smoke test |
Changed the implementation and disabled the two test that seems to fail because of this changes. Let's see if CI finds some other ones. @swift-ci please clean test Windows platform |
@swift-ci please clean test Windows platform |
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.
LGTM, thanks!
In order for the cross-module optimization to work, it needs to generate
symbolic references, which were disabled in PE/COFF. This commit enables
them and marks some Reflection tests with XFAIL since
swift-reflection-dump still doesn't handle symbolic references.
Introduced in #28407 and first seen in https://ci-external.swift.org/job/oss-swift-windows-x86_64/2104/