Skip to content

Add a used attribute. #30817

@mahkoh

Description

@mahkoh

This attribute prevents LLVM from removing a symbol even if it can prove that the symbol is not used. This can be simulated with the following code:

#[export_name = "llvm.used"]
#[linkage = "appending"]
static mut _X: [*const u8; 1] = [&F as *const _ as *const _];

which prevents F from being removed.

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