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

Make default rooting behavior consistent #3124

Merged
merged 3 commits into from
Nov 21, 2022
Merged

Make default rooting behavior consistent #3124

merged 3 commits into from
Nov 21, 2022

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Nov 18, 2022

Now specifying an assembly as a root without any other qualifiers will default to rooting everything. Fixes #1541

{
switch (s.ToLowerInvariant ()) {
case "default":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any chance we get this on the command line?
Just thinking about backward compat.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely possible - someone could have set RootMode=default on ManagedAssemblyToLink - but we never documented that and I hope nobody is doing it. My preference is to get rid of it, but if this is a real concern I can keep support for it. It would just be a bit unfortunate that "default" is no longer the default. @marek-safar, thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's OK to break this as well - especially since this is 8.0 only and we will have TFM-specific linker then.

@sbomer sbomer merged commit e775974 into dotnet:main Nov 21, 2022
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this pull request Dec 13, 2022
…ly for the linker.

Not only is it no longer necessary, it's wrong after dotnet/linker#3124.
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request Dec 13, 2022
…ly for the linker.

Not only is it no longer necessary (hasn't been for a while), it'll be wrong
in .NET 8 after dotnet/linker#3124.
<TrimmerRootAssembly Include="@(IntermediateAssembly)" />
<TrimmerRootAssembly Include="@(IntermediateAssembly)" RootMode="EntryPoint" />
Copy link
Member

@jonathanpeppers jonathanpeppers Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbomer Android apps are actually class libraries, there is no static void Main() because Android's entry point is either an Android.App.Application or Android.App.Activity.

I think this change causes:

ILLink error IL1034: Root assembly 'MyAndroidApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have entry point.

Should I do this in the Android workload?

<ItemGroup>
  <TrimmerRootAssembly Update="@(TrimmerRootAssembly)" RootMode="Library" />
</ItemGroup>

jonathanpeppers added a commit to dotnet/android that referenced this pull request Dec 15, 2022
Context: dotnet/linker#3124 (comment)

Android projects are class libraries, and this current triggers:

    ILLink error IL1034: Root assembly 'MyAndroidApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have entry point.
jonathanpeppers added a commit to dotnet/android that referenced this pull request Dec 16, 2022
Changes: dotnet/installer@243326d...167a4ed
Changes: dotnet/linker@13b8d6d...27ce032
Changes: dotnet/runtime@dd7fdb7...1a37caf
Changes: dotnet/emsdk@b6656f5...96351a7

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 8.0.100-alpha.1.22602.5 to 8.0.100-alpha.1.22611.1
* Microsoft.NET.ILLink.Tasks: from 7.0.100-1.22564.1 to 8.0.100-1.22609.1
* Microsoft.NETCore.App.Ref: from 8.0.0-alpha.1.22559.2 to 8.0.0-alpha.1.22605.1
* Microsoft.NET.Workload.Emscripten.net7.Manifest-8.0.100: from 8.0.0-alpha.1.22554.1 to 8.0.0-alpha.1.22558.2

Other changes:

* Update `.apkdesc` files

* [illink] avoid `IL1034` for `.exe` files

Context: dotnet/linker#3124 (comment)

Android projects are class libraries, and this currently triggers:

    ILLink error IL1034: Root assembly 'MyAndroidApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have entry point.

Issue filed at: dotnet/linker#3165

Co-authored-by: Jonathan Peppers <[email protected]>
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this pull request Dec 19, 2022
…ly for the linker. (#17026)

It's automatically done in the linker's MSBuild logic.

Not only is it no longer necessary (hasn't been for a while), it'll be wrong
in .NET 8 after dotnet/linker#3124.
tlakollo pushed a commit to tlakollo/linker that referenced this pull request Dec 20, 2022
Now specifying an assembly as a root without any other qualifiers will default to rooting everything.

Commit migrated from dotnet@e775974
tlakollo pushed a commit to tlakollo/runtime that referenced this pull request Dec 22, 2022
Now specifying an assembly as a root without any other qualifiers will default to rooting everything.

Commit migrated from dotnet/linker@e775974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider making root behavior more consistent
3 participants