@@ -11,7 +11,7 @@ use crate::{
11
11
diff_generic_section, no_diff_symbol,
12
12
} ,
13
13
} ,
14
- obj:: { ObjInfo , ObjIns , ObjSection , ObjSectionKind , ObjSymbol , SymbolRef } ,
14
+ obj:: { ObjInfo , ObjIns , ObjSection , ObjSectionKind , ObjSymbol , SymbolRef , SECTION_COMMON } ,
15
15
} ;
16
16
17
17
pub mod code;
@@ -340,7 +340,7 @@ impl ObjDiff {
340
340
}
341
341
for ( symbol_idx, _) in obj. common . iter ( ) . enumerate ( ) {
342
342
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 } ,
344
344
target_symbol : None ,
345
345
instructions : vec ! [ ] ,
346
346
match_percent : None ,
@@ -361,7 +361,7 @@ impl ObjDiff {
361
361
362
362
#[ inline]
363
363
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 {
365
365
& self . common [ symbol_ref. symbol_idx ]
366
366
} else {
367
367
& self . section_diff ( symbol_ref. section_idx ) . symbols [ symbol_ref. symbol_idx ]
@@ -370,7 +370,7 @@ impl ObjDiff {
370
370
371
371
#[ inline]
372
372
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 {
374
374
& mut self . common [ symbol_ref. symbol_idx ]
375
375
} else {
376
376
& mut self . section_diff_mut ( symbol_ref. section_idx ) . symbols [ symbol_ref. symbol_idx ]
@@ -758,7 +758,7 @@ fn matching_symbols(
758
758
}
759
759
}
760
760
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 } ;
762
762
if left_used. contains ( & symbol_ref) {
763
763
continue ;
764
764
}
@@ -790,7 +790,7 @@ fn matching_symbols(
790
790
}
791
791
}
792
792
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 } ;
794
794
if right_used. contains ( & symbol_ref) {
795
795
continue ;
796
796
}
@@ -883,7 +883,7 @@ fn find_common_symbol(obj: Option<&ObjInfo>, in_symbol: &ObjSymbol) -> Option<Sy
883
883
let obj = obj?;
884
884
for ( symbol_idx, symbol) in obj. common . iter ( ) . enumerate ( ) {
885
885
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 } ) ;
887
887
}
888
888
}
889
889
None
0 commit comments