aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2007-07-25 15:52:31 -0400
committerSam Ravnborg <sam@ravnborg.org>2007-07-25 15:52:31 -0400
commit83cda2bb37cb8476cd84659d9698ab48553be974 (patch)
treec0db0c2f3c6fa6c97e1185c0995c57d3ba3c87be
parent2f5ee619045d923de9137b6a263a99cc2428391a (diff)
kbuild: be more foregiving on init section naming
In the whitelist function of modpost now use the same check to identify init_section as in other places of modpost. This has the effect that we now recognize sections named .init.text.19 as init sections and we no longer warn when we see these. At the same time make surrounding code readable by dropping use of temporary flags. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--scripts/mod/modpost.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c903a16ba0e6..3db4edcc5a12 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -658,8 +658,8 @@ static int data_section(const char *name)
658 * These functions may often be marked __init and we do not want to 658 * These functions may often be marked __init and we do not want to
659 * warn here. 659 * warn here.
660 * the pattern is identified by: 660 * the pattern is identified by:
661 * tosec = .init.text | .exit.text | .init.data 661 * tosec = init or exit section
662 * fromsec = .data | .data.rel | .data.rel.* 662 * fromsec = data section
663 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer 663 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
664 * 664 *
665 * Pattern 3: 665 * Pattern 3:
@@ -680,7 +680,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
680 const char *fromsec, const char *atsym, 680 const char *fromsec, const char *atsym,
681 const char *refsymname) 681 const char *refsymname)
682{ 682{
683 int f1 = 1, f2 = 1;
684 const char **s; 683 const char **s;
685 const char *pat2sym[] = { 684 const char *pat2sym[] = {
686 "driver", 685 "driver",
@@ -707,31 +706,16 @@ static int secref_whitelist(const char *modname, const char *tosec,
707 return 1; 706 return 1;
708 707
709 /* Check for pattern 1 */ 708 /* Check for pattern 1 */
710 if (strcmp(tosec, ".init.data") != 0) 709 if ((strcmp(tosec, ".init.data") == 0) &&
711 f1 = 0; 710 (strncmp(fromsec, ".data", strlen(".data")) == 0) &&
712 if (strncmp(fromsec, ".data", strlen(".data")) != 0) 711 (strncmp(atsym, "__param", strlen("__param")) == 0))
713 f1 = 0; 712 return 1;
714 if (strncmp(atsym, "__param", strlen("__param")) != 0)
715 f1 = 0;
716
717 if (f1)
718 return f1;
719 713
720 /* Check for pattern 2 */ 714 /* Check for pattern 2 */
721 if ((strcmp(tosec, ".init.text") != 0) && 715 if ((init_section(tosec) || exit_section(tosec)) && data_section(fromsec))
722 (strcmp(tosec, ".exit.text") != 0) && 716 for (s = pat2sym; *s; s++)
723 (strcmp(tosec, ".init.data") != 0)) 717 if (strrcmp(atsym, *s) == 0)
724 f2 = 0; 718 return 1;
725 if ((strcmp(fromsec, ".data") != 0) &&
726 (strcmp(fromsec, ".data.rel") != 0) &&
727 (strncmp(fromsec, ".data.rel.", strlen(".data.rel.")) != 0))
728 f2 = 0;
729
730 for (s = pat2sym; *s; s++)
731 if (strrcmp(atsym, *s) == 0)
732 f1 = 1;
733 if (f1 && f2)
734 return 1;
735 719
736 /* Check for pattern 3 */ 720 /* Check for pattern 3 */
737 if ((strcmp(fromsec, ".text.head") == 0) && 721 if ((strcmp(fromsec, ".text.head") == 0) &&