Fix build failure on aarch64 - #2
Conversation
| /// whether AVX-512 is being used or not. | ||
| #[no_mangle] | ||
| pub static _DR_CLIENT_AVX512_CODE_IN_USE: i8 = dynamorio_sys::_DR_CLIENT_AVX512_CODE_IN_USE_; | ||
| pub static _DR_CLIENT_AVX512_CODE_IN_USE: dynamorio_sys::bool_ = |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| dr_module_set_should_instrument((*self.raw).__bindgen_anon_1.handle, instrumented as i8); | ||
| dr_module_set_should_instrument( | ||
| (*self.raw).__bindgen_anon_1.handle, | ||
| instrumented as dynamorio_sys::bool_, |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| dr_rename_file(from.as_ptr(), to.as_ptr(), true as i8) != 0 | ||
| }; | ||
| let result = | ||
| unsafe { dr_rename_file(from.as_ptr(), to.as_ptr(), true as dynamorio_sys::bool_) != 0 }; |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
|
I took a look at the clippy CI failure. I think there's an easy fix. I'll submit a follow up PR. |
A C `char` may be signed or unsigned depending on the architecture. Most notably, it is unsigned on aarch64. Due to this difference, `dynamorio-rs` and `drstd` cannot be compiled on aarch64 as-is. This commit fixes some assumptions about bool being represented as `i8`. This commit also contains other formatting changes as a result of running `cargo fmt` on the repository.
| dynamorio_sys::bool_, | ||
| dynamorio_sys::bool_, |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| dynamorio_sys::bool_, | ||
| dynamorio_sys::bool_, |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| dynamorio_sys::bool_, | ||
| dynamorio_sys::bool_, |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| context: *mut core::ffi::c_void, | ||
| module: *const module_data_t, | ||
| loaded: i8, | ||
| loaded: dynamorio_sys::bool_, |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| let func: extern "C" fn(*mut core::ffi::c_void, i32) -> i8 = unsafe { | ||
| core::mem::transmute(self.closure.code()) | ||
| }; | ||
| let func: extern "C" fn(*mut core::ffi::c_void, i32) -> dynamorio_sys::bool_ = |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| ) -> dynamorio_sys::bool_ { | ||
| let mut context = BeforeSyscallContext::from_raw(context); | ||
| let handler = unsafe { &*(user_data as *mut Mutex<T>) }; | ||
| let mut result = 0; | ||
| let mut result = false; | ||
|
|
||
| if let Ok(mut handler) = handler.lock() { | ||
| result = handler.before_syscall(&mut context, sysnum) as i8; | ||
| result = handler.before_syscall(&mut context, sysnum); | ||
| } | ||
|
|
||
| result | ||
| result as dynamorio_sys::bool_ |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
| let func: extern "C" fn(*mut core::ffi::c_void, i32) -> i8 = unsafe { | ||
| core::mem::transmute(closure.code()) | ||
| }; | ||
| let func: extern "C" fn(*mut core::ffi::c_void, i32) -> dynamorio_sys::bool_ = |
There was a problem hiding this comment.
Use DR's bool_ type instead of assuming i8.
|
I've marked all the non-formatting changes. |
|
A C
charmay be signed or unsigned depending on the architecture. Most notably, it is unsigned on aarch64. Due to this difference,dynamorio-rsanddrstdcannot be compiled on aarch64 as-is. This commit fixes some assumptions about bool being represented asi8. This commit also contains other formatting changes as a result of runningcargo fmton the repository.I will mark all the non-formatting changes in the PR.