string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / scripts / mod / modpost.c
index a5c17db..801a16a 100644 (file)
@@ -691,7 +691,7 @@ static int number_prefix(const char *sym)
  *   The $ syntax is for sections where ld append a dot number
  *   to make section name unique.
  */
-int match(const char *sym, const char * const pat[])
+static int match(const char *sym, const char * const pat[])
 {
        const char *p;
        while (*pat) {
@@ -727,7 +727,17 @@ int match(const char *sym, const char * const pat[])
 
 /* sections that we do not want to do full section mismatch check on */
 static const char *section_white_list[] =
-       { ".comment", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
+{
+       ".comment*",
+       ".debug*",
+       ".mdebug*",        /* alpha, score, mips etc. */
+       ".pdr",            /* alpha, score, mips etc. */
+       ".stab*",
+       ".note*",
+       ".got*",
+       ".toc*",
+       NULL
+};
 
 /*
  * This is used to find sections missing the SHF_ALLOC flag.
@@ -753,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf,
 
 
 #define ALL_INIT_DATA_SECTIONS \
+       ".init.setup$", ".init.rodata$", \
+       ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
        ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
 #define ALL_EXIT_DATA_SECTIONS \
        ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
@@ -762,21 +774,23 @@ 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 ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS
-#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS
+#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 DATA_SECTIONS ".data$", ".data.rel$"
 #define TEXT_SECTIONS ".text$"
 
-#define INIT_SECTIONS      ".init.data$", ".init.text$"
-#define DEV_INIT_SECTIONS  ".devinit.data$", ".devinit.text$"
-#define CPU_INIT_SECTIONS  ".cpuinit.data$", ".cpuinit.text$"
-#define MEM_INIT_SECTIONS  ".meminit.data$", ".meminit.text$"
+#define INIT_SECTIONS      ".init.*"
+#define DEV_INIT_SECTIONS  ".devinit.*"
+#define CPU_INIT_SECTIONS  ".cpuinit.*"
+#define MEM_INIT_SECTIONS  ".meminit.*"
 
-#define EXIT_SECTIONS      ".exit.data$", ".exit.text$"
-#define DEV_EXIT_SECTIONS  ".devexit.data$", ".devexit.text$"
-#define CPU_EXIT_SECTIONS  ".cpuexit.data$", ".cpuexit.text$"
-#define MEM_EXIT_SECTIONS  ".memexit.data$", ".memexit.text$"
+#define EXIT_SECTIONS      ".exit.*"
+#define DEV_EXIT_SECTIONS  ".devexit.*"
+#define CPU_EXIT_SECTIONS  ".cpuexit.*"
+#define MEM_EXIT_SECTIONS  ".memexit.*"
 
 /* init data sections */
 static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
@@ -859,12 +873,36 @@ const struct sectioncheck sectioncheck[] = {
        .tosec   = { INIT_SECTIONS, NULL },
        .mismatch = XXXINIT_TO_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,
+},
+/* Do not reference meminit code/data from cpuinit code/data */
+{
+       .fromsec = { CPU_INIT_SECTIONS, NULL },
+       .tosec   = { MEM_INIT_SECTIONS, NULL },
+       .mismatch = XXXINIT_TO_INIT,
+},
 /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
 {
        .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
        .tosec   = { EXIT_SECTIONS, NULL },
        .mismatch = XXXEXIT_TO_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,
+},
+/* Do not reference memexit code/data from cpuexit code/data */
+{
+       .fromsec = { CPU_EXIT_SECTIONS, NULL },
+       .tosec   = { MEM_EXIT_SECTIONS, NULL },
+       .mismatch = XXXEXIT_TO_EXIT,
+},
 /* Do not use exit code/data from init code */
 {
        .fromsec = { ALL_INIT_SECTIONS, NULL },
@@ -1158,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
                "The variable %s references\n"
                "the %s %s%s%s\n"
                "If the reference is valid then annotate the\n"
-               "variable with __init* (see linux/init.h) "
+               "variable with __init* or __refdata (see linux/init.h) "
                "or name the variable:\n",
                fromsym, to, sec2annotation(tosec), tosym, to_p);
                while (*s)
@@ -1708,7 +1746,7 @@ static void add_header(struct buffer *b, struct module *mod)
        buf_printf(b, "};\n");
 }
 
-void add_staging_flag(struct buffer *b, const char *name)
+static void add_staging_flag(struct buffer *b, const char *name)
 {
        static const char *staging_dir = "drivers/staging";