Commit d65283f7 authored by Vineet Gupta's avatar Vineet Gupta

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: default avatarVineet Gupta <vgupta@synopsys.com>
parent f644e368
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
struct mod_arch_specific { struct mod_arch_specific {
void *unw_info; void *unw_info;
int unw_sec_idx; int unw_sec_idx;
const char *secstr;
}; };
#endif #endif
......
...@@ -30,17 +30,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, ...@@ -30,17 +30,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
char *secstr, struct module *mod) char *secstr, struct module *mod)
{ {
#ifdef CONFIG_ARC_DW2_UNWIND #ifdef CONFIG_ARC_DW2_UNWIND
int i;
mod->arch.unw_sec_idx = 0; mod->arch.unw_sec_idx = 0;
mod->arch.unw_info = NULL; mod->arch.unw_info = NULL;
mod->arch.secstr = secstr;
for (i = 1; i < hdr->e_shnum; i++) {
if (strcmp(secstr+sechdrs[i].sh_name, ".eh_frame") == 0) {
mod->arch.unw_sec_idx = i;
break;
}
}
#endif #endif
return 0; return 0;
} }
...@@ -66,8 +58,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, ...@@ -66,8 +58,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
Elf32_Addr location; Elf32_Addr location;
Elf32_Addr sec_to_patch; Elf32_Addr sec_to_patch;
int relo_type; int relo_type;
unsigned int tgtsec;
sec_to_patch = sechdrs[sechdrs[relsec].sh_info].sh_addr; tgtsec = sechdrs[relsec].sh_info;
sec_to_patch = sechdrs[tgtsec].sh_addr;
sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr; sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr;
n = sechdrs[relsec].sh_size / sizeof(*rel_entry); n = sechdrs[relsec].sh_size / sizeof(*rel_entry);
...@@ -111,6 +105,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, ...@@ -111,6 +105,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
goto relo_err; goto relo_err;
} }
if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0)
module->arch.unw_sec_idx = tgtsec;
return 0; return 0;
relo_err: relo_err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment