Skip to content

MSVC Subsystem Version Floor Prevents Targeting Windows 2000 or Earlier #5

@realJoshByrnes

Description

@realJoshByrnes

Summary:
Rusticle binaries built with the MSVC toolchain work correctly on Windows NT 4.0 (and likely Windows 2000 - untested). However, the /SUBSYSTEM flag in link.exe enforces a minimum version of Windows XP (5.01), preventing developers from directly targeting older versions like NT 4.0 or Windows 95.

This limitation requires manual patching of the PE header post-build to lower the subsystem version.


Current Behavior:

  • MSVC link.exe restricts /SUBSYSTEM:CONSOLE,<version> to a minimum of 5.01.
  • Rusticle MSVC binaries run successfully on NT 4.0 if the subsystem version is manually patched.
  • Rusticle GNU binaries run successfully on NT 4.0

Expected Behavior:
Developers should be able to opt into legacy subsystem versions (e.g. 3.10, 4.00) without manually editing binaries.


Proposed Solutions:

  • Add a build flag or profile setting to enable legacy subsystem targeting.
  • Provide a post-build script that patches the PE header to set the desired subsystem version.
  • Consider a build wrapper that invokes editbin, llvm-objcopy, or a custom tool to rewrite the header automatically.
  • Document subsystem version limitations and compatibility notes for legacy Windows targets.

Environment:

  • Rusticle v1.20.1
  • Target: i686-pc-windows-msvc
  • Tested on: Windows NT 4.0 (via VirtualBox)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions