Add test that __rg_oom doesn't get internalized during LTO
Co-Authored-By: Rémy Rakic <remy.rakic+github@gmail.com>
This commit is contained in:
parent
0271359768
commit
9239d141dc
1 changed files with 19 additions and 0 deletions
19
tests/ui/lto/lto-global-allocator.rs
Normal file
19
tests/ui/lto/lto-global-allocator.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
//@ compile-flags: --crate-type cdylib -C lto
|
||||
//@ build-pass
|
||||
//@ no-prefer-dynamic
|
||||
//@ needs-crate-type: cdylib
|
||||
|
||||
use std::alloc::{GlobalAlloc, Layout};
|
||||
|
||||
struct MyAllocator;
|
||||
|
||||
unsafe impl GlobalAlloc for MyAllocator {
|
||||
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
|
||||
}
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL: MyAllocator = MyAllocator;
|
||||
Loading…
Add table
Add a link
Reference in a new issue