diff options
author | Laurent Dufour <ldufour@linux.vnet.ibm.com> | 2014-06-24 04:53:59 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-06-24 23:10:48 -0400 |
commit | c2cbcf533a1d7443cf1d6aae1127491792601587 (patch) | |
tree | ac6b3f35ebb65d59d07fdd8ee1bf93a33566c777 /arch/powerpc | |
parent | e2500be2b801f4e95d6a1efbc50af3bf14eeb940 (diff) |
powerpc/module: Fix TOC symbol CRC
The commit 71ec7c55ed91 introduced the magic symbol ".TOC." for ELFv2 ABI.
This symbol is built manually and has no CRC value computed. A zero value
is put in the CRC section to avoid modpost complaining about a missing CRC.
Unfortunately, this breaks the kernel module loading when the kernel is
relocated (kdump case for instance) because of the relocation applied to
the kcrctab values.
This patch compute a CRC value for the TOC symbol which will match the one
compute by the kernel when it is relocated - aka '0 - relocate_start' done in
maybe_relocated called by check_version (module.c).
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/module_64.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 077d2ce6c5a7..d807ee626af9 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers, | |||
315 | struct modversion_info *end; | 315 | struct modversion_info *end; |
316 | 316 | ||
317 | for (end = (void *)vers + size; vers < end; vers++) | 317 | for (end = (void *)vers + size; vers < end; vers++) |
318 | if (vers->name[0] == '.') | 318 | if (vers->name[0] == '.') { |
319 | memmove(vers->name, vers->name+1, strlen(vers->name)); | 319 | memmove(vers->name, vers->name+1, strlen(vers->name)); |
320 | #ifdef ARCH_RELOCATES_KCRCTAB | ||
321 | /* The TOC symbol has no CRC computed. To avoid CRC | ||
322 | * check failing, we must force it to the expected | ||
323 | * value (see CRC check in module.c). | ||
324 | */ | ||
325 | if (!strcmp(vers->name, "TOC.")) | ||
326 | vers->crc = -(unsigned long)reloc_start; | ||
327 | #endif | ||
328 | } | ||
320 | } | 329 | } |
321 | 330 | ||
322 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ | 331 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ |