aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-01-17 18:34:51 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-01-17 18:34:51 -0500
commit9cdf083f981b8d37b3212400a359368661385099 (patch)
treeaa15a6a08ad87e650dea40fb59b3180bef0d345b /scripts/mod/modpost.c
parente499e01d234a31d59679b7b1e1cf628d917ba49a (diff)
parenta8b3485287731978899ced11f24628c927890e78 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2e1141623147..2aa47623f5f8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -582,9 +582,19 @@ static int strrcmp(const char *s, const char *sub)
582 * tosec = .init.text | .exit.text | .init.data 582 * tosec = .init.text | .exit.text | .init.data
583 * fromsec = .data 583 * fromsec = .data
584 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one 584 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
585 *
586 * Pattern 3:
587 * Some symbols belong to init section but still it is ok to reference
588 * these from non-init sections as these symbols don't have any memory
589 * allocated for them and symbol address and value are same. So even
590 * if init section is freed, its ok to reference those symbols.
591 * For ex. symbols marking the init section boundaries.
592 * This pattern is identified by
593 * refsymname = __init_begin, _sinittext, _einittext
585 **/ 594 **/
586static int secref_whitelist(const char *modname, const char *tosec, 595static int secref_whitelist(const char *modname, const char *tosec,
587 const char *fromsec, const char *atsym) 596 const char *fromsec, const char *atsym,
597 const char *refsymname)
588{ 598{
589 int f1 = 1, f2 = 1; 599 int f1 = 1, f2 = 1;
590 const char **s; 600 const char **s;
@@ -595,6 +605,14 @@ static int secref_whitelist(const char *modname, const char *tosec,
595 "_ops", 605 "_ops",
596 "_probe", 606 "_probe",
597 "_probe_one", 607 "_probe_one",
608 "_console",
609 NULL
610 };
611
612 const char *pat3refsym[] = {
613 "__init_begin",
614 "_sinittext",
615 "_einittext",
598 NULL 616 NULL
599 }; 617 };
600 618
@@ -628,6 +646,11 @@ static int secref_whitelist(const char *modname, const char *tosec,
628 if ((strcmp(fromsec, ".pci_fixup") == 0) && 646 if ((strcmp(fromsec, ".pci_fixup") == 0) &&
629 (strcmp(tosec, ".init.text") == 0)) 647 (strcmp(tosec, ".init.text") == 0))
630 return 1; 648 return 1;
649
650 /* Check for pattern 3 */
651 for (s = pat3refsym; *s; s++)
652 if (strcmp(refsymname, *s) == 0)
653 return 1;
631 } 654 }
632 return 0; 655 return 0;
633} 656}
@@ -737,7 +760,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
737 /* check whitelist - we may ignore it */ 760 /* check whitelist - we may ignore it */
738 if (before && 761 if (before &&
739 secref_whitelist(modname, secname, fromsec, 762 secref_whitelist(modname, secname, fromsec,
740 elf->strtab + before->st_name)) 763 elf->strtab + before->st_name, refsymname))
741 return; 764 return;
742 765
743 if (before && after) { 766 if (before && after) {
@@ -911,6 +934,7 @@ static int init_section_ref_ok(const char *name)
911 ".toc1", /* used by ppc64 */ 934 ".toc1", /* used by ppc64 */
912 ".stab", 935 ".stab",
913 ".rodata", 936 ".rodata",
937 ".parainstructions",
914 ".text.lock", 938 ".text.lock",
915 "__bug_table", /* used by powerpc for BUG() */ 939 "__bug_table", /* used by powerpc for BUG() */
916 ".pci_fixup_header", 940 ".pci_fixup_header",
@@ -931,6 +955,7 @@ static int init_section_ref_ok(const char *name)
931 ".altinstructions", 955 ".altinstructions",
932 ".eh_frame", 956 ".eh_frame",
933 ".debug", 957 ".debug",
958 ".parainstructions",
934 NULL 959 NULL
935 }; 960 };
936 /* part of section name */ 961 /* part of section name */
@@ -995,6 +1020,7 @@ static int exit_section_ref_ok(const char *name)
995 "__bug_table", /* used by powerpc for BUG() */ 1020 "__bug_table", /* used by powerpc for BUG() */
996 ".exitcall.exit", 1021 ".exitcall.exit",
997 ".eh_frame", 1022 ".eh_frame",
1023 ".parainstructions",
998 ".stab", 1024 ".stab",
999 "__ex_table", 1025 "__ex_table",
1000 ".fixup", 1026 ".fixup",