Change REL "invalid relocation" to warning

Also ensures that `block_relocations`
works to remove the warning

Resolves #53
This commit is contained in:
Luke Street 2024-06-03 18:03:39 -06:00
parent 53c6d74a6b
commit 6b60c13834
1 changed files with 8 additions and 2 deletions

View File

@ -650,6 +650,12 @@ impl Tracker {
// Skip external relocations, they already exist // Skip external relocations, they already exist
continue; continue;
}; };
if obj.blocked_relocation_sources.contains(addr)
|| obj.blocked_relocation_targets.contains(target)
{
// Skip blocked relocations
continue;
}
if obj.kind == ObjKind::Relocatable { if obj.kind == ObjKind::Relocatable {
// Sanity check: relocatable objects already have relocations, // Sanity check: relocatable objects already have relocations,
// did our analyzer find one that isn't real? // did our analyzer find one that isn't real?
@ -658,8 +664,8 @@ impl Tracker {
// We _do_ want to rebuild missing R_PPC_REL24 relocations // We _do_ want to rebuild missing R_PPC_REL24 relocations
&& !matches!(reloc_kind, ObjRelocKind::PpcRel24) && !matches!(reloc_kind, ObjRelocKind::PpcRel24)
{ {
bail!( log::warn!(
"Found invalid relocation {} {:#?} (target {}) in relocatable object", "Found invalid relocation {} {:?} (target {}) in relocatable object",
addr, addr,
reloc, reloc,
target target