mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-03 04:37:57 +00:00
Fix #142284 by ensuring that `#![no_builtins]` crates can still emit bitcode when proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) is used.
23 lines
472 B
Rust
23 lines
472 B
Rust
// Verifies that `#![no_builtins]` crates can be built with linker-plugin-lto and CFI.
|
|
// See Issue #142284
|
|
//
|
|
//@ needs-sanitizer-cfi
|
|
//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
|
|
//@ compile-flags: --crate-type rlib
|
|
//@ build-pass
|
|
|
|
#![no_builtins]
|
|
#![no_std]
|
|
|
|
pub static FUNC: fn() = initializer;
|
|
|
|
pub fn initializer() {
|
|
call(fma_with_fma);
|
|
}
|
|
|
|
pub fn call(fn_ptr: fn()) {
|
|
fn_ptr();
|
|
}
|
|
|
|
pub fn fma_with_fma() {}
|