aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/module.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-10-13 00:32:19 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-10-13 00:32:19 -0400
commit5a3abba77dc0eb0b00332c21899123cdfa3b19e5 (patch)
treecb0b52bcb90f5c680faba380a0832203bdad2fed /arch/sh/kernel/module.c
parentac4fac8cb24ab209ae373a3e3e9995dff7d0c394 (diff)
sh: Tidy up the dwarf module helpers.
This enables us to build the dwarf unwinder both with modules enabled and disabled in addition to reducing code size in the latter case. The helpers are also consolidated, and modified to resemble the BUG module helpers. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/module.c')
-rw-r--r--arch/sh/kernel/module.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/arch/sh/kernel/module.c b/arch/sh/kernel/module.c
index d297a148d16c..43adddfe4c04 100644
--- a/arch/sh/kernel/module.c
+++ b/arch/sh/kernel/module.c
@@ -146,41 +146,16 @@ int module_finalize(const Elf_Ehdr *hdr,
146 const Elf_Shdr *sechdrs, 146 const Elf_Shdr *sechdrs,
147 struct module *me) 147 struct module *me)
148{ 148{
149#ifdef CONFIG_DWARF_UNWINDER 149 int ret = 0;
150 unsigned int i, err;
151 unsigned long start, end;
152 char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
153
154 start = end = 0;
155
156 for (i = 1; i < hdr->e_shnum; i++) {
157 /* Alloc bit cleared means "ignore it." */
158 if ((sechdrs[i].sh_flags & SHF_ALLOC)
159 && !strcmp(secstrings+sechdrs[i].sh_name, ".eh_frame")) {
160 start = sechdrs[i].sh_addr;
161 end = start + sechdrs[i].sh_size;
162 break;
163 }
164 }
165 150
166 /* Did we find the .eh_frame section? */ 151 ret |= module_dwarf_finalize(hdr, sechdrs, me);
167 if (i != hdr->e_shnum) { 152 ret |= module_bug_finalize(hdr, sechdrs, me);
168 err = dwarf_parse_section((char *)start, (char *)end, me);
169 if (err)
170 printk(KERN_WARNING "%s: failed to parse DWARF info\n",
171 me->name);
172 }
173
174#endif /* CONFIG_DWARF_UNWINDER */
175 153
176 return module_bug_finalize(hdr, sechdrs, me); 154 return ret;
177} 155}
178 156
179void module_arch_cleanup(struct module *mod) 157void module_arch_cleanup(struct module *mod)
180{ 158{
181 module_bug_cleanup(mod); 159 module_bug_cleanup(mod);
182 160 module_dwarf_cleanup(mod);
183#ifdef CONFIG_DWARF_UNWINDER
184 dwarf_module_unload(mod);
185#endif /* CONFIG_DWARF_UNWINDER */
186} 161}