markdown · 1248 bytes Raw Blame History

afs-ld

Bespoke ARM64 Mach-O linker for Apple Silicon. Rust stdlib only.

Sister project to afs-as (the assembler) and armfortas (the compiler). Together they form a complete Fortran-to-executable toolchain with zero dependencies on LLVM or external compiler infrastructure.

Status

Sprint 0 — scaffolding only. Does not yet produce usable output.

Build

cargo build -p afs-ld
cargo test  -p afs-ld
cargo clippy -p afs-ld --all-targets -- -D warnings

Tests require macOS on Apple Silicon and a working Xcode command-line toolchain (xcrun).

Design

  • Reads .o (MH_OBJECT) Mach-O produced by afs-as, static archives (.a), binary dylibs, and TAPI TBD text stubs.
  • Emits MH_EXECUTE or MH_DYLIB PIE Mach-O files.
  • Ad-hoc code signing so binaries run directly on macOS 11+ arm64 hardware.
  • Supports both classic LC_DYLD_INFO opcodes and modern LC_DYLD_CHAINED_FIXUPS.

See .docs/overview.md for full architecture and .docs/sprints/index.md for the development roadmap.

Non-goals

  • ELF / COFF / PE — Mach-O only.
  • Architectures other than arm64.
  • LTO / bitcode.

License

GPL-3.0-only.

View source
1 # afs-ld
2
3 **Bespoke ARM64 Mach-O linker for Apple Silicon. Rust stdlib only.**
4
5 Sister project to [afs-as](https://github.com/FortranGoingOnForty/afs-as) (the assembler) and [armfortas](https://github.com/FortranGoingOnForty/armfortas) (the compiler). Together they form a complete Fortran-to-executable toolchain with zero dependencies on LLVM or external compiler infrastructure.
6
7 ## Status
8
9 Sprint 0 — scaffolding only. Does not yet produce usable output.
10
11 ## Build
12
13 ```bash
14 cargo build -p afs-ld
15 cargo test -p afs-ld
16 cargo clippy -p afs-ld --all-targets -- -D warnings
17 ```
18
19 Tests require macOS on Apple Silicon and a working Xcode command-line toolchain (`xcrun`).
20
21 ## Design
22
23 - Reads `.o` (MH_OBJECT) Mach-O produced by `afs-as`, static archives (`.a`), binary dylibs, and TAPI TBD text stubs.
24 - Emits `MH_EXECUTE` or `MH_DYLIB` PIE Mach-O files.
25 - Ad-hoc code signing so binaries run directly on macOS 11+ arm64 hardware.
26 - Supports both classic `LC_DYLD_INFO` opcodes and modern `LC_DYLD_CHAINED_FIXUPS`.
27
28 See `.docs/overview.md` for full architecture and `.docs/sprints/index.md` for the development roadmap.
29
30 ## Non-goals
31
32 - ELF / COFF / PE — Mach-O only.
33 - Architectures other than arm64.
34 - LTO / bitcode.
35
36 ## License
37
38 GPL-3.0-only.