Skip to content

Commit dc46914

Browse files
committed
Merge reloc and fake_pool_reloc fields of ObjIns
1 parent 042fa9e commit dc46914

File tree

8 files changed

+4
-17
lines changed

8 files changed

+4
-17
lines changed

objdiff-core/src/arch/arm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ impl ObjArch for ObjArchArm {
216216
mnemonic: Cow::Borrowed(parsed_ins.mnemonic),
217217
args,
218218
reloc,
219-
fake_pool_reloc: None,
220219
branch_dest,
221220
line,
222221
formatted: parsed_ins.display(display_options).to_string(),

objdiff-core/src/arch/arm64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ impl ObjArch for ObjArchArm64 {
5959
mnemonic: Cow::Borrowed("<invalid>"),
6060
args: vec![],
6161
reloc: None,
62-
fake_pool_reloc: None,
6362
branch_dest: None,
6463
line: None,
6564
formatted: "".to_string(),
@@ -122,7 +121,6 @@ impl ObjArch for ObjArchArm64 {
122121
mnemonic: Cow::Borrowed(mnemonic),
123122
args,
124123
reloc,
125-
fake_pool_reloc: None,
126124
branch_dest,
127125
line,
128126
formatted: ins.to_string(),

objdiff-core/src/arch/mips.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ impl ObjArch for ObjArchMips {
205205
mnemonic: Cow::Borrowed(mnemonic),
206206
args,
207207
reloc: reloc.cloned(),
208-
fake_pool_reloc: None,
209208
branch_dest,
210209
line,
211210
formatted,

objdiff-core/src/arch/ppc.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ impl ObjArch for ObjArchPpc {
150150
size: 4,
151151
mnemonic: Cow::Borrowed(simplified.mnemonic),
152152
args,
153-
reloc: reloc.cloned(),
154-
fake_pool_reloc: fake_pool_reloc_for_addr.get(&cur_addr).cloned(),
153+
reloc: reloc.or(fake_pool_reloc_for_addr.get(&cur_addr)).cloned(),
155154
op: ins.op as u16,
156155
branch_dest,
157156
line,
@@ -195,12 +194,7 @@ impl ObjArch for ObjArchPpc {
195194
}
196195

197196
fn guess_data_type(&self, instruction: &ObjIns) -> Option<super::DataType> {
198-
if instruction
199-
.reloc
200-
.as_ref()
201-
.or(instruction.fake_pool_reloc.as_ref())
202-
.is_some_and(|r| r.target.name.starts_with("@stringBase"))
203-
{
197+
if instruction.reloc.as_ref().is_some_and(|r| r.target.name.starts_with("@stringBase")) {
204198
return Some(DataType::String);
205199
}
206200

objdiff-core/src/arch/x86.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ impl ObjArch for ObjArchX86 {
5454
mnemonic: Cow::Borrowed("<invalid>"),
5555
args: vec![],
5656
reloc: None,
57-
fake_pool_reloc: None,
5857
branch_dest: None,
5958
line: None,
6059
formatted: String::new(),
@@ -80,7 +79,6 @@ impl ObjArch for ObjArchX86 {
8079
mnemonic: Cow::Borrowed("<invalid>"),
8180
args: vec![],
8281
reloc: reloc.cloned(),
83-
fake_pool_reloc: None,
8482
branch_dest: None,
8583
line,
8684
formatted: String::new(),

objdiff-core/src/diff/code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn process_code_symbol(
3131
)?;
3232

3333
for inst in res.insts.iter_mut() {
34-
if let Some(reloc) = &mut inst.fake_pool_reloc {
34+
if let Some(reloc) = &mut inst.reloc {
3535
if reloc.target.size == 0 && reloc.target.name.is_empty() {
3636
// Fake target symbol we added as a placeholder. We need to find the real one.
3737
if let Some(real_target) =

objdiff-core/src/obj/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ pub struct ObjIns {
106106
pub mnemonic: Cow<'static, str>,
107107
pub args: Vec<ObjInsArg>,
108108
pub reloc: Option<ObjReloc>,
109-
pub fake_pool_reloc: Option<ObjReloc>,
110109
pub branch_dest: Option<u64>,
111110
/// Line number
112111
pub line: Option<u32>,

objdiff-gui/src/views/function_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn ins_hover_ui(
118118
}
119119
}
120120

121-
if let Some(reloc) = ins.reloc.as_ref().or(ins.fake_pool_reloc.as_ref()) {
121+
if let Some(reloc) = &ins.reloc {
122122
ui.label(format!("Relocation type: {}", obj.arch.display_reloc(reloc.flags)));
123123
let addend_str = match reloc.addend.cmp(&0i64) {
124124
Ordering::Greater => format!("+{:x}", reloc.addend),

0 commit comments

Comments
 (0)