Skip to content

#[link_args] is not propagated from libraries to binaries #36176

Description

@whitequark

To reproduce:

// foo.rs
#![feature(link_args)]
#[link_args = "-Wl,-just_die"]
extern {}
// main.rs
extern crate foo;
fn main() {}

Build with:

rustc foo.rs --crate-type lib
rustc main.rs -L .

This successfully builds (and it shouldn't, if it would pass the -Wl,-just_die). (--verbose is not usable here because of #36175). If I replace #[link_args] with e.g. #[link(name = "just_die")] then the linker invocation fails, so I believe this is a bug with link_args.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions