Repository navigation
Link Linux builds with mold; line tables only for debug builds #749
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
Open
xbmc4lyfe
wants to merge
2
commits into
main
Choose a base branch
from
linux-mold-linker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Linux builds link with mold through scripts/link-mold.sh, which stops the build with an | ||
| # install hint when mold is missing. The wrapper is set as the linker rather than through | ||
| # `rustflags`, because an environment RUSTFLAGS (`-D warnings`, the `-C target-cpu` tiers | ||
| # set by `just build`) replaces config rustflags and would silently drop the linker choice. | ||
| # Cargo resolves this relative path against the repository root. Cargo reads this file only | ||
| # when it runs inside the repository (cwd, not --manifest-path, decides), so run it from here; | ||
| # `just`, build-deb.sh and the harnesses do. macOS keeps Apple's linker. | ||
| [target.x86_64-unknown-linux-gnu] | ||
| linker = "scripts/link-mold.sh" | ||
|
|
||
| [target.aarch64-unknown-linux-gnu] | ||
| linker = "scripts/link-mold.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ docker/config | |
| !/.gitignore | ||
| !/.gitattributes | ||
| !/.vale.ini | ||
| !/.cargo/ | ||
| !.github/ | ||
| !.github/** | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/sh | ||
| # Cargo's linker for Linux builds (see .cargo/config.toml): the system C compiler | ||
| # driver, told to link with mold. mold links the test binaries and the daemon several | ||
| # times faster than GNU ld, and faster than the rust-lld Rust uses on x86_64 by default. | ||
| # | ||
| # A missing mold is an error, never a silent fallback to another linker, so a build | ||
| # host without it is noticed and fixed instead of quietly building slower. | ||
| if ! command -v ld.mold >/dev/null 2>&1; then | ||
| echo "error: RustyGet links Linux builds with mold, which is not installed." >&2 | ||
| echo " Debian/Ubuntu: sudo apt install mold Fedora: sudo dnf install mold" >&2 | ||
| echo " Arch: sudo pacman -S mold (see site/content/install.md)" >&2 | ||
| exit 1 | ||
| fi | ||
| # -fuse-ld comes last so it overrides the -fuse-ld=lld rustc passes on x86_64. | ||
| exec "${RUSTYGET_LINK_CC:-cc}" "$@" -fuse-ld=mold | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux CI runners without
ld.mold, this new guard terminates linking, but.github/workflows/build.ymlstill installs onlybuild-essential pkg-config libssl-dev just python3 par2before runningcargo test. The required Linux x86_64 and arm64 build jobs therefore fail instead of testing the change..github/workflows/nativeness.ymlalso omits mold before its Clippy invocation. Add the dependency to both workflows in the same change rather than leaving CI provisioning as a follow-up. This also conflicts withAGENTS.md's requirement that “A change must also build and pass on Linux.”AGENTS.md reference: AGENTS.md:L65-L69
Useful? React with 👍 / 👎.