Skip to content

[clr-ios] Implement Crossgen2 Mach-O object writer #120043

Description

@kotlarmilos

Description

Implement Mach-O output in Crossgen2 as a parallel implementation to the existing PE writer. The Mach-O writer should generate composite ReadyToRun (R2R) images for Apple platforms, mapping R2R sections and symbols to Mach-O segments and sections. It should also expose the R2R header via an exported symbol and emit native debug information together with native code.

The work includes enforcing composite-only mode and rejecting single-file ReadyToRun images to avoid the complexity of exporting per-assembly symbols. This requires adding R2R-specific features to the MachObjectWriter and mapping R2R sections and symbols to Mach-O segments and sections, including native code in __TEXT,__text, fixups and indirections in a __DATA section, and exposing the R2R header via an exported symbol. Crossgen2 targets must be updated to link the Mach-O object into a dylib, using the existing macOS triple for Apple mobile. Native debug information should be emitted alongside the native code, and R2RDump should be extended to support dumping Mach-O R2R images.

The progress is tracked in #120065

DoD: Running Crossgen2 with --targetos macos--targetarch arm64 --composite --obj-format macho generates a valid Mach-O object file containing code and an embedded R2R header.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions