Update crates and upgrade to elf v0.7

This commit is contained in:
pjht 2022-11-16 10:40:26 -06:00
parent c6e96f3592
commit 6e61c5402d
3 changed files with 9 additions and 8 deletions

8
Cargo.lock generated
View File

@ -239,9 +239,9 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]] [[package]]
name = "elf" name = "elf"
version = "0.6.1" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c09b5bbd5d4c1318fd4825d697b8117506fc36ab9680bdd792f65a2acbdf1ed" checksum = "6de42b0529467fc9a2692fd91585c84dd255fb15b0df0f80299724a9456986c6"
[[package]] [[package]]
name = "errno" name = "errno"
@ -1032,9 +1032,9 @@ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]] [[package]]
name = "wyz" name = "wyz"
version = "0.5.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
dependencies = [ dependencies = [
"tap", "tap",
] ]

View File

@ -9,7 +9,7 @@ edition = "2021"
anyhow = "1.0.66" anyhow = "1.0.66"
bitvec = "1.0.0" bitvec = "1.0.0"
derive-try-from-primitive = "1.0.0" derive-try-from-primitive = "1.0.0"
elf = "0.6.0" elf = "0.7.0"
human-repr = { version = "1.0.1", features = ["iec", "space"] } human-repr = { version = "1.0.1", features = ["iec", "space"] }
indexmap = "1.9.1" indexmap = "1.9.1"
inventory = "0.3.1" inventory = "0.3.1"

View File

@ -1,7 +1,8 @@
use crate::symbol::Symbol; use crate::symbol::Symbol;
use anyhow::anyhow; use anyhow::anyhow;
use elf::gabi::{STT_FILE, STT_SECTION}; use elf::abi::{STT_FILE, STT_SECTION};
use elf::CachedReadBytes; use elf::endian::AnyEndian;
use elf::ElfStream;
use indexmap::IndexSet; use indexmap::IndexSet;
use itertools::Itertools; use itertools::Itertools;
use std::collections::HashMap; use std::collections::HashMap;
@ -58,7 +59,7 @@ impl SymbolTable {
} }
pub fn read_from_file(path: &str) -> anyhow::Result<Self> { pub fn read_from_file(path: &str) -> anyhow::Result<Self> {
let mut file = elf::File::open_stream(CachedReadBytes::new(File::open(path)?))?; let mut file = ElfStream::<AnyEndian, _>::open_stream(File::open(path)?)?;
let (symtab, symstrtab) = file let (symtab, symstrtab) = file
.symbol_table()? .symbol_table()?
.ok_or_else(|| anyhow!("No symbol table in {}", path))?; .ok_or_else(|| anyhow!("No symbol table in {}", path))?;