Skip to content

subsecond/cli: fix linker and passing through -fuse-ld properly #4222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025

Conversation

laundmo
Copy link
Contributor

@laundmo laundmo commented May 29, 2025

in LinkAction, dunce::canonicalize(linker) was being called, which resulted in a "file not found" IoError as it tried to find the linker relative to the workdir, even though linker="command_on_PATH" is accepted by Cargo. This falls back to using the linker command directly in those cases.

This used to only pass through -Wl,-fuse-ld=mold when thin linking, but Rustflags uses -C link-arg=-fuse-ld=mold which causes -fuse-ld=mold to be passed. This PR adds that case.

These changes present a big annoyance with setting up subsecond to use a linker besides the default, like Mold. With this PR the following .cargo/config.toml works as expected:

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
    "-C",
    "link-arg=-fuse-ld=mold",
]

Closes:

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.

2 participants