Skip to content

darwin: Allow posix_spawn_file_actions_addchdir to be missing when linking against process#377

Merged
tomjaguarpaw merged 1 commit into
masterfrom
wip/process-darwin-spawn-addchdir
Jun 11, 2026
Merged

darwin: Allow posix_spawn_file_actions_addchdir to be missing when linking against process#377
tomjaguarpaw merged 1 commit into
masterfrom
wip/process-darwin-spawn-addchdir

Conversation

@wz1000

@wz1000 wz1000 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

In 0699e41 we attempted to account for darwin toolchains missing this symbol, which is imported as a weak references.

However, weak references on MachO objects don't work the same way as on ELF (see iains/gcc-darwin-arm64#133). A final link with undefined weak references still fails.

To fix this, on darwin, we explicilty add -Wl,-U,_posix_spawn_file_actions_addchdir to ld-options so anything linking against process explicilty instructs the linker to ignore undefined references to this symbol (set it to NULL at runtime).

Fixes #376

…nking against process

In 0699e41 we attempted to account for darwin toolchains missing this
symbol, which is imported as a weak references.

However, weak references on MachO objects don't work the same way as on ELF (see iains/gcc-darwin-arm64#133).
A final link with undefined weak references still fails.

To fix this, on darwin, we explicilty add `-Wl,-U,_posix_spawn_file_actions_addchdir` to `ld-options` so anything linking against
process explicilty instructs the linker to ignore undefined references to this symbol (set it to NULL at runtime).

Fixes #376
@wz1000 wz1000 force-pushed the wip/process-darwin-spawn-addchdir branch from e7f0437 to 6c70b60 Compare June 10, 2026 05:02
@tomjaguarpaw

Copy link
Copy Markdown
Member

@MangoIV, can you comment on this?

@wz1000

wz1000 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

This should supersede #375, but we will validate this against GHC CI and get back to you.

@MangoIV

MangoIV commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

I think this is a good fix. Since my solution doesn’t seem to work on its own, either, I think this is good. I wonder whether we should do both, though. Probably not right now though since this is the minimal fix

@tomjaguarpaw

Copy link
Copy Markdown
Member

OK, and this is urgent due to impending GHC release, right?

@MangoIV

MangoIV commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

yes, this is blocking the upcoming GHC releases.

@tomjaguarpaw tomjaguarpaw merged commit 081926a into master Jun 11, 2026
104 checks passed
@tomjaguarpaw tomjaguarpaw deleted the wip/process-darwin-spawn-addchdir branch June 11, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix for #356 is incomplete, resulting in link errors on macos on certain configurations.

3 participants