Browse code

walkRela(): explain sh_link and sh_info.

Xavier G authored on17/08/2015 21:41:10
Showing1 changed files

  • elfwalk index 7edce51..0f0be2e 100755
... ...
@@ -3010,6 +3010,24 @@ sub walkRela {
3010 3010
 	my $struct = ($section->{'_type'} eq 'SHT_RELA') ? 'rela' : 'rel';
3011 3011
 	my $rela_info = $elf_structures->{$struct}->{$arch};
3012 3012
 
3013
+	# Explain sh_link.
3014
+	my $linked_section = displayLinkedSection($ind, $elf_data, $section_index);
3015
+	if (defined($linked_section) && $linked_section->{'_type'} eq 'SHT_DYNSYM') {
3016
+		sayf($ind + 1, 'This is the associated symbol table.');
3017
+	}
3018
+
3019
+	# Explain sh_info.
3020
+	my $target_section = getLinkedSection($elf_data, $section_index, 'sh_info');
3021
+	if (defined($target_section)) {
3022
+		sayf(
3023
+			$ind,
3024
+			'Relocations described in this section apply to section #%s: %s, of type %s.',
3025
+			colored($target_section->{'_index'}, 'index'),
3026
+			colored($target_section->{'_name'}, 'name'),
3027
+			colored($target_section->{'_type'}, 'name')
3028
+		);
3029
+	}
3030
+
3013 3031
 	# Iterate over relocation entries.
3014 3032
 	for (my $i = 0; $i < $count; ++ $i) {
3015 3033
 		sayf($ind, '[%d/%d] Relocation at index #%s:', $i + 1, $count, $i);