rust/tests/run-make/no-builtins-lto/no_builtins.rs
DianQK 520081721c
Restore #![no_builtins] crates participation in LTO.
After #113716, we can make `#![no_builtins]` crates participate in LTO again.
`#![no_builtins]` with LTO does not result in undefined references to the error.
2023-10-15 21:12:05 +08:00

16 lines
367 B
Rust

#![feature(lang_items, no_core)]
#![no_std]
#![no_core]
#![crate_type = "lib"]
#![no_builtins]
extern crate foo;
#[no_mangle]
pub unsafe fn no_builtins(dest: *mut u8, src: *const u8) {
// There should be no "undefined reference to `foo::foo'".
foo::foo(dest, src);
// should call `@memcpy` instead of `@llvm.memcpy`.
foo::memcpy(dest, src, 1024);
}