1
1
use rustc_span:: Symbol ;
2
- use rustc_target:: abi:: { Align , Size } ;
3
2
use rustc_target:: spec:: abi:: Abi ;
4
3
5
4
use crate :: * ;
@@ -19,30 +18,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
19
18
) -> InterpResult < ' tcx , EmulateItemResult > {
20
19
let this = self . eval_context_mut ( ) ;
21
20
match link_name. as_str ( ) {
22
- // Allocation
23
- "memalign" => {
24
- let [ align, size] =
25
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
26
- let align = this. read_target_usize ( align) ?;
27
- let size = this. read_target_usize ( size) ?;
28
-
29
- // memalign requires the size to be greater than 0, the alignment to be a power of 2
30
- // to be, at least, of word size in which EINVAL is emitted
31
- // and a null pointer is returned.
32
- // https://docs.oracle.com/cd/E88353_01/html/E37843/memalign-3c.html
33
- if !align. is_power_of_two ( ) || align < this. pointer_size ( ) . bytes ( ) || size == 0 {
34
- this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
35
- this. write_null ( dest) ?;
36
- } else {
37
- let ptr = this. allocate_ptr (
38
- Size :: from_bytes ( size) ,
39
- Align :: from_bytes ( align) . unwrap ( ) ,
40
- MiriMemoryKind :: C . into ( ) ,
41
- ) ?;
42
- this. write_pointer ( ptr, dest) ?;
43
- }
44
- }
45
-
46
21
// Miscellaneous
47
22
"___errno" => {
48
23
let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
0 commit comments