Skip to content
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

metadata: Ignore sysroot when doing the manual native lib search in rustc #138273

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Mar 9, 2025

This is the opposite alternative to #138170 and another way to make native library search consistent between rustc and linker.

This way the directory list searched by rustc is still a prefix of the directory list considered by linker, but it's a shorter prefix than in #138170.
We can include the sysroot directories into rustc's search again later if the issues with #138170 are resolved, it will be a backward compatible change.

This may break some code doing weird things on unstable rustc, or tier 2-3 targets, like bundling libunwind.a or sanitizers into something.
Note that this doesn't affect shipped libc.a, because it lives in self-contained directories in sysroot, and self-contained sysroot is already not included into the rustc's search. All libunwind and sanitizer libs should be moved to self-contained sysroot too eventually.

With the consistent search directory list between rustc and linker we can make rustc own the native library search (at least for static libs) and use linker search only as a fallback (like in #123436). This will allow addressing issues like #132394 once and for all on all targets.

r? @bjorn3

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 9, 2025
@petrochenkov
Copy link
Contributor Author

@bors rollup=iffy

@bjorn3
Copy link
Member

bjorn3 commented Mar 12, 2025

@bors r+

@bors
Copy link
Contributor

bors commented Mar 12, 2025

📌 Commit d577883 has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 13, 2025
metadata: Ignore sysroot when doing the manual native lib search in rustc

This is the opposite alternative to rust-lang#138170 and another way to make native library search consistent between rustc and linker.

This way the directory list searched by rustc is still a prefix of the directory list considered by linker, but it's a shorter prefix than in rust-lang#138170.
We can include the sysroot directories into rustc's search again later if the issues with rust-lang#138170 are resolved, it will be a backward compatible change.

This may break some code doing weird things on unstable rustc, or tier 2-3 targets, like bundling `libunwind.a` or sanitizers into something.
Note that this doesn't affect shipped `libc.a`, because it lives in `self-contained` directories in sysroot, and `self-contained` sysroot is already not included into the rustc's search. All libunwind and sanitizer libs should be moved to `self-contained` sysroot too eventually.

With the consistent search directory list between rustc and linker we can make rustc own the native library search (at least for static libs) and use linker search only as a fallback (like in rust-lang#123436). This will allow addressing issues like rust-lang#132394 once and for all on all targets.

r? `@bjorn3`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#126856 (remove deprecated tool `rls`)
 - rust-lang#133981 (rustdoc-json: Refractor and document Id's)
 - rust-lang#136842 (Add libstd support for Trusty targets)
 - rust-lang#137355 (Implement `read_buf` and vectored read/write for SGX stdio)
 - rust-lang#137457 (fix for issue 132802: x86 code in `wasm32-unknown-unknown` binaries)
 - rust-lang#138162 (Update the standard library to Rust 2024)
 - rust-lang#138273 (metadata: Ignore sysroot when doing the manual native lib search in rustc)
 - rust-lang#138346 (naked functions: on windows emit `.endef` without the symbol name)
 - rust-lang#138370 (Simulate OOM for the `try_oom_error` test)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#126856 (remove deprecated tool `rls`)
 - rust-lang#133981 (rustdoc-json: Refractor and document Id's)
 - rust-lang#136842 (Add libstd support for Trusty targets)
 - rust-lang#137355 (Implement `read_buf` and vectored read/write for SGX stdio)
 - rust-lang#138162 (Update the standard library to Rust 2024)
 - rust-lang#138273 (metadata: Ignore sysroot when doing the manual native lib search in rustc)
 - rust-lang#138346 (naked functions: on windows emit `.endef` without the symbol name)
 - rust-lang#138370 (Simulate OOM for the `try_oom_error` test)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5ae93cf into rust-lang:master Mar 13, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 13, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2025
Rollup merge of rust-lang#138273 - petrochenkov:nonatroot, r=bjorn3

metadata: Ignore sysroot when doing the manual native lib search in rustc

This is the opposite alternative to rust-lang#138170 and another way to make native library search consistent between rustc and linker.

This way the directory list searched by rustc is still a prefix of the directory list considered by linker, but it's a shorter prefix than in rust-lang#138170.
We can include the sysroot directories into rustc's search again later if the issues with rust-lang#138170 are resolved, it will be a backward compatible change.

This may break some code doing weird things on unstable rustc, or tier 2-3 targets, like bundling `libunwind.a` or sanitizers into something.
Note that this doesn't affect shipped `libc.a`, because it lives in `self-contained` directories in sysroot, and `self-contained` sysroot is already not included into the rustc's search. All libunwind and sanitizer libs should be moved to `self-contained` sysroot too eventually.

With the consistent search directory list between rustc and linker we can make rustc own the native library search (at least for static libs) and use linker search only as a fallback (like in rust-lang#123436). This will allow addressing issues like rust-lang#132394 once and for all on all targets.

r? ``@bjorn3``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants