Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cb54ce9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'modversions' (modversions fixes for powerpc from Ard)

Merge kcrctab entry fixes from Ard Biesheuvel:
 "This is a followup to [0] 'modversions: redefine kcrctab entries as
  relative CRC pointers', but since relative CRC pointers do not work in
  modules, and are actually only needed by powerpc with
  CONFIG_RELOCATABLE=y, I have made it a Kconfig selectable feature
  instead.

  First it introduces the MODULE_REL_CRCS Kconfig symbol, and adds the
  kbuild handling of it, i.e., modpost, genksyms and kallsyms.

  Then it switches all architectures to 32-bit CRC entries in kcrctab,
  where all architectures except powerpc with CONFIG_RELOCATABLE=y use
  absolute ELF symbol references as before"

[0] http://marc.info/?l=linux-arch&m=148493613415294&w=2

* emailed patches from Ard Biesheuvel:
  module: unify absolute krctab definitions for 32-bit and 64-bit
  modversions: treat symbol CRCs as 32 bit quantities
  kbuild: modversions: add infrastructure for emitting relative CRCs
parents 29905b52 4b9eee96
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -484,6 +484,7 @@ config RELOCATABLE
	bool "Build a relocatable kernel"
	depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE))
	select NONSTATIC_KERNEL
	select MODULE_REL_CRCS if MODVERSIONS
	help
	  This builds a kernel image that is capable of running at the
	  location the kernel is loaded at. For ppc32, there is no any
+0 −4
Original line number Diff line number Diff line
@@ -90,9 +90,5 @@ static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sec
}
#endif

#if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
#define ARCH_RELOCATES_KCRCTAB
#define reloc_start PHYSICAL_START
#endif
#endif /* __KERNEL__ */
#endif	/* _ASM_POWERPC_MODULE_H */
+0 −8
Original line number Diff line number Diff line
@@ -286,14 +286,6 @@ static void dedotify_versions(struct modversion_info *vers,
	for (end = (void *)vers + size; vers < end; vers++)
		if (vers->name[0] == '.') {
			memmove(vers->name, vers->name+1, strlen(vers->name));
#ifdef ARCH_RELOCATES_KCRCTAB
			/* The TOC symbol has no CRC computed. To avoid CRC
			 * check failing, we must force it to the expected
			 * value (see CRC check in module.c).
			 */
			if (!strcmp(vers->name, "TOC."))
				vers->crc = -(unsigned long)reloc_start;
#endif
		}
}

+6 −5
Original line number Diff line number Diff line
@@ -9,18 +9,15 @@
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 8
#endif
#ifndef KCRC_ALIGN
#define KCRC_ALIGN 8
#endif
#else
#define __put .long
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 4
#endif
#endif
#ifndef KCRC_ALIGN
#define KCRC_ALIGN 4
#endif
#endif

#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
#define KSYM(name) _##name
@@ -52,7 +49,11 @@ KSYM(__kstrtab_\name):
	.section ___kcrctab\sec+\name,"a"
	.balign KCRC_ALIGN
KSYM(__kcrctab_\name):
	__put KSYM(__crc_\name)
#if defined(CONFIG_MODULE_REL_CRCS)
	.long KSYM(__crc_\name) - .
#else
	.long KSYM(__crc_\name)
#endif
	.weak KSYM(__crc_\name)
	.previous
#endif
+12 −5
Original line number Diff line number Diff line
@@ -43,12 +43,19 @@ extern struct module __this_module;
#ifdef CONFIG_MODVERSIONS
/* Mark the CRC weak since genksyms apparently decides not to
 * generate a checksums for some symbols */
#if defined(CONFIG_MODULE_REL_CRCS)
#define __CRC_SYMBOL(sym, sec)						\
	extern __visible void *__crc_##sym __attribute__((weak));	\
	static const unsigned long __kcrctab_##sym			\
	__used								\
	__attribute__((section("___kcrctab" sec "+" #sym), used))	\
	= (unsigned long) &__crc_##sym;
	asm("	.section \"___kcrctab" sec "+" #sym "\", \"a\"	\n"	\
	    "	.weak	" VMLINUX_SYMBOL_STR(__crc_##sym) "	\n"	\
	    "	.long	" VMLINUX_SYMBOL_STR(__crc_##sym) " - .	\n"	\
	    "	.previous					\n");
#else
#define __CRC_SYMBOL(sym, sec)						\
	asm("	.section \"___kcrctab" sec "+" #sym "\", \"a\"	\n"	\
	    "	.weak	" VMLINUX_SYMBOL_STR(__crc_##sym) "	\n"	\
	    "	.long	" VMLINUX_SYMBOL_STR(__crc_##sym) "	\n"	\
	    "	.previous					\n");
#endif
#else
#define __CRC_SYMBOL(sym, sec)
#endif
Loading