Skip to content

feature gate FFI imports of LLVM intrinsics #20313

@huonw

Description

@huonw

E.g. one can import an intrinsic via

extern {
    #[link_name = "llvm.sqrt.f32"]
    fn sqrt(x: f32) -> f32;
}

AFAIK, LLVM doesn't have guarantees about the stability of intrinsics, so a library usable with Rust 1.0 that does the above may become unusable with Rust 1.x if LLVM is upgraded. Being chaine to a specific LLVM version would be really bad, so we should feature gate link_names that start with llvm..

(Tagging as E-mentor, since I'm happy to help. The relevant code is in syntax::feature_gate.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions