@@ -680,16 +680,20 @@ fn symbol_section_kind(obj: &Object, symbol: &Symbol) -> SectionKind {
680680 }
681681}
682682
683- /// Check if a symbol is a compiler-generated literal like @1234.
683+ /// Check if a symbol is a compiler-generated symbol like @1234 or _$E1234 .
684684fn is_symbol_compiler_generated_literal ( symbol : & Symbol ) -> bool {
685- if !symbol. name . starts_with ( '@' ) {
686- return false ;
685+ if symbol. name . starts_with ( "_$E" ) {
686+ if symbol. name [ 3 ..] . chars ( ) . all ( char:: is_numeric) {
687+ return true ;
688+ }
687689 }
688- if !symbol. name [ 1 ..] . chars ( ) . all ( char:: is_numeric) {
689- // Exclude @stringBase0, @GUARD@, etc.
690- return false ;
690+ if symbol. name . starts_with ( '@' ) {
691+ if symbol. name [ 1 ..] . chars ( ) . all ( char:: is_numeric) {
692+ // Exclude @stringBase0, @GUARD@, etc.
693+ return true ;
694+ }
691695 }
692- true
696+ false
693697}
694698
695699fn find_symbol (
@@ -706,7 +710,7 @@ fn find_symbol(
706710 // Match compiler-generated symbols against each other (e.g. @251 -> @60)
707711 // If they are in the same section and have the same value
708712 if is_symbol_compiler_generated_literal ( in_symbol)
709- && matches ! ( section_kind, SectionKind :: Data | SectionKind :: Bss )
713+ && matches ! ( section_kind, SectionKind :: Code | SectionKind :: Data | SectionKind :: Bss )
710714 {
711715 let mut closest_match_symbol_idx = None ;
712716 let mut closest_match_percent = 0.0 ;
@@ -721,8 +725,8 @@ fn find_symbol(
721725 continue ;
722726 }
723727 match section_kind {
724- SectionKind :: Data => {
725- // For data, pick the first symbol with exactly matching bytes and relocations.
728+ SectionKind :: Data | SectionKind :: Code => {
729+ // For code or data, pick the first symbol with exactly matching bytes and relocations.
726730 // If no symbols match exactly, and `fuzzy_literals` is true, pick the closest
727731 // plausible match instead.
728732 if let Ok ( ( left_diff, _right_diff) ) =
0 commit comments