aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel/module.c')
-rw-r--r--arch/arm/kernel/module.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 2cfe8161b478..c5679f6d9f64 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -268,12 +268,28 @@ struct mod_unwind_map {
268 const Elf_Shdr *txt_sec; 268 const Elf_Shdr *txt_sec;
269}; 269};
270 270
271static const Elf_Shdr *find_mod_section(const Elf32_Ehdr *hdr,
272 const Elf_Shdr *sechdrs, const char *name)
273{
274 const Elf_Shdr *s, *se;
275 const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
276
277 for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++)
278 if (strcmp(name, secstrs + s->sh_name) == 0)
279 return s;
280
281 return NULL;
282}
283
284extern void fixup_pv_table(const void *, unsigned long);
285
271int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, 286int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
272 struct module *mod) 287 struct module *mod)
273{ 288{
289 const Elf_Shdr *s = NULL;
274#ifdef CONFIG_ARM_UNWIND 290#ifdef CONFIG_ARM_UNWIND
275 const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; 291 const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
276 const Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; 292 const Elf_Shdr *sechdrs_end = sechdrs + hdr->e_shnum;
277 struct mod_unwind_map maps[ARM_SEC_MAX]; 293 struct mod_unwind_map maps[ARM_SEC_MAX];
278 int i; 294 int i;
279 295
@@ -315,6 +331,11 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
315 maps[i].txt_sec->sh_addr, 331 maps[i].txt_sec->sh_addr,
316 maps[i].txt_sec->sh_size); 332 maps[i].txt_sec->sh_size);
317#endif 333#endif
334#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
335 s = find_mod_section(hdr, sechdrs, ".pv_table");
336 if (s)
337 fixup_pv_table((void *)s->sh_addr, s->sh_size);
338#endif
318 return 0; 339 return 0;
319} 340}
320 341