Ignore extern differences in relocations (#258)

This commit is contained in:
iFarbod 2025-09-09 07:11:53 +03:30 committed by GitHub
parent fbdaa89cc0
commit a06d3455ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 11 deletions

View File

@ -14,7 +14,7 @@ use super::{
}; };
use crate::obj::{ use crate::obj::{
InstructionArg, InstructionArgValue, InstructionRef, Object, ResolvedInstructionRef, InstructionArg, InstructionArgValue, InstructionRef, Object, ResolvedInstructionRef,
ResolvedRelocation, ResolvedSymbol, SymbolFlag, SymbolKind, ResolvedRelocation, ResolvedSymbol, SymbolKind,
}; };
pub fn no_diff_code( pub fn no_diff_code(
@ -333,11 +333,7 @@ fn reloc_eq(
|| display_ins_data_literals(left_obj, left_ins) || display_ins_data_literals(left_obj, left_ins)
== display_ins_data_literals(right_obj, right_ins)) == display_ins_data_literals(right_obj, right_ins))
} }
(None, Some(_)) => { (Some(_), None) | (None, Some(_)) | (None, None) => symbol_name_addend_matches,
// Match if possibly stripped weak symbol
symbol_name_addend_matches && right_reloc.symbol.flags.contains(SymbolFlag::Weak)
}
(Some(_), None) | (None, None) => symbol_name_addend_matches,
} }
} }

View File

@ -67,11 +67,7 @@ fn reloc_eq(
section_name_eq(left_obj, right_obj, sl, sr) section_name_eq(left_obj, right_obj, sl, sr)
&& (symbol_name_addend_matches || address_eq(left, right)) && (symbol_name_addend_matches || address_eq(left, right))
} }
(None, Some(_)) => { (Some(_), None) | (None, Some(_)) | (None, None) => symbol_name_addend_matches,
// Match if possibly stripped weak symbol
symbol_name_addend_matches && right.symbol.flags.contains(SymbolFlag::Weak)
}
(Some(_), None) | (None, None) => symbol_name_addend_matches,
} }
} }