Skip to content

Commit

Permalink
chore: bump rust version, update goblin, satisfy Clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Zak <[email protected]>
  • Loading branch information
rjzak committed Mar 9, 2024
1 parent b72b894 commit 2ddf963
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "vdso"
version = "0.2.2"
authors = ["Nathaniel McCallum <[email protected]>"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.65"
license = "Apache-2.0"
homepage = "https://github.com/enarx/vdso"
repository = "https://github.com/enarx/vdso"
Expand All @@ -28,4 +28,4 @@ libc = "0.2.67"

[dependencies]
crt0stack = "0.1"
goblin = "0.6.0"
goblin = "0.8.0"
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.56"
channel = "1.65"
profile = "minimal"
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::os::raw::c_char;
use std::slice::from_raw_parts;

#[cfg(target_pointer_width = "64")]
#[allow(unused_imports)]
mod elf {
pub use goblin::elf64::dynamic::*;
pub use goblin::elf64::header::*;
Expand All @@ -23,6 +24,7 @@ mod elf {
}

#[cfg(target_pointer_width = "32")]
#[allow(unused_imports)]
mod elf {
pub use goblin::elf32::dynamic::*;
pub use goblin::elf32::header::*;
Expand Down Expand Up @@ -82,15 +84,15 @@ impl Header {
let symstrtab: &[c_char] = self.section(elf::SHT_STRTAB)?;
let symtab: &[elf::Sym] = self.section(elf::SHT_DYNSYM)?;

// Yes, we could spead up the lookup by checking against the hash
// Yes, we could speed up the lookup by checking against the hash
// table. But the reality is that there is less than a dozen symbols
// in the vDSO, so the gains are trivial.

for sym in symtab {
let cstr = CStr::from_ptr(&symstrtab[sym.st_name as usize]);
if let Ok(s) = cstr.to_str() {
if s == name {
let addr = self.ptr(sym.st_value) as *const Symbol;
let addr = self.ptr(sym.st_value);
return Some(&*addr);
}
}
Expand Down

0 comments on commit 2ddf963

Please sign in to comment.