@@ -680,16 +680,16 @@ fn symbol_section_kind(obj: &Object, symbol: &Symbol) -> SectionKind {
680
680
}
681
681
}
682
682
683
- /// Check if a symbol is a compiler-generated literal like @1234.
684
- fn is_symbol_compiler_generated_literal ( symbol : & Symbol ) -> bool {
685
- if !symbol. name . starts_with ( '@' ) {
686
- return false ;
687
- }
688
- if !symbol. name [ 1 ..] . chars ( ) . all ( char:: is_numeric) {
683
+ /// Check if a symbol is a compiler-generated like @1234 or _$E1234.
684
+ fn is_symbol_compiler_generated ( symbol : & Symbol ) -> bool {
685
+ if symbol. name . starts_with ( '@' ) && symbol. name [ 1 ..] . chars ( ) . all ( char:: is_numeric) {
689
686
// Exclude @stringBase0, @GUARD@, etc.
690
- return false ;
687
+ return true ;
688
+ }
689
+ if symbol. name . starts_with ( "_$E" ) && symbol. name [ 3 ..] . chars ( ) . all ( char:: is_numeric) {
690
+ return true ;
691
691
}
692
- true
692
+ false
693
693
}
694
694
695
695
fn find_symbol (
@@ -705,8 +705,8 @@ fn find_symbol(
705
705
706
706
// Match compiler-generated symbols against each other (e.g. @251 -> @60)
707
707
// If they are in the same section and have the same value
708
- if is_symbol_compiler_generated_literal ( in_symbol)
709
- && matches ! ( section_kind, SectionKind :: Data | SectionKind :: Bss )
708
+ if is_symbol_compiler_generated ( in_symbol)
709
+ && matches ! ( section_kind, SectionKind :: Code | SectionKind :: Data | SectionKind :: Bss )
710
710
{
711
711
let mut closest_match_symbol_idx = None ;
712
712
let mut closest_match_percent = 0.0 ;
@@ -717,12 +717,12 @@ fn find_symbol(
717
717
if obj. sections [ section_index] . name != section_name {
718
718
continue ;
719
719
}
720
- if !is_symbol_compiler_generated_literal ( symbol) {
720
+ if !is_symbol_compiler_generated ( symbol) {
721
721
continue ;
722
722
}
723
723
match section_kind {
724
- SectionKind :: Data => {
725
- // For data, pick the first symbol with exactly matching bytes and relocations.
724
+ SectionKind :: Data | SectionKind :: Code => {
725
+ // For code or data, pick the first symbol with exactly matching bytes and relocations.
726
726
// If no symbols match exactly, and `fuzzy_literals` is true, pick the closest
727
727
// plausible match instead.
728
728
if let Ok ( ( left_diff, _right_diff) ) =
0 commit comments