History

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

Linus Torvalds committed 9 years ago

Commit 2cb54ce2 parents 29905b5 4b9eee912 files · +93 −62Browse files

Showing the changes to include/linux (2 of 12 files). Show all

Unified · Split

2 files
  1. include/linux/export.h +12 −5
  2. include/linux/module.h +7 −7
include/linux/export.h+12−5
@@ -43,12 +43,19 @@ extern struct module __this_module; · 42 unmodified lines
43#ifdef CONFIG_MODVERSIONS43#ifdef CONFIG_MODVERSIONS
44/* Mark the CRC weak since genksyms apparently decides not to44/* Mark the CRC weak since genksyms apparently decides not to
45 * generate a checksums for some symbols */45 * generate a checksums for some symbols */
46#if defined(CONFIG_MODULE_REL_CRCS)
46#define __CRC_SYMBOL(sym, sec) \47#define __CRC_SYMBOL(sym, sec) \
47 extern __visible void *__crc_##sym __attribute__((weak)); \48 asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \
48 static const unsigned long __kcrctab_##sym \49 " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
49 __used \50 " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \
50 __attribute__((section("___kcrctab" sec "+" #sym), used)) \51 " .previous \n");
51 = (unsigned long) &__crc_##sym;52#else
53#define __CRC_SYMBOL(sym, sec) \
54 asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \
55 " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
56 " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
57 " .previous \n");
58#endif
52#else59#else
53#define __CRC_SYMBOL(sym, sec)60#define __CRC_SYMBOL(sym, sec)
54#endif61#endif
include/linux/module.h+7−7
@@ -346,7 +346,7 @@ struct module { · 345 unmodified lines
346 346
347 /* Exported symbols */347 /* Exported symbols */
348 const struct kernel_symbol *syms;348 const struct kernel_symbol *syms;
349 const unsigned long *crcs;349 const s32 *crcs;
350 unsigned int num_syms;350 unsigned int num_syms;
351 351
352 /* Kernel parameters. */352 /* Kernel parameters. */
@@ -359,18 +359,18 @@ struct module { · 6 unmodified lines
359 /* GPL-only exported symbols. */359 /* GPL-only exported symbols. */
360 unsigned int num_gpl_syms;360 unsigned int num_gpl_syms;
361 const struct kernel_symbol *gpl_syms;361 const struct kernel_symbol *gpl_syms;
362 const unsigned long *gpl_crcs;362 const s32 *gpl_crcs;
363 363
364#ifdef CONFIG_UNUSED_SYMBOLS364#ifdef CONFIG_UNUSED_SYMBOLS
365 /* unused exported symbols. */365 /* unused exported symbols. */
366 const struct kernel_symbol *unused_syms;366 const struct kernel_symbol *unused_syms;
367 const unsigned long *unused_crcs;367 const s32 *unused_crcs;
368 unsigned int num_unused_syms;368 unsigned int num_unused_syms;
369 369
370 /* GPL-only, unused exported symbols. */370 /* GPL-only, unused exported symbols. */
371 unsigned int num_unused_gpl_syms;371 unsigned int num_unused_gpl_syms;
372 const struct kernel_symbol *unused_gpl_syms;372 const struct kernel_symbol *unused_gpl_syms;
373 const unsigned long *unused_gpl_crcs;373 const s32 *unused_gpl_crcs;
374#endif374#endif
375 375
376#ifdef CONFIG_MODULE_SIG376#ifdef CONFIG_MODULE_SIG
@@ -382,7 +382,7 @@ struct module { · 5 unmodified lines
382 382
383 /* symbols that will be GPL-only in the near future. */383 /* symbols that will be GPL-only in the near future. */
384 const struct kernel_symbol *gpl_future_syms;384 const struct kernel_symbol *gpl_future_syms;
385 const unsigned long *gpl_future_crcs;385 const s32 *gpl_future_crcs;
386 unsigned int num_gpl_future_syms;386 unsigned int num_gpl_future_syms;
387 387
388 /* Exception table */388 /* Exception table */
@@ -523,7 +523,7 @@ struct module *find_module(const char *name); · 134 unmodified lines
523 523
524struct symsearch {524struct symsearch {
525 const struct kernel_symbol *start, *stop;525 const struct kernel_symbol *start, *stop;
526 const unsigned long *crcs;526 const s32 *crcs;
527 enum {527 enum {
528 NOT_GPL_ONLY,528 NOT_GPL_ONLY,
529 GPL_ONLY,529 GPL_ONLY,
@@ -539,7 +539,7 @@ struct symsearch { · 9 unmodified lines
539 */539 */
540const struct kernel_symbol *find_symbol(const char *name,540const struct kernel_symbol *find_symbol(const char *name,
541 struct module **owner,541 struct module **owner,
542 const unsigned long **crc,542 const s32 **crc,
543 bool gplok,543 bool gplok,
544 bool warn);544 bool warn);
545 545