aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-10-25 13:43:20 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-10-28 13:10:28 -0400
commitd65283f7b695b5d04ca1ab58b6bb41f443b96286 (patch)
tree824d7100ed1c3aba300c8ae2d37c1725432e8563 /arch/arc
parentf644e3688855902ad11549029098a62cbbc8f558 (diff)
ARC: module: elide loop to save reference to .eh_frame
The loop was really needed in .debug_frame regime where wanted make it as SH_ALLOC so that apply_relocate_add() would process it. That's not needed for .eh_frame, so we check this in apply_relocate_add() which gets called for each section. Note that we need to save reference to "section name strings" section in module_frob_arch_sections() since apply_relocate_add() doesn't get that Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/module.h1
-rw-r--r--arch/arc/kernel/module.c18
2 files changed, 9 insertions, 10 deletions
diff --git a/arch/arc/include/asm/module.h b/arch/arc/include/asm/module.h
index 518222bb3f8e..6e91d8b339c3 100644
--- a/arch/arc/include/asm/module.h
+++ b/arch/arc/include/asm/module.h
@@ -18,6 +18,7 @@
18struct mod_arch_specific { 18struct mod_arch_specific {
19 void *unw_info; 19 void *unw_info;
20 int unw_sec_idx; 20 int unw_sec_idx;
21 const char *secstr;
21}; 22};
22#endif 23#endif
23 24
diff --git a/arch/arc/kernel/module.c b/arch/arc/kernel/module.c
index 9a2849756022..24bd2ffb90b7 100644
--- a/arch/arc/kernel/module.c
+++ b/arch/arc/kernel/module.c
@@ -30,17 +30,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
30 char *secstr, struct module *mod) 30 char *secstr, struct module *mod)
31{ 31{
32#ifdef CONFIG_ARC_DW2_UNWIND 32#ifdef CONFIG_ARC_DW2_UNWIND
33 int i;
34
35 mod->arch.unw_sec_idx = 0; 33 mod->arch.unw_sec_idx = 0;
36 mod->arch.unw_info = NULL; 34 mod->arch.unw_info = NULL;
37 35 mod->arch.secstr = secstr;
38 for (i = 1; i < hdr->e_shnum; i++) {
39 if (strcmp(secstr+sechdrs[i].sh_name, ".eh_frame") == 0) {
40 mod->arch.unw_sec_idx = i;
41 break;
42 }
43 }
44#endif 36#endif
45 return 0; 37 return 0;
46} 38}
@@ -66,8 +58,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
66 Elf32_Addr location; 58 Elf32_Addr location;
67 Elf32_Addr sec_to_patch; 59 Elf32_Addr sec_to_patch;
68 int relo_type; 60 int relo_type;
61 unsigned int tgtsec;
69 62
70 sec_to_patch = sechdrs[sechdrs[relsec].sh_info].sh_addr; 63 tgtsec = sechdrs[relsec].sh_info;
64 sec_to_patch = sechdrs[tgtsec].sh_addr;
71 sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr; 65 sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr;
72 n = sechdrs[relsec].sh_size / sizeof(*rel_entry); 66 n = sechdrs[relsec].sh_size / sizeof(*rel_entry);
73 67
@@ -111,6 +105,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
111 goto relo_err; 105 goto relo_err;
112 106
113 } 107 }
108
109 if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0)
110 module->arch.unw_sec_idx = tgtsec;
111
114 return 0; 112 return 0;
115 113
116relo_err: 114relo_err: