aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/module_64.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-10 14:47:26 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-10 14:47:26 -0400
commitf0cd91a68acdc9b49d7f6738b514a426da627649 (patch)
tree8ad73564015794197583b094217ae0a71e71e753 /arch/powerpc/kernel/module_64.c
parent60eef25701d25e99c991dd0f4a9f3832a0c3ad3e (diff)
parent128e6ced247cda88f96fa9f2e4ba8b2c4a681560 (diff)
Merge ../linux-2.6
Diffstat (limited to 'arch/powerpc/kernel/module_64.c')
-rw-r--r--arch/powerpc/kernel/module_64.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 928b8581fcb0..ba34001fca8e 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -191,11 +191,19 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
191 (void *)hdr 191 (void *)hdr
192 + sechdrs[sechdrs[i].sh_link].sh_offset); 192 + sechdrs[sechdrs[i].sh_link].sh_offset);
193 } 193 }
194 if (!me->arch.stubs_section || !me->arch.toc_section) { 194
195 printk("%s: doesn't contain .toc or .stubs.\n", me->name); 195 if (!me->arch.stubs_section) {
196 printk("%s: doesn't contain .stubs.\n", me->name);
196 return -ENOEXEC; 197 return -ENOEXEC;
197 } 198 }
198 199
200 /* If we don't have a .toc, just use .stubs. We need to set r2
201 to some reasonable value in case the module calls out to
202 other functions via a stub, or if a function pointer escapes
203 the module by some means. */
204 if (!me->arch.toc_section)
205 me->arch.toc_section = me->arch.stubs_section;
206
199 /* Override the stubs size */ 207 /* Override the stubs size */
200 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); 208 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs);
201 return 0; 209 return 0;
@@ -342,7 +350,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
342 break; 350 break;
343 351
344 case R_PPC64_TOC16: 352 case R_PPC64_TOC16:
345 /* Subtact TOC pointer */ 353 /* Subtract TOC pointer */
346 value -= my_r2(sechdrs, me); 354 value -= my_r2(sechdrs, me);
347 if (value + 0x8000 > 0xffff) { 355 if (value + 0x8000 > 0xffff) {
348 printk("%s: bad TOC16 relocation (%lu)\n", 356 printk("%s: bad TOC16 relocation (%lu)\n",
@@ -355,7 +363,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
355 break; 363 break;
356 364
357 case R_PPC64_TOC16_DS: 365 case R_PPC64_TOC16_DS:
358 /* Subtact TOC pointer */ 366 /* Subtract TOC pointer */
359 value -= my_r2(sechdrs, me); 367 value -= my_r2(sechdrs, me);
360 if ((value & 3) != 0 || value + 0x8000 > 0xffff) { 368 if ((value & 3) != 0 || value + 0x8000 > 0xffff) {
361 printk("%s: bad TOC16_DS relocation (%lu)\n", 369 printk("%s: bad TOC16_DS relocation (%lu)\n",