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
4343 #ifdef CONFIG_MODVERSIONS
4444 /* Mark the CRC weak since genksyms apparently decides not to
4545 * generate a checksums for some symbols */
46+#if defined(CONFIG_MODULE_REL_CRCS)
4647 #define __CRC_SYMBOL(sym, sec) \
47− extern __visible void *__crc_##sym __attribute__((weak)); \
48− static const unsigned long __kcrctab_##sym \
49− __used \
50− __attribute__((section("___kcrctab" sec "+" #sym), used)) \
51− = (unsigned long) &__crc_##sym;
48+ asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \
49+ " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \
50+ " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \
51+ " .previous \n");
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
5259 #else
5360 #define __CRC_SYMBOL(sym, sec)
5461 #endif
include/linux/module.h+7−7
@@ -346,7 +346,7 @@ struct module { · 345 unmodified lines
346346
347347 /* Exported symbols */
348348 const struct kernel_symbol *syms;
349− const unsigned long *crcs;
349+ const s32 *crcs;
350350 unsigned int num_syms;
351351
352352 /* Kernel parameters. */
@@ -359,18 +359,18 @@ struct module { · 6 unmodified lines
359359 /* GPL-only exported symbols. */
360360 unsigned int num_gpl_syms;
361361 const struct kernel_symbol *gpl_syms;
362− const unsigned long *gpl_crcs;
362+ const s32 *gpl_crcs;
363363
364364 #ifdef CONFIG_UNUSED_SYMBOLS
365365 /* unused exported symbols. */
366366 const struct kernel_symbol *unused_syms;
367− const unsigned long *unused_crcs;
367+ const s32 *unused_crcs;
368368 unsigned int num_unused_syms;
369369
370370 /* GPL-only, unused exported symbols. */
371371 unsigned int num_unused_gpl_syms;
372372 const struct kernel_symbol *unused_gpl_syms;
373− const unsigned long *unused_gpl_crcs;
373+ const s32 *unused_gpl_crcs;
374374 #endif
375375
376376 #ifdef CONFIG_MODULE_SIG
@@ -382,7 +382,7 @@ struct module { · 5 unmodified lines
382382
383383 /* symbols that will be GPL-only in the near future. */
384384 const struct kernel_symbol *gpl_future_syms;
385− const unsigned long *gpl_future_crcs;
385+ const s32 *gpl_future_crcs;
386386 unsigned int num_gpl_future_syms;
387387
388388 /* Exception table */
@@ -523,7 +523,7 @@ struct module *find_module(const char *name); · 134 unmodified lines
523523
524524 struct symsearch {
525525 const struct kernel_symbol *start, *stop;
526− const unsigned long *crcs;
526+ const s32 *crcs;
527527 enum {
528528 NOT_GPL_ONLY,
529529 GPL_ONLY,
@@ -539,7 +539,7 @@ struct symsearch { · 9 unmodified lines
539539 */
540540 const struct kernel_symbol *find_symbol(const char *name,
541541 struct module **owner,
542− const unsigned long **crc,
542+ const s32 **crc,
543543 bool gplok,
544544 bool warn);
545545