Skip to content

Add support for s390x (IBM Z) architecture #118

@Jawahars

Description

@Jawahars

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.S390x enum value is available in System.Runtime.InteropServices.RuntimeInformation

I'd be happy to submit a PR with this fix if that's ok!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions