fix(ld.so): use Strtab::get_at()

> use of deprecated method `goblin::strtab::Strtab::<'a>::get`: Bad performance, use get_at() instead

Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
Anhad Singh
2024-12-17 21:38:47 +11:00
parent cc5e0ceebc
commit 959982b8a4
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -147,8 +147,8 @@ impl DSO {
Some(entry) => {
let runpath = elf
.dynstrtab
.get(entry.d_val as usize)
.ok_or(Error::Malformed("Missing RUNPATH in dynstrtab".to_string()))??;
.get_at(entry.d_val as usize)
.ok_or(Error::Malformed("Missing RUNPATH in dynstrtab".to_string()))?;
let base = dirname(path);
return Ok(Some(runpath.replace("$ORIGIN", &base)));
}
@@ -361,8 +361,8 @@ impl DSO {
}
let name: String;
let value: Symbol;
if let Some(name_res) = elf.dynstrtab.get(sym.st_name) {
name = name_res?.to_string();
if let Some(name_res) = elf.dynstrtab.get_at(sym.st_name) {
name = name_res.to_string();
value = if is_pie_enabled(elf) {
Symbol {
base: mmap.as_ptr() as usize,
+2 -2
View File
@@ -509,11 +509,11 @@ impl Linker {
let mut t = 0;
let name =
elf.dynstrtab
.get(sym.st_name)
.get_at(sym.st_name)
.ok_or(Error::Malformed(format!(
"missing name for symbol {:?}",
sym
)))??;
)))?;
let mut symbol = None;
let mut found = false;
let lookup_start = match rel.r_type {