-
Notifications
You must be signed in to change notification settings - Fork 26
PPC: Reimplement pooled data reference calculation #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6365452
b1f8a2a
b6861dc
eb06227
cc25cc6
9d613d3
dc970ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ use super::{ | |
code::{address_eq, section_name_eq}, | ||
DataDiff, DataDiffKind, DataRelocationDiff, ObjectDiff, SectionDiff, SymbolDiff, | ||
}; | ||
use crate::obj::{Object, Relocation, ResolvedRelocation, SymbolFlag, SymbolKind}; | ||
use crate::obj::{Object, Relocation, ResolvedRelocation, Symbol, SymbolFlag, SymbolKind}; | ||
|
||
pub fn diff_bss_symbol( | ||
left_obj: &Object, | ||
|
@@ -64,10 +64,10 @@ fn reloc_eq( | |
|
||
#[inline] | ||
pub fn resolve_relocation<'obj>( | ||
obj: &'obj Object, | ||
symbols: &'obj [Symbol], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure, does this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, the lifetime name still makes sense too. |
||
reloc: &'obj Relocation, | ||
) -> ResolvedRelocation<'obj> { | ||
let symbol = &obj.symbols[reloc.target_symbol]; | ||
let symbol = &symbols[reloc.target_symbol]; | ||
ResolvedRelocation { relocation: reloc, symbol } | ||
} | ||
|
||
|
@@ -88,7 +88,7 @@ fn diff_data_relocs_for_range<'left, 'right>( | |
continue; | ||
} | ||
let left_offset = left_reloc.address as usize - left_range.start; | ||
let left_reloc = resolve_relocation(left_obj, left_reloc); | ||
let left_reloc = resolve_relocation(&left_obj.symbols, left_reloc); | ||
let Some(right_reloc) = right_section.relocations.iter().find(|r| { | ||
if !right_range.contains(&(r.address as usize)) { | ||
return false; | ||
|
@@ -99,7 +99,7 @@ fn diff_data_relocs_for_range<'left, 'right>( | |
diffs.push((DataDiffKind::Delete, Some(left_reloc), None)); | ||
continue; | ||
}; | ||
let right_reloc = resolve_relocation(right_obj, right_reloc); | ||
let right_reloc = resolve_relocation(&right_obj.symbols, right_reloc); | ||
if reloc_eq(left_obj, right_obj, left_reloc, right_reloc) { | ||
diffs.push((DataDiffKind::None, Some(left_reloc), Some(right_reloc))); | ||
} else { | ||
|
@@ -111,7 +111,7 @@ fn diff_data_relocs_for_range<'left, 'right>( | |
continue; | ||
} | ||
let right_offset = right_reloc.address as usize - right_range.start; | ||
let right_reloc = resolve_relocation(right_obj, right_reloc); | ||
let right_reloc = resolve_relocation(&right_obj.symbols, right_reloc); | ||
let Some(_) = left_section.relocations.iter().find(|r| { | ||
if !left_range.contains(&(r.address as usize)) { | ||
return false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I made this a PPC arch specific option since it only affects PPC, though I'd still like to implement this for ARM too in the future, so I guess this can be renamed to a general option "calculatePoolRelocations" later on once it exists for more arches. Alternatively we could make it general right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s leave it specific to PPC for now