Skip to content

Doesn't add elements to distributed slice from external crate on macOS #61

@vikulikov

Description

@vikulikov
use linkme::distributed_slice;
use other_crate::BENCHMARKS;

#[distributed_slice(BENCHMARKS)]
static BENCH_DESERIALIZE: fn(&mut Bencher) = bench_deserialize;

fn bench_deserialize(b: &mut Bencher) {
    /* ... */
}

If BENCHMARKS is initialized in external crate the call to #[distributed_slice(BENCHMARKS)] doesn't add bench_deserialize function to the array. But if I turn on lto=true in Cargo.toml of the builded project (where BENCHMARKS is placed) lib works as expected.
I also tested this on ubuntu and it worked without lto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions