Stream: git-wasmtime

Topic: wasmtime / PR #13481 cranelift-object: emit PLATFORM_MACO...


view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 17:00):

darmie opened PR #13481 from darmie:fix/cranelift-object-darwin-platform to bytecodealliance:main:

cranelift_native produces a Darwin(_) triple on macOS hosts, which falls through to PLATFORM_UNKNOWN (0) in the Mach-O LC_BUILD_VERSION load command. macOS ld64 rejects object files with an unknown platform, breaking native object emission on Darwin hosts.

Gate on #[cfg(target_os = "macos")] so the override only fires when the host (and therefore the linker likely consuming the object) is itself macOS. Cross-compile pipelines that produce Darwin objects from a non-macOS host keep upstream PLATFORM_UNKNOWN behaviour — the issue is specific to ld64's host-side rejection. Map Darwin(_) to PLATFORM_MACOS the same way MacOSX(_) is mapped. Expected to dovetail with target-lexicon PR #130 once that's available upstream.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 17:00):

darmie requested cfallin for a review on PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 17:00):

darmie requested wasmtime-compiler-reviewers for a review on PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 17:55):

darmie edited PR #13481:

cranelift_native produces a Darwin(_) triple on macOS hosts, which falls through to PLATFORM_UNKNOWN (0) in the Mach-O LC_BUILD_VERSION load command. macOS ld64 rejects object files with an unknown platform, breaking native object emission on Darwin hosts.

Gate on #[cfg(target_os = "macos")] so the override only fires when the host (and therefore the linker likely consuming the object) is itself macOS. Cross-compile pipelines that produce Darwin objects from a non-macOS host keep upstream PLATFORM_UNKNOWN behaviour — the issue is specific to ld64's host-side rejection. Map Darwin(_) to PLATFORM_MACOS the same way MacOSX(_) is mapped. Expected to dovetail with target-lexicon PR #130.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 22:11):

github-actions[bot] added the label cranelift on PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 22:11):

github-actions[bot] added the label cranelift:module on PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 23:32):

:memo: cfallin submitted PR review:

Thanks -- some thoughts below.

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 23:32):

:speech_balloon: cfallin created PR review comment:

This comment is pretty verbose for what (in my reading) is basically a note that an undefined platform is problematic, and Darwin is more or less macOS for our purposes. We could probably omit it?

view this post on Zulip Wasmtime GitHub notifications bot (May 26 2026 at 23:32):

:speech_balloon: cfallin created PR review comment:

It doesn't seem right to me that we would change compiler behavior based on the host platform; a target is a target and we should generate identical binaries for that target no matter where we run. I see the note above that this "keeps the upstream PLATFORM_UNKOWN behavior" (a descriptive statement) but why?

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:11):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:11):

:speech_balloon: darmie created PR review comment:

@cfallin On my Mac (Apple M1), the triple.operating_system kept returning Darwin instead of MacOSX, and that fell through to PLATFORM_UNKNOWN, and that prevented native object emission. Darwin was never captured on that block of code, and I didn't want to generalise the fix to all Darwin targets. This is a mere redirection. Do you reckon that this fix could be applied elsewhere in the code base?

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:15):

darmie updated PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:18):

darmie updated PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:18):

:memo: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:18):

:speech_balloon: cfallin created PR review comment:

Yes, I agree we should fix the code to make Darwin a known platform. The thing I'm objecting to is changing the compiler's output based on its host platform (what the cfg directive does) -- the output that we produce should be a pure function of the input and configuration, and nothing else. cfg directives based on host platform are only appropriate in e.g. the Wasmtime runtime where the host platform is the target.

So concretely I think we should remove this cfg line. I'm not even sure what non-macOS Darwin platforms would be for cranelift-object (... running cg-clif natively on iOS? I'm not sure); and if we want ot handle those properly, we should reason about them as targets, not as hosts.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:19):

:memo: darmie submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:19):

:speech_balloon: darmie created PR review comment:

Update: @cfallin I have removed the cfg-target line

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:20):

:thumbs_up: cfallin submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:20):

cfallin has enabled auto merge for PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:28):

cfallin added PR #13481 cranelift-object: emit PLATFORM_MACOS for Darwin triples on macOS hosts to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:52):

:check: cfallin merged PR #13481.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2026 at 06:52):

cfallin removed PR #13481 cranelift-object: emit PLATFORM_MACOS for Darwin triples on macOS hosts from the merge queue.


Last updated: Jun 01 2026 at 09:49 UTC