aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/tools/relocs.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/tools/relocs.c')
-rw-r--r--arch/x86/tools/relocs.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 11f9285a2ff6..cfbdbdb4e173 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -1025,6 +1025,29 @@ static void emit_relocs(int as_text, int use_real_mode)
1025 } 1025 }
1026} 1026}
1027 1027
1028/*
1029 * As an aid to debugging problems with different linkers
1030 * print summary information about the relocs.
1031 * Since different linkers tend to emit the sections in
1032 * different orders we use the section names in the output.
1033 */
1034static int do_reloc_info(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
1035 const char *symname)
1036{
1037 printf("%s\t%s\t%s\t%s\n",
1038 sec_name(sec->shdr.sh_info),
1039 rel_type(ELF_R_TYPE(rel->r_info)),
1040 symname,
1041 sec_name(sym->st_shndx));
1042 return 0;
1043}
1044
1045static void print_reloc_info(void)
1046{
1047 printf("reloc section\treloc type\tsymbol\tsymbol section\n");
1048 walk_relocs(do_reloc_info);
1049}
1050
1028#if ELF_BITS == 64 1051#if ELF_BITS == 64
1029# define process process_64 1052# define process process_64
1030#else 1053#else
@@ -1032,7 +1055,8 @@ static void emit_relocs(int as_text, int use_real_mode)
1032#endif 1055#endif
1033 1056
1034void process(FILE *fp, int use_real_mode, int as_text, 1057void process(FILE *fp, int use_real_mode, int as_text,
1035 int show_absolute_syms, int show_absolute_relocs) 1058 int show_absolute_syms, int show_absolute_relocs,
1059 int show_reloc_info)
1036{ 1060{
1037 regex_init(use_real_mode); 1061 regex_init(use_real_mode);
1038 read_ehdr(fp); 1062 read_ehdr(fp);
@@ -1050,5 +1074,9 @@ void process(FILE *fp, int use_real_mode, int as_text,
1050 print_absolute_relocs(); 1074 print_absolute_relocs();
1051 return; 1075 return;
1052 } 1076 }
1077 if (show_reloc_info) {
1078 print_reloc_info();
1079 return;
1080 }
1053 emit_relocs(as_text, use_real_mode); 1081 emit_relocs(as_text, use_real_mode);
1054} 1082}