Skip to content
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

Remove GetICUVersion from being preserved unconditionally by the ILLinker #39102

Closed
eerhardt opened this issue Jul 10, 2020 · 10 comments
Closed
Labels
area-System.Globalization size-reduction Issues impacting final app size primary for size sensitive workloads
Milestone

Comments

@eerhardt
Copy link
Member

We have one entry in CoreLib's ILLink.Descriptors.xml that is only used for testing:

<type fullname="Interop/Globalization">
<!-- Internal API used by tests only. -->
<method name="GetICUVersion" />
</type>

We should remove this entry so the method is trimmed when linking an app. See @marek-safar's comment here: #35199 (comment)

Marking it all the time will cause problems for us in InvariantMode when the native part won't be available and we need to statically link it.

One option would be to make a "_LibraryBuild.xml" file for CoreLib and only preserve this method when doing the "library build". The descriptor entry won't be embedded into the assembly, so it won't be picked up when linking the user's application.

@safern @joperezr @layomia

@eerhardt eerhardt added area-System.Globalization linkable-framework Issues associated with delivering a linker friendly framework labels Jul 10, 2020
@eerhardt eerhardt added this to the 5.0.0 milestone Jul 10, 2020
@ghost
Copy link

ghost commented Jul 10, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jul 10, 2020
@tarekgh
Copy link
Member

tarekgh commented Jul 10, 2020

I am wondering how much we'll gain when trimming this method? is it really worth it?

@tarekgh tarekgh removed the untriaged New issue has not been triaged by the area owner label Jul 10, 2020
@eerhardt
Copy link
Member Author

It isn't so much about the size gain. The size gain is super minimal.

The bigger issue is the static linking with InvariantMode, as mentioned above.

@jkotas
Copy link
Member

jkotas commented Jul 10, 2020

So can we make it conditional on InvariantMode?

@marek-safar
Copy link
Contributor

What is the motivation to have this pinvoke compiled into SPC at all? My understanding is that this is used for some test checks only, why the pinvoke cannot be defined in test assembly directly?

@tarekgh
Copy link
Member

tarekgh commented Jul 10, 2020

why the pinvoke cannot be defined in test assembly directly?

This was discussed when we introduced using ICU on Windows. The reason we preferred having it there is because the test assembly not aware if the ICU is loaded at all in the process or not or we are in NLS mode or ICU mode. Or if we are in NLS mode and somehow someone loaded ICU in the process for any other reason. having it in the SPC make it just straight forward if we are really in ICU mode without any heuristics.

@safern
Copy link
Member

safern commented Jul 10, 2020

why the pinvoke cannot be defined in test assembly directly?

Also, the reason why this PInvoke wasn't added into the test assembly directly is because the PInvoke is a QCall, which is internal and only allowed from System.Private.CoreLib since System.Globalization.Native shim is linked into mono and coreclr.

@marek-safar
Copy link
Contributor

I see. I agree with @eerhardt that the simplest solution then is to move the rule to "_LibraryBuild.xml" file for SPC.

@eerhardt
Copy link
Member Author

This work isn't necessary to ship 5.0, so moving to 6.0.

@eerhardt eerhardt modified the milestones: 5.0.0, 6.0.0 Jul 30, 2020
@marek-safar marek-safar added size-reduction Issues impacting final app size primary for size sensitive workloads and removed linkable-framework Issues associated with delivering a linker friendly framework labels Dec 9, 2020
@eerhardt
Copy link
Member Author

Resolved by #48120.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Globalization size-reduction Issues impacting final app size primary for size sensitive workloads
Projects
None yet
Development

No branches or pull requests

6 participants