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

SPC: Set PlatformType property to arm64 instead of AnyCPU for arm64 builds #84424

Closed
akoeplinger opened this issue Apr 6, 2023 · 5 comments
Closed

Comments

@akoeplinger
Copy link
Member

We're setting AnyCPU as the PlatformTarget for corelib here (in all runtimes):

<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>

Roslyn gained support for setting arm64 as a platform in dotnet/roslyn@e65a6c5 about 5 years ago. I traced git history and it looks like the AnyCPU value for arm64 has been there from the beginning of coreclr being open-sourced 9 years ago so it was never updated.

I don't know exactly what the impact of changing this would be but thought I'd bring it up for discussion.

/cc @jkotas @vitek-karas

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Apr 6, 2023
@ghost
Copy link

ghost commented Apr 6, 2023

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details

We're setting AnyCPU as the PlatformTarget for corelib here (in all runtimes):

<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>

Roslyn gained support for setting arm64 as a platform in dotnet/roslyn@e65a6c5 about 5 years ago. I traced git history and it looks like the AnyCPU value for arm64 has been there from the beginning of coreclr being open-sourced 9 years ago so it was never updated.

I don't know exactly what the impact of changing this would be but thought I'd bring it up for discussion.

/cc @jkotas @vitek-karas

Author: akoeplinger
Assignees: -
Labels:

arch-arm64, area-Meta

Milestone: -

@jkotas
Copy link
Member

jkotas commented Apr 6, 2023

Processor architecture on assembly identities is obsolete concept. Properties returning this enum are marked obsolete. We are not adding new architectures to ProcessorArchitecture enum. We cannot really do that even if we wanted to - the enum encoding in metadata does not have enough bits to hold all processor architectures supported by .NET.

The processor architecture on CoreLib is set just for compatibility with .NET Framework. There are (obsolete) APIs that return it. If we were to set processor architecture on CoreLib for Arm64, we would need to revisit the whole thing - add the Arm64 member to the obsolete ProcessorArchitecture, fix all obsolete APIs that deal with it to handle it, etc. Not worth it. It can easily break more things than it would fix.

@jkotas
Copy link
Member

jkotas commented Apr 6, 2023

Duplicate of #58970

@jkotas jkotas marked this as a duplicate of #58970 Apr 6, 2023
@jkotas jkotas closed this as completed Apr 6, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Apr 6, 2023
@akoeplinger
Copy link
Member Author

akoeplinger commented Apr 6, 2023

I wasn't thinking about changing the ProcessorArchitecture enum, but I see this comment now:

// ProcessorArchitecture is a legacy API and does not cover other Machine kinds.
// For example ARM64 is not expressible
return ProcessorArchitecture.None;

I stumbled over this due to dotnet/cecil#60 which uses code like this:

var pe64 = module.Architecture == TargetArchitecture.AMD64 ||
module.Architecture == TargetArchitecture.IA64 ||
module.Architecture == TargetArchitecture.ARM64;

Vitek said it looks weird that we don't set PlatformTarget for ARM64 so I thought I'd better ask 😄

@jkotas
Copy link
Member

jkotas commented Apr 6, 2023

I stumbled over this due to dotnet/cecil#60 which uses code like this:

This code does not look right to me: dotnet/cecil#60 (comment)

@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants