History

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

Vineet Gupta committed 10 years ago

Commit d65283f1 parent f644e362 files · +9 −10Browse files

Unified · Split

2 files
  1. arch/arc/include/asm/module.h +1 −0
  2. arch/arc/kernel/module.c +8 −10
arch/arc/include/asm/module.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 struct mod_arch_specific {
1919 void *unw_info;
2020 int unw_sec_idx;
21+ const char *secstr;
2122 };
2223 #endif
2324
arch/arc/kernel/module.c+8−10
@@ -30,17 +30,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, · 29 unmodified lines
3030 char *secstr, struct module *mod)
3131 {
3232 #ifdef CONFIG_ARC_DW2_UNWIND
33− int i;
34−
3533 mod->arch.unw_sec_idx = 0;
3634 mod->arch.unw_info = NULL;
37−
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− }
35+ mod->arch.secstr = secstr;
4436 #endif
4537 return 0;
4638 }
@@ -66,8 +58,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, · 19 unmodified lines
6658 Elf32_Addr location;
6759 Elf32_Addr sec_to_patch;
6860 int relo_type;
61+ unsigned int tgtsec;
6962
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;
7165 sym_sec = (Elf32_Sym *) sechdrs[symindex].sh_addr;
7266 n = sechdrs[relsec].sh_size / sizeof(*rel_entry);
7367
@@ -111,6 +105,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, · 37 unmodified lines
111105 goto relo_err;
112106
113107 }
108+
109+ if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0)
110+ module->arch.unw_sec_idx = tgtsec;
111+
114112 return 0;
115113
116114 relo_err:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t