@@ -11,7 +11,7 @@ use crate::{
1111 diff_generic_section, no_diff_symbol,
1212 } ,
1313 } ,
14- obj:: { ObjInfo , ObjIns , ObjSection , ObjSectionKind , ObjSymbol , SymbolRef } ,
14+ obj:: { ObjInfo , ObjIns , ObjSection , ObjSectionKind , ObjSymbol , SymbolRef , SECTION_COMMON } ,
1515} ;
1616
1717pub mod code;
@@ -340,7 +340,7 @@ impl ObjDiff {
340340 }
341341 for ( symbol_idx, _) in obj. common . iter ( ) . enumerate ( ) {
342342 result. common . push ( ObjSymbolDiff {
343- symbol_ref : SymbolRef { section_idx : obj . sections . len ( ) , symbol_idx } ,
343+ symbol_ref : SymbolRef { section_idx : SECTION_COMMON , symbol_idx } ,
344344 target_symbol : None ,
345345 instructions : vec ! [ ] ,
346346 match_percent : None ,
@@ -361,7 +361,7 @@ impl ObjDiff {
361361
362362 #[ inline]
363363 pub fn symbol_diff ( & self , symbol_ref : SymbolRef ) -> & ObjSymbolDiff {
364- if symbol_ref. section_idx == self . sections . len ( ) {
364+ if symbol_ref. section_idx == SECTION_COMMON {
365365 & self . common [ symbol_ref. symbol_idx ]
366366 } else {
367367 & self . section_diff ( symbol_ref. section_idx ) . symbols [ symbol_ref. symbol_idx ]
@@ -370,7 +370,7 @@ impl ObjDiff {
370370
371371 #[ inline]
372372 pub fn symbol_diff_mut ( & mut self , symbol_ref : SymbolRef ) -> & mut ObjSymbolDiff {
373- if symbol_ref. section_idx == self . sections . len ( ) {
373+ if symbol_ref. section_idx == SECTION_COMMON {
374374 & mut self . common [ symbol_ref. symbol_idx ]
375375 } else {
376376 & mut self . section_diff_mut ( symbol_ref. section_idx ) . symbols [ symbol_ref. symbol_idx ]
@@ -758,7 +758,7 @@ fn matching_symbols(
758758 }
759759 }
760760 for ( symbol_idx, symbol) in left. common . iter ( ) . enumerate ( ) {
761- let symbol_ref = SymbolRef { section_idx : left . sections . len ( ) , symbol_idx } ;
761+ let symbol_ref = SymbolRef { section_idx : SECTION_COMMON , symbol_idx } ;
762762 if left_used. contains ( & symbol_ref) {
763763 continue ;
764764 }
@@ -790,7 +790,7 @@ fn matching_symbols(
790790 }
791791 }
792792 for ( symbol_idx, symbol) in right. common . iter ( ) . enumerate ( ) {
793- let symbol_ref = SymbolRef { section_idx : right . sections . len ( ) , symbol_idx } ;
793+ let symbol_ref = SymbolRef { section_idx : SECTION_COMMON , symbol_idx } ;
794794 if right_used. contains ( & symbol_ref) {
795795 continue ;
796796 }
@@ -883,7 +883,7 @@ fn find_common_symbol(obj: Option<&ObjInfo>, in_symbol: &ObjSymbol) -> Option<Sy
883883 let obj = obj?;
884884 for ( symbol_idx, symbol) in obj. common . iter ( ) . enumerate ( ) {
885885 if symbol. name == in_symbol. name {
886- return Some ( SymbolRef { section_idx : obj . sections . len ( ) , symbol_idx } ) ;
886+ return Some ( SymbolRef { section_idx : SECTION_COMMON , symbol_idx } ) ;
887887 }
888888 }
889889 None
0 commit comments