diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 22:03:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 22:03:06 -0400 |
commit | 16d8775700f1815076f879719ce14b33f50a3171 (patch) | |
tree | 8525e6e6f12b6acf7cf2746853cc65549f3dbf4c /arch/arm/kernel/module.c | |
parent | e34551339a195aa548eaf698523714a8fe7f1984 (diff) | |
parent | 05e34754518b6a90d5c392790c032575fab12d66 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (91 commits)
ARM: 6806/1: irq: introduce entry and exit functions for chained handlers
ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas
ARM: 6747/1: P2V: Thumb2 support
ARM: 6798/1: aout-core: zero thread debug registers in a.out core dump
ARM: 6796/1: Footbridge: Fix I/O mappings for NOMMU mode
ARM: 6784/1: errata: no automatic Store Buffer drain on Cortex-A9
ARM: 6772/1: errata: possible fault MMU translations following an ASID switch
ARM: 6776/1: mach-ux500: activate fix for errata 753970
ARM: 6794/1: SPEAr: Append UL to device address macros.
ARM: 6793/1: SPEAr: Remove unused *_SIZE macros from spear*.h files
ARM: 6792/1: SPEAr: Replace SIZE macro's with SZ_4K macros
ARM: 6791/1: SPEAr3xx: Declare device structures after shirq code
ARM: 6790/1: SPEAr: Clock Framework: Rename usbd clock and align apb_clk entry
ARM: 6789/1: SPEAr3xx: Rename sdio to sdhci
ARM: 6788/1: SPEAr: Include mach/hardware.h instead of mach/spear.h
ARM: 6787/1: SPEAr: Reorder #includes in .h & .c files.
ARM: 6681/1: SPEAr: add debugfs support to clk API
ARM: 6703/1: SPEAr: update clk API support
ARM: 6679/1: SPEAr: make clk API functions more generic
ARM: 6737/1: SPEAr: formalized timer support
...
Diffstat (limited to 'arch/arm/kernel/module.c')
-rw-r--r-- | arch/arm/kernel/module.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 6d4105e6872f..fee7c36349eb 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c | |||
@@ -76,6 +76,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, | |||
76 | for (i = 0; i < relsec->sh_size / sizeof(Elf32_Rel); i++, rel++) { | 76 | for (i = 0; i < relsec->sh_size / sizeof(Elf32_Rel); i++, rel++) { |
77 | unsigned long loc; | 77 | unsigned long loc; |
78 | Elf32_Sym *sym; | 78 | Elf32_Sym *sym; |
79 | const char *symname; | ||
79 | s32 offset; | 80 | s32 offset; |
80 | #ifdef CONFIG_THUMB2_KERNEL | 81 | #ifdef CONFIG_THUMB2_KERNEL |
81 | u32 upper, lower, sign, j1, j2; | 82 | u32 upper, lower, sign, j1, j2; |
@@ -83,18 +84,18 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, | |||
83 | 84 | ||
84 | offset = ELF32_R_SYM(rel->r_info); | 85 | offset = ELF32_R_SYM(rel->r_info); |
85 | if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) { | 86 | if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) { |
86 | printk(KERN_ERR "%s: bad relocation, section %d reloc %d\n", | 87 | pr_err("%s: section %u reloc %u: bad relocation sym offset\n", |
87 | module->name, relindex, i); | 88 | module->name, relindex, i); |
88 | return -ENOEXEC; | 89 | return -ENOEXEC; |
89 | } | 90 | } |
90 | 91 | ||
91 | sym = ((Elf32_Sym *)symsec->sh_addr) + offset; | 92 | sym = ((Elf32_Sym *)symsec->sh_addr) + offset; |
93 | symname = strtab + sym->st_name; | ||
92 | 94 | ||
93 | if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) { | 95 | if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) { |
94 | printk(KERN_ERR "%s: out of bounds relocation, " | 96 | pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n", |
95 | "section %d reloc %d offset %d size %d\n", | 97 | module->name, relindex, i, symname, |
96 | module->name, relindex, i, rel->r_offset, | 98 | rel->r_offset, dstsec->sh_size); |
97 | dstsec->sh_size); | ||
98 | return -ENOEXEC; | 99 | return -ENOEXEC; |
99 | } | 100 | } |
100 | 101 | ||
@@ -120,10 +121,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, | |||
120 | if (offset & 3 || | 121 | if (offset & 3 || |
121 | offset <= (s32)0xfe000000 || | 122 | offset <= (s32)0xfe000000 || |
122 | offset >= (s32)0x02000000) { | 123 | offset >= (s32)0x02000000) { |
123 | printk(KERN_ERR | 124 | pr_err("%s: section %u reloc %u sym '%s': relocation %u out of range (%#lx -> %#x)\n", |
124 | "%s: relocation out of range, section " | 125 | module->name, relindex, i, symname, |
125 | "%d reloc %d sym '%s'\n", module->name, | 126 | ELF32_R_TYPE(rel->r_info), loc, |
126 | relindex, i, strtab + sym->st_name); | 127 | sym->st_value); |
127 | return -ENOEXEC; | 128 | return -ENOEXEC; |
128 | } | 129 | } |
129 | 130 | ||
@@ -196,10 +197,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, | |||
196 | if (!(offset & 1) || | 197 | if (!(offset & 1) || |
197 | offset <= (s32)0xff000000 || | 198 | offset <= (s32)0xff000000 || |
198 | offset >= (s32)0x01000000) { | 199 | offset >= (s32)0x01000000) { |
199 | printk(KERN_ERR | 200 | pr_err("%s: section %u reloc %u sym '%s': relocation %u out of range (%#lx -> %#x)\n", |
200 | "%s: relocation out of range, section " | 201 | module->name, relindex, i, symname, |
201 | "%d reloc %d sym '%s'\n", module->name, | 202 | ELF32_R_TYPE(rel->r_info), loc, |
202 | relindex, i, strtab + sym->st_name); | 203 | sym->st_value); |
203 | return -ENOEXEC; | 204 | return -ENOEXEC; |
204 | } | 205 | } |
205 | 206 | ||
@@ -282,12 +283,13 @@ static const Elf_Shdr *find_mod_section(const Elf32_Ehdr *hdr, | |||
282 | return NULL; | 283 | return NULL; |
283 | } | 284 | } |
284 | 285 | ||
286 | extern void fixup_pv_table(const void *, unsigned long); | ||
285 | extern void fixup_smp(const void *, unsigned long); | 287 | extern void fixup_smp(const void *, unsigned long); |
286 | 288 | ||
287 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, | 289 | int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, |
288 | struct module *mod) | 290 | struct module *mod) |
289 | { | 291 | { |
290 | const Elf_Shdr * __maybe_unused s = NULL; | 292 | const Elf_Shdr *s = NULL; |
291 | #ifdef CONFIG_ARM_UNWIND | 293 | #ifdef CONFIG_ARM_UNWIND |
292 | const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 294 | const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; |
293 | const Elf_Shdr *sechdrs_end = sechdrs + hdr->e_shnum; | 295 | const Elf_Shdr *sechdrs_end = sechdrs + hdr->e_shnum; |
@@ -332,6 +334,11 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, | |||
332 | maps[i].txt_sec->sh_addr, | 334 | maps[i].txt_sec->sh_addr, |
333 | maps[i].txt_sec->sh_size); | 335 | maps[i].txt_sec->sh_size); |
334 | #endif | 336 | #endif |
337 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT | ||
338 | s = find_mod_section(hdr, sechdrs, ".pv_table"); | ||
339 | if (s) | ||
340 | fixup_pv_table((void *)s->sh_addr, s->sh_size); | ||
341 | #endif | ||
335 | s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); | 342 | s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); |
336 | if (s && !is_smp()) | 343 | if (s && !is_smp()) |
337 | fixup_smp((void *)s->sh_addr, s->sh_size); | 344 | fixup_smp((void *)s->sh_addr, s->sh_size); |