Skip to content

Commit 4ccc99f

Browse files
committed
Fix compilation for armv7-unknown-linux-gnueabihf target
1 parent a433e27 commit 4ccc99f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stronghold-runtime": patch
3+
---
4+
5+
Fixed compilation for armv7-unknown-linux-gnueabihf target.

engine/runtime/src/memories/frag.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ where
218218

219219
let default_page_size = 0x1000i64;
220220

221+
#[allow(clippy::useless_conversion)]
221222
let pagesize = nix::unistd::sysconf(nix::unistd::SysconfVar::PAGE_SIZE)
222-
.unwrap_or(Some(default_page_size))
223+
.unwrap_or(Some(default_page_size.try_into().unwrap()))
223224
.unwrap() as usize;
224225

225226
info!("Using page size {}", pagesize);
@@ -257,7 +258,7 @@ where
257258
return Err(MemoryError::Allocation("Memory mapping failed".to_string()));
258259
}
259260

260-
#[cfg(any(target_os = "macos"))]
261+
#[cfg(target_os = "macos")]
261262
{
262263
// on linux this isn't required to commit memory
263264
let error = libc::madvise(&mut addr as *mut usize as *mut libc::c_void, size, libc::MADV_WILLNEED);
@@ -374,8 +375,9 @@ where
374375
// pick a default, if system api call is not successful
375376
let default_page_size = 0x1000i64;
376377

378+
#[allow(clippy::useless_conversion)]
377379
let _pagesize = nix::unistd::sysconf(nix::unistd::SysconfVar::PAGE_SIZE)
378-
.unwrap_or(Some(default_page_size))
380+
.unwrap_or(Some(default_page_size.try_into().unwrap()))
379381
.unwrap() as usize;
380382

381383
// We allocate a sufficiently "large" chunk of memory. A random
@@ -420,7 +422,7 @@ where
420422

421423
#[cfg(any(target_os = "linux", target_os = "macos"))]
422424
fn dealloc(frag: &mut Frag<T>) -> Result<(), Self::Error> {
423-
dealloc_direct(frag.info.0 as *mut libc::c_void)
425+
dealloc_direct(frag.info.0)
424426
}
425427

426428
#[cfg(target_os = "windows")]

0 commit comments

Comments
 (0)