Browse code

walkRela(): fetch symbols from the associated dynsym only.

Xavier G authored on 17/08/2015 21:55:27
Showing 1 changed files
... ...
@@ -3011,9 +3011,11 @@ sub walkRela {
3011 3011
 	my $rela_info = $elf_structures->{$struct}->{$arch};
3012 3012
 
3013 3013
 	# Explain sh_link.
3014
+	my $dynsym_index = undef;
3014 3015
 	my $linked_section = displayLinkedSection($ind, $elf_data, $section_index);
3015 3016
 	if (defined($linked_section) && $linked_section->{'_type'} eq 'SHT_DYNSYM') {
3016 3017
 		sayf($ind + 1, 'This is the associated symbol table.');
3018
+		$dynsym_index = $linked_section->{'_index'};
3017 3019
 	}
3018 3020
 
3019 3021
 	# Explain sh_info.
... ...
@@ -3052,7 +3054,7 @@ sub walkRela {
3052 3054
 
3053 3055
 				if ($r_sym) {
3054 3056
 					# Get the name of the associated symbol.
3055
-					my $symbol_name = symbolNameFromIndex($elf_data, $r_sym);
3057
+					my $symbol_name = symbolNameFromIndex($elf_data, $r_sym, $dynsym_index);
3056 3058
 					$section->{'_relocations'}->{$i}->{'_symbol'} = $symbol_name;
3057 3059
 					sayf($ind + 3, 'Here, %s is the index of symbol %s.', colored($r_sym, 'value'), colored($symbol_name, 'name'));
3058 3060
 				}