Track: zig's Mach-O LTO support (revisit -flto on osx-aarch64/osx-x86_64)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Domain
- build-system
Research direction
This is a tracking issue with no current action: read issue #70 (the original -flto experiment and JMH results) and scripts/build-zstd.sh to understand the setup. Watch zig release notes for Mach-O LTO or an ld64.lld usable via zig cc -fuse-ld=lld on osx-aarch64/osx-x86_64. Done means: when that lands, re-run the -flto experiment and the JMH benchmarks in benchmark-lto.yml and record whether the Linux compress-regression/decompress-gain pattern holds.
Written by the indexing model from the issue text.
Description
Background
#70 investigated enabling LTO (-flto) in scripts/build-zstd.sh for a compile-time cross-TU inlining win. It works fine on Linux (zig cc links ELF with its bundled real lld), but is currently impossible on macOS:
$ zig cc -target aarch64-macos -O3 -flto -c third_party/zstd/lib/common/xxhash.c -o /tmp/test.o
error: LTO requires using LLD
zig's Mach-O backend is a self-hosted linker, not LLD, so it has no LTO support at all — this reproduces at the -c (compile-only) stage, before any linking. -fuse-ld=lld doesn't help either (no real ld64.lld binary was available to force it).
Separately, even where LTO did work (Linux), the benchmark in #70 showed a net regression on the compress path (zstdJavaBytes -6.2%, zstdJavaSegment -3.7%) versus a smaller decompress gain (+1.9-2.5%) — so LTO was rejected project-wide, not just on macOS. This issue is scoped narrowly to the macOS tooling blocker, in case zig gains Mach-O LTO support and it's ever worth re-benchmarking.
What to watch for
- zig adding LTO support to its self-hosted Mach-O linker, or shipping a real
ld64.lldthatzig cc -fuse-ld=lldcan target on macOS. - Track via zig release notes / changelog for
aarch64-macosandx86_64-macoslinker work.
Revisit when
If Mach-O LTO becomes available via zig cc:
- Re-run the same
-fltoexperiment from #70 onosx-aarch64/osx-x86_64. - Re-benchmark compress/decompress (JMH,
benchmark-lto.yml) — the Linux result (compress regression, decompress gain) may or may not hold on ARM/Mach-O codegen, so don't assume the same disposition applies.
No action needed until then; this issue exists purely to remember to check back.
- Dominant language
- Java
- Stars
- 5
- Forks
- 1
- Avg merge
- 13d 18h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dfa1/zstd-ffm
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
FasterXML/jackson-databind#6443 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainers usually reply within 4 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 Under an hour Newbie friendliness 84/100
cpp-best-practices/project_validator#251 ·
Maintainers usually reply within 1 day