1
Fork 0

Use llvm.compiler.used insetad of llvm.used

The #[used] attribute explicitly only requires symbols to be
retained in object files, but allows the linker to drop them
if dead. This corresponds to llvm.compiler.used semantics.

The motivation to change this *now* is that https://reviews.llvm.org/D97448
starts emitting #[used] symbols into unique sections with
SHF_GNU_RETAIN flag. This triggers a bug in some version of gold,
resulting in the ARGV_INIT_ARRAY symbol part of the .init_array
section to be incorrectly placed.
This commit is contained in:
Nikita Popov 2021-08-07 17:04:32 +02:00
parent 154c8408e9
commit 7c015648dd
5 changed files with 16 additions and 8 deletions

View file

@ -178,7 +178,7 @@ declare_features! (
/// Allows annotating functions conforming to `fn(&PanicInfo) -> !` with `#[panic_handler]`.
/// This defines the behavior of panics.
(accepted, panic_handler, "1.30.0", Some(44489), None),
/// Allows `#[used]` to preserve symbols (see llvm.used).
/// Allows `#[used]` to preserve symbols (see llvm.compiler.used).
(accepted, used, "1.30.0", Some(40289), None),
/// Allows `crate` in paths.
(accepted, crate_in_paths, "1.30.0", Some(45477), None),