-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Add support for s390x (IBM Z) architecture
Description
The library currently doesn't recognize s390x architecture (IBM Z/zLinux), causing it to fall back to "unknown" architecture, which results in the Runtime Identifier (RID) being "linux-unknown" instead of "linux-s390x".
Current Behavior
When running on s390x architecture, RuntimeInformation.ProcessArchitecture returns a value not handled in the switch statement in GraphvizCommand.cs, causing it to hit the default case and return "unknown".
var arch = RuntimeInformation.ProcessArchitecture switch
{
Architecture.X64 => "x64",
Architecture.Arm64 => "arm64",
Architecture.X86 => "x86",
Architecture.Arm => "arm",
_ => "unknown" // s390x falls here
};This results in the library looking for binaries in /runtimes/linux-unknown/native/ instead of /runtimes/linux-s390x/native/.
Expected Behavior
The library should recognize s390x architecture and use the correct RID "linux-s390x".
Environment
- Architecture: s390x (IBM Z/zLinux)
- .NET Runtime: .NET 8.0
- OS: Red Hat UBI 10 (RHEL-based)
Proposed Solution
Add s390x to the architecture switch statement:
var arch = RuntimeInformation.ProcessArchitecture switch
{
Architecture.X64 => "x64",
Architecture.Arm64 => "arm64",
Architecture.X86 => "x86",
Architecture.Arm => "arm",
Architecture.S390x => "s390x",
_ => "unknown"
};Workaround
Currently, we work around this by creating symlinks from linux-unknown/native/ to the actual s390x binaries.
Additional Context
- s390x is a widely used architecture in enterprise environments (IBM Z mainframes)
- .NET has official support for s390x since .NET 6
- The
Architecture.S390xenum value is available inSystem.Runtime.InteropServices.RuntimeInformation
I'd be happy to submit a PR with this fix if that's ok!