mirror of https://github.com/encounter/objdiff.git
Merge reloc and fake_pool_reloc fields of ObjIns
This commit is contained in:
parent
042fa9ef9e
commit
dc46914428
|
@ -216,7 +216,6 @@ impl ObjArch for ObjArchArm {
|
|||
mnemonic: Cow::Borrowed(parsed_ins.mnemonic),
|
||||
args,
|
||||
reloc,
|
||||
fake_pool_reloc: None,
|
||||
branch_dest,
|
||||
line,
|
||||
formatted: parsed_ins.display(display_options).to_string(),
|
||||
|
|
|
@ -59,7 +59,6 @@ impl ObjArch for ObjArchArm64 {
|
|||
mnemonic: Cow::Borrowed("<invalid>"),
|
||||
args: vec![],
|
||||
reloc: None,
|
||||
fake_pool_reloc: None,
|
||||
branch_dest: None,
|
||||
line: None,
|
||||
formatted: "".to_string(),
|
||||
|
@ -122,7 +121,6 @@ impl ObjArch for ObjArchArm64 {
|
|||
mnemonic: Cow::Borrowed(mnemonic),
|
||||
args,
|
||||
reloc,
|
||||
fake_pool_reloc: None,
|
||||
branch_dest,
|
||||
line,
|
||||
formatted: ins.to_string(),
|
||||
|
|
|
@ -205,7 +205,6 @@ impl ObjArch for ObjArchMips {
|
|||
mnemonic: Cow::Borrowed(mnemonic),
|
||||
args,
|
||||
reloc: reloc.cloned(),
|
||||
fake_pool_reloc: None,
|
||||
branch_dest,
|
||||
line,
|
||||
formatted,
|
||||
|
|
|
@ -150,8 +150,7 @@ impl ObjArch for ObjArchPpc {
|
|||
size: 4,
|
||||
mnemonic: Cow::Borrowed(simplified.mnemonic),
|
||||
args,
|
||||
reloc: reloc.cloned(),
|
||||
fake_pool_reloc: fake_pool_reloc_for_addr.get(&cur_addr).cloned(),
|
||||
reloc: reloc.or(fake_pool_reloc_for_addr.get(&cur_addr)).cloned(),
|
||||
op: ins.op as u16,
|
||||
branch_dest,
|
||||
line,
|
||||
|
@ -195,12 +194,7 @@ impl ObjArch for ObjArchPpc {
|
|||
}
|
||||
|
||||
fn guess_data_type(&self, instruction: &ObjIns) -> Option<super::DataType> {
|
||||
if instruction
|
||||
.reloc
|
||||
.as_ref()
|
||||
.or(instruction.fake_pool_reloc.as_ref())
|
||||
.is_some_and(|r| r.target.name.starts_with("@stringBase"))
|
||||
{
|
||||
if instruction.reloc.as_ref().is_some_and(|r| r.target.name.starts_with("@stringBase")) {
|
||||
return Some(DataType::String);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ impl ObjArch for ObjArchX86 {
|
|||
mnemonic: Cow::Borrowed("<invalid>"),
|
||||
args: vec![],
|
||||
reloc: None,
|
||||
fake_pool_reloc: None,
|
||||
branch_dest: None,
|
||||
line: None,
|
||||
formatted: String::new(),
|
||||
|
@ -80,7 +79,6 @@ impl ObjArch for ObjArchX86 {
|
|||
mnemonic: Cow::Borrowed("<invalid>"),
|
||||
args: vec![],
|
||||
reloc: reloc.cloned(),
|
||||
fake_pool_reloc: None,
|
||||
branch_dest: None,
|
||||
line,
|
||||
formatted: String::new(),
|
||||
|
|
|
@ -31,7 +31,7 @@ pub fn process_code_symbol(
|
|||
)?;
|
||||
|
||||
for inst in res.insts.iter_mut() {
|
||||
if let Some(reloc) = &mut inst.fake_pool_reloc {
|
||||
if let Some(reloc) = &mut inst.reloc {
|
||||
if reloc.target.size == 0 && reloc.target.name.is_empty() {
|
||||
// Fake target symbol we added as a placeholder. We need to find the real one.
|
||||
if let Some(real_target) =
|
||||
|
|
|
@ -106,7 +106,6 @@ pub struct ObjIns {
|
|||
pub mnemonic: Cow<'static, str>,
|
||||
pub args: Vec<ObjInsArg>,
|
||||
pub reloc: Option<ObjReloc>,
|
||||
pub fake_pool_reloc: Option<ObjReloc>,
|
||||
pub branch_dest: Option<u64>,
|
||||
/// Line number
|
||||
pub line: Option<u32>,
|
||||
|
|
|
@ -118,7 +118,7 @@ fn ins_hover_ui(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(reloc) = ins.reloc.as_ref().or(ins.fake_pool_reloc.as_ref()) {
|
||||
if let Some(reloc) = &ins.reloc {
|
||||
ui.label(format!("Relocation type: {}", obj.arch.display_reloc(reloc.flags)));
|
||||
let addend_str = match reloc.addend.cmp(&0i64) {
|
||||
Ordering::Greater => format!("+{:x}", reloc.addend),
|
||||
|
|
Loading…
Reference in New Issue