Skip to content

Commit

Permalink
Removes std::borrow::Cow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Sep 27, 2023
1 parent 8afc3cc commit 86b2874
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::{
use crate::jit::{JitCompiler, JitProgram};
use byteorder::{ByteOrder, LittleEndian};
use std::{
borrow::Cow,
collections::{btree_map::Entry, BTreeMap},
fmt::Debug,
mem,
Expand Down Expand Up @@ -1075,12 +1074,7 @@ impl<C: ContextObject> Executable<C> {
let mut program_header: Option<&Elf64Phdr> = None;

// Fixup all the relocations in the relocation section if exists
for relocation in elf
.dynamic_relocations_table()
.unwrap_or(&[])
.iter()
.map(Cow::Borrowed)
{
for relocation in elf.dynamic_relocations_table().unwrap_or(&[]).iter() {
let mut r_offset = relocation.r_offset as usize;

// When sbpf_version.enable_elf_vaddr()=true, we allow section.sh_addr !=
Expand Down Expand Up @@ -1347,14 +1341,7 @@ impl<C: ContextObject> Executable<C> {

if config.enable_symbol_and_section_labels {
// Register all known function names from the symbol table
for symbol in elf
.symbol_table()
.ok()
.flatten()
.unwrap_or(&[])
.iter()
.map(Cow::Borrowed)
{
for symbol in elf.symbol_table().ok().flatten().unwrap_or(&[]).iter() {
if symbol.st_info & 0xEF != 0x02 {
continue;
}
Expand Down

0 comments on commit 86b2874

Please sign in to comment.