diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/module.h | 29 | ||||
-rw-r--r-- | arch/arm/kernel/module.c | 46 |
2 files changed, 36 insertions, 39 deletions
diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h index e4dfa69abb68..6dcff0f7f8d7 100644 --- a/arch/arm/include/asm/module.h +++ b/arch/arm/include/asm/module.h | |||
@@ -7,20 +7,25 @@ | |||
7 | 7 | ||
8 | struct unwind_table; | 8 | struct unwind_table; |
9 | 9 | ||
10 | struct mod_arch_specific | ||
11 | { | ||
12 | #ifdef CONFIG_ARM_UNWIND | 10 | #ifdef CONFIG_ARM_UNWIND |
13 | Elf_Shdr *unw_sec_init; | 11 | struct arm_unwind_mapping { |
14 | Elf_Shdr *unw_sec_devinit; | 12 | Elf_Shdr *unw_sec; |
15 | Elf_Shdr *unw_sec_core; | 13 | Elf_Shdr *sec_text; |
16 | Elf_Shdr *sec_init_text; | 14 | struct unwind_table *unwind; |
17 | Elf_Shdr *sec_devinit_text; | 15 | }; |
18 | Elf_Shdr *sec_core_text; | 16 | enum { |
19 | struct unwind_table *unwind_init; | 17 | ARM_SEC_INIT, |
20 | struct unwind_table *unwind_devinit; | 18 | ARM_SEC_DEVINIT, |
21 | struct unwind_table *unwind_core; | 19 | ARM_SEC_CORE, |
22 | #endif | 20 | ARM_SEC_MAX, |
21 | }; | ||
22 | struct mod_arch_specific { | ||
23 | struct arm_unwind_mapping map[ARM_SEC_MAX]; | ||
23 | }; | 24 | }; |
25 | #else | ||
26 | struct mod_arch_specific { | ||
27 | }; | ||
28 | #endif | ||
24 | 29 | ||
25 | /* | 30 | /* |
26 | * Include the ARM architecture version. | 31 | * Include the ARM architecture version. |
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 1dae0468677a..0aa622e84b24 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c | |||
@@ -69,22 +69,23 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, | |||
69 | { | 69 | { |
70 | #ifdef CONFIG_ARM_UNWIND | 70 | #ifdef CONFIG_ARM_UNWIND |
71 | Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; | 71 | Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; |
72 | struct arm_unwind_mapping *maps = mod->arch.map; | ||
72 | 73 | ||
73 | for (s = sechdrs; s < sechdrs_end; s++) { | 74 | for (s = sechdrs; s < sechdrs_end; s++) { |
74 | char const *secname = secstrings + s->sh_name; | 75 | char const *secname = secstrings + s->sh_name; |
75 | 76 | ||
76 | if (strcmp(".ARM.exidx.init.text", secname) == 0) | 77 | if (strcmp(".ARM.exidx.init.text", secname) == 0) |
77 | mod->arch.unw_sec_init = s; | 78 | maps[ARM_SEC_INIT].unw_sec = s; |
78 | else if (strcmp(".ARM.exidx.devinit.text", secname) == 0) | 79 | else if (strcmp(".ARM.exidx.devinit.text", secname) == 0) |
79 | mod->arch.unw_sec_devinit = s; | 80 | maps[ARM_SEC_DEVINIT].unw_sec = s; |
80 | else if (strcmp(".ARM.exidx", secname) == 0) | 81 | else if (strcmp(".ARM.exidx", secname) == 0) |
81 | mod->arch.unw_sec_core = s; | 82 | maps[ARM_SEC_CORE].unw_sec = s; |
82 | else if (strcmp(".init.text", secname) == 0) | 83 | else if (strcmp(".init.text", secname) == 0) |
83 | mod->arch.sec_init_text = s; | 84 | maps[ARM_SEC_INIT].sec_text = s; |
84 | else if (strcmp(".devinit.text", secname) == 0) | 85 | else if (strcmp(".devinit.text", secname) == 0) |
85 | mod->arch.sec_devinit_text = s; | 86 | maps[ARM_SEC_DEVINIT].sec_text = s; |
86 | else if (strcmp(".text", secname) == 0) | 87 | else if (strcmp(".text", secname) == 0) |
87 | mod->arch.sec_core_text = s; | 88 | maps[ARM_SEC_CORE].sec_text = s; |
88 | } | 89 | } |
89 | #endif | 90 | #endif |
90 | return 0; | 91 | return 0; |
@@ -294,31 +295,22 @@ apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
294 | #ifdef CONFIG_ARM_UNWIND | 295 | #ifdef CONFIG_ARM_UNWIND |
295 | static void register_unwind_tables(struct module *mod) | 296 | static void register_unwind_tables(struct module *mod) |
296 | { | 297 | { |
297 | if (mod->arch.unw_sec_init && mod->arch.sec_init_text) | 298 | int i; |
298 | mod->arch.unwind_init = | 299 | for (i = 0; i < ARM_SEC_MAX; ++i) { |
299 | unwind_table_add(mod->arch.unw_sec_init->sh_addr, | 300 | struct arm_unwind_mapping *map = &mod->arch.map[i]; |
300 | mod->arch.unw_sec_init->sh_size, | 301 | if (map->unw_sec && map->sec_text) |
301 | mod->arch.sec_init_text->sh_addr, | 302 | map->unwind = unwind_table_add(map->unw_sec->sh_addr, |
302 | mod->arch.sec_init_text->sh_size); | 303 | map->unw_sec->sh_size, |
303 | if (mod->arch.unw_sec_devinit && mod->arch.sec_devinit_text) | 304 | map->sec_text->sh_addr, |
304 | mod->arch.unwind_devinit = | 305 | map->sec_text->sh_size); |
305 | unwind_table_add(mod->arch.unw_sec_devinit->sh_addr, | 306 | } |
306 | mod->arch.unw_sec_devinit->sh_size, | ||
307 | mod->arch.sec_devinit_text->sh_addr, | ||
308 | mod->arch.sec_devinit_text->sh_size); | ||
309 | if (mod->arch.unw_sec_core && mod->arch.sec_core_text) | ||
310 | mod->arch.unwind_core = | ||
311 | unwind_table_add(mod->arch.unw_sec_core->sh_addr, | ||
312 | mod->arch.unw_sec_core->sh_size, | ||
313 | mod->arch.sec_core_text->sh_addr, | ||
314 | mod->arch.sec_core_text->sh_size); | ||
315 | } | 307 | } |
316 | 308 | ||
317 | static void unregister_unwind_tables(struct module *mod) | 309 | static void unregister_unwind_tables(struct module *mod) |
318 | { | 310 | { |
319 | unwind_table_del(mod->arch.unwind_init); | 311 | int i = ARM_SEC_MAX; |
320 | unwind_table_del(mod->arch.unwind_devinit); | 312 | while (--i >= 0) |
321 | unwind_table_del(mod->arch.unwind_core); | 313 | unwind_table_del(mod->arch.map[i].unwind); |
322 | } | 314 | } |
323 | #else | 315 | #else |
324 | static inline void register_unwind_tables(struct module *mod) { } | 316 | static inline void register_unwind_tables(struct module *mod) { } |