Skip to content

Support linking modifiers #689

Closed
@lf-

Description

@lf-

Since a recent stabilization, rustc supports modifiers such as whole-archive for doing linking (rust-lang/rust#93901 (comment)). whole-archive is useful for cdylib crates that do their main initialization with ctors and thus are liable to have the C components be garbage collected by the linker to confusing results.

Currently it seems that cc emits the rustc-link-lib directive to cargo in such a way that it isn't possible to specify modifiers: https://docs.rs/cc/latest/src/cc/lib.rs.html#1017

It would be great if these modifiers could be specified in the Build builder.

docs on rustc side: https://doc.rust-lang.org/rustc/command-line-arguments.html#-l-link-the-generated-crate-to-a-native-library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions