diff options
author | Phil Carmody <ext-phil.2.carmody@nokia.com> | 2010-08-19 10:16:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-02 10:31:35 -0400 |
commit | e5f7772eec3ec342ecfe686ab8330ef538af134b (patch) | |
tree | e504f9e7278913ebdee6ff8cbc84fad0bf34a237 /arch/arm/kernel | |
parent | 5793432628ad76f93ae4d31c23fb1c26e3d8b525 (diff) |
ARM: 6339/1: module - simplify unwind table handling
The various sections are all dealt with similarly, so factor out
that common behaviour. (Incorporating Peter Huewe's fix.)
Cc: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/module.c | 46 |
1 files changed, 19 insertions, 27 deletions
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) { } |