diff options
| author | iximeow <iximeow@oxide.computer> | 2025-09-28 03:21:45 +0000 |
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2025-10-03 22:03:24 +0000 |
| commit | c721fa243825255c0f195d4282021e7c263c3e7f (patch) | |
| tree | fcb4d7cb9018fcae2736d2ac81c40d10c55deaa0 /compiler/rustc_span/src/symbol.rs | |
| parent | e1318422222101423fdbbe0f375109c3b40f75bc (diff) | |
| download | rust-c721fa243825255c0f195d4282021e7c263c3e7f.tar.gz rust-c721fa243825255c0f195d4282021e7c263c3e7f.zip | |
interpret #[used] as #[used(compiler)] on illumos
illumos' `ld` does not support a flag like either SHF_GNU_RETAIN or SHF_SUNW_NODISCARD, so there is no way to communicate `#[used(linker)]` for that target. Setting `USED_LINKER` to try results in LLVM setting SHF_SUNW_NODISCARD for Solaris-like targets, which is an unknown section header flag for illumos `ld` and prevents sections from being merged that otherwise would. As a motivating example, the `inventory` crate produces `#[used]` items to merge into `.init_array`. Because those items have an unknown section header flag they are not merged with the default `.init_array` with `frame_dummy`, and end up never executed. Downgrading `#[used]` to `#[used(compiler)]` on illumos keeps so-attributed items as preserved as they had been before https://github.com/rust-lang/rust/pull/140872. As was the case before that change, because rustc passes `-z ignore` to illumos `ld`, it's possible that `used` sections are GC'd at link time. https://github.com/rust-lang/rust/issues/146169 describes this unfortunate circumstance.
Diffstat (limited to 'compiler/rustc_span/src/symbol.rs')
0 files changed, 0 insertions, 0 deletions
