Skip to content

MachOUtils.cs is not endian-independent. #74163

Open
@jkoritzinsky

Description

@jkoritzinsky

From #72394:

The problem seems to be that the new mono.tools subset now builds dotnet-pgo.csproj, which tries to create an osx-x64 shim apphost:

    <PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;win-arm;osx-x64</PackAsToolShimRuntimeIdentifiers>

This in turn pulls in code in src/installer/managed/Microsoft.NET.HostModel/AppHost/MachOUtils.cs to manipulate MachO binaries, but that whole file unfortunately fundamentally seems to assume little-endian byte order, as it just mmaps the binary and then overlays structures over the mmap.

So the question is, what is the best way to fix this? Of course, we could try to rewrite MachOUtils.cs to be endian-independent. But I'm wondering if we even need to build this on s390x? Do you think it would make sense to skip building dotnet-pgo completely (or at least building the osx-x64 shim), either whenever PrimaryRuntimeFlavor is Mono or specificially just on s390x due to the endian issue?

Are the tools in dotnet-pgo even useful at all on a system where we're not supporting CoreCLR at all?

Originally posted by @uweigand in #72394 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-HostModelMicrosoft.NET.HostModel issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions