-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Preserve metadata w/ Solaris-like linkers. #85772
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
@luqmana UPD: Looks like the old doc also talks about dynamic libraries
, it's just clarified better in later versions. |
Some relevant PRs:
|
If |
Not solaris exactly but I do have access to an illumos system which is where I ran into the issue. From
|
I'm fine with alternatively wrapping the metadata object with |
Looks like I've been looking at a wrong doc all this time, the illumos doc (https://illumos.org/man/1/ld) explicitly says that |
Definitely sure this applies to illumos, but I'm pretty sure this applies to Solaris itself too:
|
cc @jclulow |
I can definitely give #84449 a try to make sure it works fine on illumos. But I don't think it addresses the issue in this PR as it seems to be focused on metadata in rlibs whereas this issue specifically is for dylibs/proc-macros. (See |
Sorry for the delay, busy week. I made myself an OpenIndiana virtual machine today and it seems to work, so I'll be able to experiment with fine-grained |
📌 Commit cffef33 has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#85436 (Avoid cloning cache key) - rust-lang#85772 (Preserve metadata w/ Solaris-like linkers.) - rust-lang#85920 (Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld.) - rust-lang#85930 (Update standard library for IntoIterator implementation of arrays ) - rust-lang#85972 (Rustdoc html fixes) - rust-lang#86028 (Drop an `if let` that will always succeed) - rust-lang#86043 (don't clone attrs) - rust-lang#86047 (Don't fire `invalid_doc_attributes` on `extern crate` items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
#84468 moved the
-zignore
linker flag from thegc_sections
method toadd_as_needed
which is more accurate but Solaris-style linkers will also end up removing an unreferenced ELF sections [1]. This had the unfortunate side effect of causing the.rustc
section (which has the metada) to be removed which could cause issues when trying to link against the resulting crates or use proc macros.Since the
-zignore
is positional, we fix this by moving the metadata objects to before the flag.[1] Specifically a section is considered unreferenced if:
https://docs.oracle.com/cd/E19683-01/817-3677/6mj8mbtbs/index.html#chapter4-19