Skip to content

Rust version of __attribute(used)__ (GCC) or llvm.used (LLVM). #23577

Closed
@dpc

Description

@dpc

There come times when rust symbols are referenced only by external assembler. It seems rustc is eager to remove them (especially with -C lto, even making them public does not help).

In clang and gcc there are ways to prevent it, correspondingly: __attribute__((used)) and llvm.used`

If there's a way to get the same behavior in Rust? If not, can be added?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions