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
[SR-10721] Runtime fails to demangle superclass when a type used to satisfy the superclass's generic bound is used in a superficial way #53118
Comments
Comment by Ben Pious (JIRA) Here's a less complex version of a similar issue. This case has the quirk that it seemingly only manifests when the base class inherits from `NSObject`. |
cc @eeckstein, @mikeash |
cc @rjmccall, @DougGregor |
Sounds like we aren't emitting the type metadata for `OneCaseEnum`. |
Looks like some different issues going on here. In the first GenericLayer.zip attachment, the problem goes away if I move `Base`, `C,` Subclass2`, and `G` all together into one file; it repros when they are in separate files. |
It looks like the problem happens when `Base` and `Subclass2` are in different files. |
Ah, these look like they are all variants of rdar://problem/47598583 — the necessary type metadata is in a .o file in the static archive that is getting dropped because it's only referenced by mangled names. If `-all_load` doesn't work for some reason, maybe you could try `-force_load`-ing the specific static libraries. |
Comment by Ben Pious (JIRA) @jckarter thanks for investigating! We're about to start investigating `-force_load`. Unfortunately we have over 350 static libraries, and this crash doesn't happen at startup. It also seems like unit tests aren't sufficient to guarantee that we've found all of them, as release builds can have totally different variants of these crashes, so doing it for specific libs may not be an option. I assume that there's no reliable way to check the compiler's work, short of building with a toolchain that has the fix, and then diffing the nm output to see which symbols have changed. |
You should be safe if you force load any .a file that contains symbols matching the regex |
Comment by Michael Eisel (JIRA) In the Xcode 11 release notes, it states "Static libraries are now always force-loaded in their entirety during linking, fixing most “unable to demangle” runtime errors". Does that mean that it loads all object files of all static libraries? All of object files of all static libraries that have at least one Swift symbol? Or just all object files that have at least one Swift symbol? |
Attachment: Download
Environment
Xcode 10.2.1 (10E1001).
Additional Detail from JIRA
md5: e3a6d08500afe670dfaea4a0748d9a1d
relates to:
Issue Description:
We have a `class C<T, U, V> where U: Switch`. Another class `MyPlugin: C<Context, OneCaseEnum, PluginType>` inherits from `C`.
Running the attached sample code causes it to fail with
The text was updated successfully, but these errors were encountered: