Merge branch 'ldso-cleanup' into 'master'

tackle some clippy lints in ld_so

See merge request redox-os/relibc!1090
This commit is contained in:
Jeremy Soller
2026-03-14 08:50:04 -06:00
4 changed files with 9 additions and 11 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ use core::{
sync::atomic::{AtomicBool, Ordering},
};
pub const CHAR_BITS: usize = size_of::<c_char>() * 8;
pub const CHAR_BITS: usize = c_char::BITS as usize;
pub type Relr = usize;
#[cfg(target_pointer_width = "32")]
@@ -432,7 +432,7 @@ impl DSO {
let (_, sym) = self.dynamic.hash_table.find(
name,
None,
&self.dynamic.symbols,
self.dynamic.symbols,
self.dynamic.dynstrtab,
&VersionTable::default(),
)?;
+2 -1
View File
@@ -754,7 +754,8 @@ impl Linker {
///
/// If a dependency has already been loaded, it is *not* added to the scope
/// nor to `new_objects`.
fn load_objects_recursive<'a>(
#[allow(clippy::too_many_arguments)]
fn load_objects_recursive(
&mut self,
name: &str,
parent_runpath: &Option<String>,
+2 -2
View File
@@ -101,11 +101,11 @@ pub fn static_init(
let page_size = Sys::getpagesize();
let voff = p_vaddr % page_size;
// let vaddr = ph.p_vaddr as usize - voff;
let vsize = ((p_memsz + voff + page_size - 1) / page_size) * page_size;
let vsize = (p_memsz + voff).div_ceil(page_size) * page_size;
if p_type == elf::PT_TLS {
let valign = if p_align > 0 {
((p_memsz + (p_align - 1)) / p_align) * p_align
p_memsz.div_ceil(p_align) * p_align
} else {
p_memsz
};
+3 -6
View File
@@ -206,7 +206,7 @@ pub unsafe extern "C" fn relibc_ld_so_start(
} else {
let ph = phdrs
.iter()
.find(|ph| ph.p_type(NativeEndian) == PT_DYNAMIC as u32)
.find(|ph| ph.p_type(NativeEndian) == PT_DYNAMIC)
.unwrap();
unsafe { dynamic.byte_sub(ph.p_vaddr(NativeEndian) as usize) as usize }
};
@@ -266,11 +266,8 @@ pub unsafe extern "C" fn relibc_ld_so_start(
for reloc in relocs {
let reloc: Relocation = reloc.into();
let ptr = (reloc.offset + self_base) as *mut usize;
match reloc.kind {
RelocationKind::RELATIVE => {
unsafe { *ptr = self_base + reloc.addend.unwrap_or_default() };
}
_ => {}
if reloc.kind == RelocationKind::RELATIVE {
unsafe { *ptr = self_base + reloc.addend.unwrap_or_default() };
}
}
}