From b75dcabd6c6c71d7cea64f78b06d18d9cda0ddd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 29 Jan 2010 11:40:38 +0100 Subject: [PATCH 1/7] modpost: members of *driver structs should not point to __init functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Either the functions referred to in a driver struct should live in .devinit or the driver should be registered using platform_driver_probe (or equivalent for different driver types) with ->probe being NULL. Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 20923613467c..713b62eed875 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -961,7 +961,7 @@ static int section_mismatch(const char *fromsec, const char *tosec) * Pattern 2: * Many drivers utilise a *driver container with references to * add, remove, probe functions etc. - * These functions may often be marked __init and we do not want to + * These functions may often be marked __devinit and we do not want to * warn here. * the pattern is identified by: * tosec = init or exit section From 4a31a229fb6cbbeabf5ca9a0dcb55d53ca052048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 29 Jan 2010 12:04:26 +0100 Subject: [PATCH 2/7] modpost: define ALL_XXX{IN,EX}IT_SECTIONS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 713b62eed875..dbab53a2e225 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -781,10 +781,13 @@ static void check_section(const char *modname, struct elf_info *elf, #define ALL_EXIT_TEXT_SECTIONS \ ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" -#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \ - CPU_INIT_SECTIONS, MEM_INIT_SECTIONS -#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \ - CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS +#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ + MEM_INIT_SECTIONS +#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ + MEM_EXIT_SECTIONS + +#define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS +#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS #define DATA_SECTIONS ".data$", ".data.rel$" #define TEXT_SECTIONS ".text$" @@ -876,7 +879,7 @@ const struct sectioncheck sectioncheck[] = { }, /* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { - .fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL }, + .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_INIT, }, @@ -894,7 +897,7 @@ const struct sectioncheck sectioncheck[] = { }, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { - .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, + .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_EXIT, }, From bbd3f4fb84f8c4a04f22c9c6dc119b0c4856c7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 30 Jan 2010 16:35:47 +0100 Subject: [PATCH 3/7] modpost: give most mismatch constants a better name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index dbab53a2e225..598d54a0fefb 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -836,14 +836,14 @@ static const char *linker_symbols[] = enum mismatch { NO_MISMATCH, - TEXT_TO_INIT, - DATA_TO_INIT, - TEXT_TO_EXIT, - DATA_TO_EXIT, - XXXINIT_TO_INIT, - XXXEXIT_TO_EXIT, - INIT_TO_EXIT, - EXIT_TO_INIT, + TEXT_TO_ANY_INIT, + DATA_TO_ANY_INIT, + TEXT_TO_ANY_EXIT, + DATA_TO_ANY_EXIT, + XXXINIT_TO_SOME_INIT, + XXXEXIT_TO_SOME_EXIT, + ANY_INIT_TO_ANY_EXIT, + ANY_EXIT_TO_ANY_INIT, EXPORT_TO_INIT_EXIT, }; @@ -860,70 +860,70 @@ const struct sectioncheck sectioncheck[] = { { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = TEXT_TO_INIT, + .mismatch = TEXT_TO_ANY_INIT, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = DATA_TO_INIT, + .mismatch = DATA_TO_ANY_INIT, }, { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = TEXT_TO_EXIT, + .mismatch = TEXT_TO_ANY_EXIT, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = DATA_TO_EXIT, + .mismatch = DATA_TO_ANY_EXIT, }, /* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference cpuinit code/data from meminit code/data */ { .fromsec = { MEM_INIT_SECTIONS, NULL }, .tosec = { CPU_INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference meminit code/data from cpuinit code/data */ { .fromsec = { CPU_INIT_SECTIONS, NULL }, .tosec = { MEM_INIT_SECTIONS, NULL }, - .mismatch = XXXINIT_TO_INIT, + .mismatch = XXXINIT_TO_SOME_INIT, }, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not reference cpuexit code/data from memexit code/data */ { .fromsec = { MEM_EXIT_SECTIONS, NULL }, .tosec = { CPU_EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not reference memexit code/data from cpuexit code/data */ { .fromsec = { CPU_EXIT_SECTIONS, NULL }, .tosec = { MEM_EXIT_SECTIONS, NULL }, - .mismatch = XXXEXIT_TO_EXIT, + .mismatch = XXXEXIT_TO_SOME_EXIT, }, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, - .mismatch = INIT_TO_EXIT, + .mismatch = ANY_INIT_TO_ANY_EXIT, }, /* Do not use init code/data from exit code */ { .fromsec = { ALL_EXIT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, - .mismatch = EXIT_TO_INIT, + .mismatch = ANY_EXIT_TO_ANY_INIT, }, /* Do not export init/exit functions or data */ { @@ -1190,7 +1190,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, tosym, to_p); switch (mismatch) { - case TEXT_TO_INIT: + case TEXT_TO_ANY_INIT: fprintf(stderr, "The function %s%s() references\n" "the %s %s%s%s.\n" @@ -1200,7 +1200,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to, sec2annotation(tosec), tosym, to_p, fromsym, sec2annotation(tosec), tosym); break; - case DATA_TO_INIT: { + case DATA_TO_ANY_INIT: { const char **s = symbol_white_list; fprintf(stderr, "The variable %s references\n" @@ -1214,14 +1214,14 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, fprintf(stderr, "\n"); break; } - case TEXT_TO_EXIT: + case TEXT_TO_ANY_EXIT: fprintf(stderr, "The function %s() references a %s in an exit section.\n" "Often the %s %s%s has valid usage outside the exit section\n" "and the fix is to remove the %sannotation of %s.\n", fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym); break; - case DATA_TO_EXIT: { + case DATA_TO_ANY_EXIT: { const char **s = symbol_white_list; fprintf(stderr, "The variable %s references\n" @@ -1235,8 +1235,8 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, fprintf(stderr, "\n"); break; } - case XXXINIT_TO_INIT: - case XXXEXIT_TO_EXIT: + case XXXINIT_TO_SOME_INIT: + case XXXEXIT_TO_SOME_EXIT: fprintf(stderr, "The %s %s%s%s references\n" "a %s %s%s%s.\n" @@ -1246,7 +1246,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to, sec2annotation(tosec), tosym, to_p, tosym, fromsym, tosym); break; - case INIT_TO_EXIT: + case ANY_INIT_TO_ANY_EXIT: fprintf(stderr, "The %s %s%s%s references\n" "a %s %s%s%s.\n" @@ -1259,7 +1259,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, to, sec2annotation(tosec), tosym, to_p, sec2annotation(tosec), tosym, to_p); break; - case EXIT_TO_INIT: + case ANY_EXIT_TO_ANY_INIT: fprintf(stderr, "The %s %s%s%s references\n" "a %s %s%s%s.\n" From 0d2a636ee6c3b8c292fbaae05976fe1537b70958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 30 Jan 2010 16:56:20 +0100 Subject: [PATCH 4/7] modpost: pass around const struct sectioncheck * instead of enum mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prepares having a per-check whitelist of symbol names. Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 598d54a0fefb..3f0380b8d8f7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -933,7 +933,8 @@ const struct sectioncheck sectioncheck[] = { } }; -static int section_mismatch(const char *fromsec, const char *tosec) +static const struct sectioncheck *section_mismatch( + const char *fromsec, const char *tosec) { int i; int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck); @@ -942,10 +943,10 @@ static int section_mismatch(const char *fromsec, const char *tosec) for (i = 0; i < elems; i++) { if (match(fromsec, check->fromsec) && match(tosec, check->tosec)) - return check->mismatch; + return check; check++; } - return NO_MISMATCH; + return NULL; } /** @@ -1158,7 +1159,8 @@ static int is_function(Elf_Sym *sym) * Try to find symbols near it so user can find it. * Check whitelist before warning - it may be a false positive. */ -static void report_sec_mismatch(const char *modname, enum mismatch mismatch, +static void report_sec_mismatch(const char *modname, + const struct sectioncheck *mismatch, const char *fromsec, unsigned long long fromaddr, const char *fromsym, @@ -1189,7 +1191,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, tosym, to_p); - switch (mismatch) { + switch (mismatch->mismatch) { case TEXT_TO_ANY_INIT: fprintf(stderr, "The function %s%s() references\n" @@ -1289,11 +1291,11 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, Elf_Rela *r, Elf_Sym *sym, const char *fromsec) { const char *tosec; - enum mismatch mismatch; + const struct sectioncheck *mismatch; tosec = sec_name(elf, sym->st_shndx); mismatch = section_mismatch(fromsec, tosec); - if (mismatch != NO_MISMATCH) { + if (mismatch) { Elf_Sym *to; Elf_Sym *from; const char *tosym; From fc2f7efadb755b020ad8fdf195515dacaf185e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 30 Jan 2010 16:57:48 +0100 Subject: [PATCH 5/7] modpost: remove now unused NO_MISMATCH constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3f0380b8d8f7..a94bd10ad2de 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -835,7 +835,6 @@ static const char *linker_symbols[] = { "__init_begin", "_sinittext", "_einittext", NULL }; enum mismatch { - NO_MISMATCH, TEXT_TO_ANY_INIT, DATA_TO_ANY_INIT, TEXT_TO_ANY_EXIT, @@ -1280,8 +1279,6 @@ static void report_sec_mismatch(const char *modname, "Fix this by removing the %sannotation of %s " "or drop the export.\n", tosym, sec2annotation(tosec), sec2annotation(tosec), tosym); - case NO_MISMATCH: - /* To get warnings on missing members */ break; } fprintf(stderr, "\n"); From af92a82d0fec4dfd344b2ffd7a63e30f05c53938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 30 Jan 2010 20:52:50 +0100 Subject: [PATCH 6/7] modpost: make symbol white list a per mismatch type variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 49 +++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a94bd10ad2de..5dbe4db2bd42 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -817,18 +817,15 @@ static const char *data_sections[] = { DATA_SECTIONS, NULL }; /* symbols in .data that may refer to init/exit sections */ -static const char *symbol_white_list[] = -{ - "*driver", - "*_template", /* scsi uses *_template a lot */ - "*_timer", /* arm uses ops structures named _timer a lot */ - "*_sht", /* scsi also used *_sht to some extent */ - "*_ops", - "*_probe", - "*_probe_one", - "*_console", - NULL -}; +#define DEFAULT_SYMBOL_WHITE_LIST \ + "*driver", \ + "*_template", /* scsi uses *_template a lot */ \ + "*_timer", /* arm uses ops structures named _timer a lot */ \ + "*_sht", /* scsi also used *_sht to some extent */ \ + "*_ops", \ + "*_probe", \ + "*_probe_one", \ + "*_console" static const char *head_sections[] = { ".head.text*", NULL }; static const char *linker_symbols[] = @@ -850,6 +847,7 @@ struct sectioncheck { const char *fromsec[20]; const char *tosec[20]; enum mismatch mismatch; + const char *symbol_white_list[20]; }; const struct sectioncheck sectioncheck[] = { @@ -860,75 +858,88 @@ const struct sectioncheck sectioncheck[] = { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = TEXT_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = TEXT_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, { .fromsec = { DATA_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference init code/data from devinit/cpuinit/meminit code/data */ { .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference cpuinit code/data from meminit code/data */ { .fromsec = { MEM_INIT_SECTIONS, NULL }, .tosec = { CPU_INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference meminit code/data from cpuinit code/data */ { .fromsec = { CPU_INIT_SECTIONS, NULL }, .tosec = { MEM_INIT_SECTIONS, NULL }, .mismatch = XXXINIT_TO_SOME_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ { .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference cpuexit code/data from memexit code/data */ { .fromsec = { MEM_EXIT_SECTIONS, NULL }, .tosec = { CPU_EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not reference memexit code/data from cpuexit code/data */ { .fromsec = { CPU_EXIT_SECTIONS, NULL }, .tosec = { MEM_EXIT_SECTIONS, NULL }, .mismatch = XXXEXIT_TO_SOME_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not use exit code/data from init code */ { .fromsec = { ALL_INIT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL }, .mismatch = ANY_INIT_TO_ANY_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not use init code/data from exit code */ { .fromsec = { ALL_EXIT_SECTIONS, NULL }, .tosec = { ALL_INIT_SECTIONS, NULL }, .mismatch = ANY_EXIT_TO_ANY_INIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, /* Do not export init/exit functions or data */ { .fromsec = { "__ksymtab*", NULL }, .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, - .mismatch = EXPORT_TO_INIT_EXIT + .mismatch = EXPORT_TO_INIT_EXIT, + .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, } }; @@ -985,7 +996,8 @@ static const struct sectioncheck *section_mismatch( * refsymname = __init_begin, _sinittext, _einittext * **/ -static int secref_whitelist(const char *fromsec, const char *fromsym, +static int secref_whitelist(const struct sectioncheck *mismatch, + const char *fromsec, const char *fromsym, const char *tosec, const char *tosym) { /* Check for pattern 1 */ @@ -997,7 +1009,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym, /* Check for pattern 2 */ if (match(tosec, init_exit_sections) && match(fromsec, data_sections) && - match(fromsym, symbol_white_list)) + match(fromsym, mismatch->symbol_white_list)) return 0; /* Check for pattern 3 */ @@ -1202,7 +1214,7 @@ static void report_sec_mismatch(const char *modname, fromsym, sec2annotation(tosec), tosym); break; case DATA_TO_ANY_INIT: { - const char **s = symbol_white_list; + const char *const *s = mismatch->symbol_white_list; fprintf(stderr, "The variable %s references\n" "the %s %s%s%s\n" @@ -1223,7 +1235,7 @@ static void report_sec_mismatch(const char *modname, fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym); break; case DATA_TO_ANY_EXIT: { - const char **s = symbol_white_list; + const char *const *s = mismatch->symbol_white_list; fprintf(stderr, "The variable %s references\n" "the %s %s%s%s\n" @@ -1304,7 +1316,8 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, tosym = sym_name(elf, to); /* check whitelist - we may ignore it */ - if (secref_whitelist(fromsec, fromsym, tosec, tosym)) { + if (secref_whitelist(mismatch, + fromsec, fromsym, tosec, tosym)) { report_sec_mismatch(modname, mismatch, fromsec, r->r_offset, fromsym, is_function(from), tosec, tosym, From 0db252452378aa7a9e001a13226e1cd1dc61453d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 30 Jan 2010 21:14:23 +0100 Subject: [PATCH 7/7] modpost: don't allow *driver to reference .init.* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König --- scripts/mod/modpost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 5dbe4db2bd42..3318692e4e76 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -862,10 +862,19 @@ const struct sectioncheck sectioncheck[] = { }, { .fromsec = { DATA_SECTIONS, NULL }, - .tosec = { ALL_INIT_SECTIONS, NULL }, + .tosec = { ALL_XXXINIT_SECTIONS, NULL }, .mismatch = DATA_TO_ANY_INIT, .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, }, +{ + .fromsec = { DATA_SECTIONS, NULL }, + .tosec = { INIT_SECTIONS, NULL }, + .mismatch = DATA_TO_ANY_INIT, + .symbol_white_list = { + "*_template", "*_timer", "*_sht", "*_ops", + "*_probe", "*_probe_one", "*_console", NULL + }, +}, { .fromsec = { TEXT_SECTIONS, NULL }, .tosec = { ALL_EXIT_SECTIONS, NULL },