]> err.no Git - linux-2.6/blobdiff - scripts/mod/modpost.c
rtc: update documentation wrt irq_set_freq
[linux-2.6] / scripts / mod / modpost.c
index 3cf1ba8220d24230fb0e683c1e4223e98176a9f0..5d546466e6b1f8d2e700fa0ef846ebe6a14569cd 100644 (file)
@@ -696,6 +696,43 @@ int match(const char *sym, const char * const pat[])
 static const char *section_white_list[] =
        { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
 
+/*
+ * Is this section one we do not want to check?
+ * This is often debug sections.
+ * If we are going to check this section then
+ * test if section name ends with a dot and a number.
+ * This is used to find sections where the linker have
+ * appended a dot-number to make the name unique.
+ * The cause of this is often a section specified in assembler
+ * without "ax" / "aw" and the same section used in .c
+ * code where gcc add these.
+ */
+static int check_section(const char *modname, const char *sec)
+{
+       const char *e = sec + strlen(sec) - 1;
+       if (match(sec, section_white_list))
+               return 1;
+
+       if (*e && isdigit(*e)) {
+               /* consume all digits */
+               while (*e && e != sec && isdigit(*e))
+                       e--;
+               if (*e == '.') {
+                       warn("%s (%s): unexpected section name.\n"
+                            "The (.[number]+) following section name are "
+                            "ld generated and not expected.\n"
+                            "Did you forget to use \"ax\"/\"aw\" "
+                            "in a .S file?\n"
+                            "Note that for example <linux/init.h> contains\n"
+                            "section definitions for use in .S files.\n\n",
+                            modname, sec);
+               }
+       }
+       return 0;
+}
+
+
+
 #define ALL_INIT_DATA_SECTIONS \
        ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
 #define ALL_EXIT_DATA_SECTIONS \
@@ -833,7 +870,7 @@ const struct sectioncheck sectioncheck[] = {
 /* Do not export init/exit functions or data */
 {
        .fromsec = { "__ksymtab*", NULL },
-       .tosec   = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL },
+       .tosec   = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
        .mismatch = EXPORT_TO_INIT_EXIT
 }
 };
@@ -1088,15 +1125,15 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
        to = to_is_func ? "function" : "variable";
        to_p = to_is_func ? "()" : "";
 
+       sec_mismatch_count++;
+       if (!sec_mismatch_verbose)
+               return;
+
        fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in"
                        " reference from the %s %s%s to the %s %s:%s%s\n",
                         modname, fromsec, fromaddr, from, fromsym, from_p,
                        to, tosec, tosym, to_p);
 
-       sec_mismatch_count++;
-       if (!sec_mismatch_verbose)
-               return;
-
        switch (mismatch) {
        case TEXT_TO_INIT:
                fprintf(stderr,
@@ -1311,8 +1348,9 @@ static void section_rela(const char *modname, struct elf_info *elf,
        fromsec = sech_name(elf, sechdr);
        fromsec += strlen(".rela");
        /* if from section (name) is know good then skip it */
-       if (match(fromsec, section_white_list))
+       if (check_section(modname, fromsec))
                return;
+
        for (rela = start; rela < stop; rela++) {
                r.r_offset = TO_NATIVE(rela->r_offset);
 #if KERNEL_ELFCLASS == ELFCLASS64
@@ -1354,7 +1392,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
        fromsec = sech_name(elf, sechdr);
        fromsec += strlen(".rel");
        /* if from section (name) is know good then skip it */
-       if (match(fromsec, section_white_list))
+       if (check_section(modname, fromsec))
                return;
 
        for (rel = start; rel < stop; rel++) {
@@ -1901,10 +1939,9 @@ int main(int argc, char **argv)
                write_dump(dump_write);
        if (sec_mismatch_count && !sec_mismatch_verbose)
                fprintf(stderr, "modpost: Found %d section mismatch(es).\n"
-                       "To see additional details select \"Enable full "
-                       "Section mismatch analysis\"\n"
-                       "in the Kernel Hacking menu "
-                       "(CONFIG_SECTION_MISMATCH).\n", sec_mismatch_count);
+                       "To see full details build your kernel with:\n"
+                       "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
+                       sec_mismatch_count);
 
        return err;
 }