@@ -3,7 +3,6 @@ use object::pe::*;
3
3
use object:: read:: coff:: ImageSymbol as _;
4
4
use object:: read:: coff:: * ;
5
5
use object:: read:: pe:: * ;
6
- use object:: read:: { SectionIndex , SymbolIndex } ;
7
6
use object:: LittleEndian as LE ;
8
7
use object:: { Bytes , U32Bytes , U64Bytes } ;
9
8
@@ -641,14 +640,14 @@ fn print_relocations<'data, Coff: CoffHeader>(
641
640
for relocation in relocations {
642
641
p. group ( "ImageRelocation" , |p| {
643
642
p. field_hex ( "VirtualAddress" , relocation. virtual_address . get ( LE ) ) ;
644
- let index = relocation. symbol_table_index . get ( LE ) ;
643
+ let index = relocation. symbol ( ) ;
645
644
let name = symbols. and_then ( |symbols| {
646
645
symbols
647
- . symbol ( SymbolIndex ( index as usize ) )
646
+ . symbol ( index)
648
647
. and_then ( |symbol| symbol. name ( symbols. strings ( ) ) )
649
648
. print_err ( p)
650
649
} ) ;
651
- p. field_string_option ( "Symbol" , index, name) ;
650
+ p. field_string_option ( "Symbol" , index. 0 , name) ;
652
651
let proc = match machine {
653
652
IMAGE_FILE_MACHINE_I386 => FLAGS_IMAGE_REL_I386 ,
654
653
IMAGE_FILE_MACHINE_MIPS16
@@ -709,17 +708,16 @@ fn print_symbols<'data, Coff: CoffHeader>(
709
708
p. field ( "Name" , format ! ( "{:X?}" , symbol. raw_name( ) ) ) ;
710
709
}
711
710
p. field_hex ( "Value" , symbol. value ( ) ) ;
712
- let section = symbol. section_number ( ) ;
713
- if section <= 0 {
714
- p. field_enum_display ( "Section" , section, FLAGS_IMAGE_SYM ) ;
715
- } else {
711
+ if let Some ( section_index) = symbol. section ( ) {
716
712
let section_name = sections. and_then ( |sections| {
717
713
sections
718
- . section ( SectionIndex ( section as usize ) )
714
+ . section ( section_index )
719
715
. and_then ( |section| section. name ( symbols. strings ( ) ) )
720
716
. print_err ( p)
721
717
} ) ;
722
- p. field_string_option ( "Section" , section, section_name) ;
718
+ p. field_string_option ( "Section" , section_index. 0 , section_name) ;
719
+ } else {
720
+ p. field_enum_display ( "Section" , symbol. section_number ( ) , FLAGS_IMAGE_SYM ) ;
723
721
}
724
722
p. field_hex ( "Type" , symbol. typ ( ) ) ;
725
723
p. field_enum ( "BaseType" , symbol. base_type ( ) , FLAGS_IMAGE_SYM_TYPE ) ;
0 commit comments