Skip to content

Remove GetICUVersion from being preserved unconditionally by the ILLinker #39102

Closed

Description

@eerhardt

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

Activity

  1. added this to the 5.0.0 milestone on Jul 10, 2020
  2. tarekgh commented on Jul 10, 2020

    @tarekgh
    Member

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

  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 10, 2020
  4. eerhardt commented on Jul 10, 2020

    @eerhardt
    MemberAuthor

    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.

  5. jkotas commented on Jul 10, 2020

    @jkotas
    Member

    So can we make it conditional on InvariantMode?

  6. marek-safar commented on Jul 10, 2020

    @marek-safar
    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?

  7. tarekgh commented on Jul 10, 2020

    @tarekgh
    Member

    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.

  8. safern commented on Jul 10, 2020

    @safern
    Member

    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.

  9. marek-safar commented on Jul 12, 2020

    @marek-safar
    Contributor

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

  10. eerhardt commented on Jul 30, 2020

    @eerhardt
    MemberAuthor

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

  11. modified the milestones: 5.0.0, 6.0.0 on Jul 30, 2020
  12. added
    size-reductionIssues impacting final app size primary for size sensitive workloads
    and removed
    linkable-frameworkIssues associated with delivering a linker friendly framework
    on Dec 9, 2020
  13. eerhardt commented on Feb 16, 2021

    @eerhardt
    MemberAuthor

    Resolved by #48120.

  14. ghost locked as resolved and limited conversation to collaborators on Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions