Skip to content

Commit

Permalink
Fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
byeongkeunahn committed Sep 8, 2024
1 parent 270ccca commit 09cdb5b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion basm-std/src/platform/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
use core::arch::asm;

use crate::platform;
#[cfg(not(any(target_arch = "wasm32", all(target_os = "macos", target_arch = "aarch64"))))]
#[cfg(not(any(
target_arch = "wasm32",
all(target_os = "macos", target_arch = "aarch64")
)))]
use crate::platform::loader;

/* We need to support multiple scenarios.
Expand Down
13 changes: 7 additions & 6 deletions basm-std/src/platform/loader/aarch64_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const DT_RELAENT: u64 = 9;
#[repr(C, packed)]
struct Elf64Dyn {
d_tag: u64,
d_val_or_ptr: u64
d_val_or_ptr: u64,
}

#[repr(C, packed)]
struct Elf64Rela {
r_offset: u64,
r_info: u64,
r_addend: u64
r_addend: u64,
}

unsafe fn locate_dynamic_hdr(addr_dynamic_section: u64, d_tag: u64) -> *const Elf64Dyn {
Expand All @@ -38,9 +38,10 @@ pub unsafe extern "C" fn relocate(addr_image_base: u64, addr_dynamic_section: u6
let dyn_ptr_relasz = locate_dynamic_hdr(addr_dynamic_section, DT_RELASZ);
let dyn_ptr_relaent = locate_dynamic_hdr(addr_dynamic_section, DT_RELAENT);

if dyn_ptr_rela == core::ptr::null() ||
dyn_ptr_relasz == core::ptr::null() ||
dyn_ptr_relaent == core::ptr::null() {
if dyn_ptr_rela == core::ptr::null()
|| dyn_ptr_relasz == core::ptr::null()
|| dyn_ptr_relaent == core::ptr::null()
{
return;
}

Expand All @@ -63,4 +64,4 @@ pub unsafe extern "C" fn relocate(addr_image_base: u64, addr_dynamic_section: u6
rela_addr += relaent;
}
}
}
}
6 changes: 3 additions & 3 deletions basm-std/src/platform/loader/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
pub mod aarch64_elf;
#[cfg(all(target_arch = "x86_64", not(target_os = "windows")))]
pub mod amd64_elf;
#[cfg(all(target_arch = "x86_64", target_os = "windows"))]
pub mod amd64_pe;
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
pub mod aarch64_elf;
#[cfg(all(target_arch = "x86", not(target_os = "windows")))]
pub mod i686_elf;
pub mod i686_elf;

0 comments on commit 09cdb5b

Please sign in to comment.