aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2006-04-14 17:54:13 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-04-14 18:35:22 -0400
commit5ecdd0f67c624714ccd5358e1cc88324f86f0e10 (patch)
tree54ed2346bf1f4c85763fbd0622422c67679dfbc1 /scripts/mod/modpost.c
parentb5ac4817de3032796c558b0a32062e7392b5ea60 (diff)
kbuild: fix false section mismatch warnings
Darren Jenkins <darrenrjenkins@gmail.com> pointed out a number of false positives where we referenced variables from a _driver variable. Fix it by check for that pattern and ignore it. Randy.Dunlap <rdunlap@xenotime.net> pointed out a similar set of warnings for a number of scsi drivers. In scsi world they misname their variables *_template or *_sht so add these to list of variables that may have references to .init.text with no warning. Randy.Dunlap <rdunlap@xenotime.net> also pointed out a scsi driver with many references to .exit.text from .rodata. This is compiler generated references and we already ignore these for .init.text, so ignore them for .exit.text also. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7e8079a34adf..cd00e9f07589 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -492,17 +492,19 @@ static int strrcmp(const char *s, const char *sub)
492 * These functions may often be marked __init and we do not want to 492 * These functions may often be marked __init and we do not want to
493 * warn here. 493 * warn here.
494 * the pattern is identified by: 494 * the pattern is identified by:
495 * tosec = .init.text | .exit.text 495 * tosec = .init.text | .exit.text | .init.data
496 * fromsec = .data 496 * fromsec = .data
497 * atsym = *_driver, *_ops, *_probe, *probe_one 497 * atsym = *_driver, *_template, *_sht, *_ops, *_probe, *probe_one
498 **/ 498 **/
499static int secref_whitelist(const char *tosec, const char *fromsec, 499static int secref_whitelist(const char *tosec, const char *fromsec,
500 const char *atsym) 500 const char *atsym)
501{ 501{
502 int f1 = 1, f2 = 1; 502 int f1 = 1, f2 = 1;
503 const char **s; 503 const char **s;
504 const char *pat2sym[] = { 504 const char *pat2sym[] = {
505 "_driver", 505 "_driver",
506 "_template", /* scsi uses *_template a lot */
507 "_sht", /* scsi also used *_sht to some extent */
506 "_ops", 508 "_ops",
507 "_probe", 509 "_probe",
508 "_probe_one", 510 "_probe_one",
@@ -522,7 +524,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
522 524
523 /* Check for pattern 2 */ 525 /* Check for pattern 2 */
524 if ((strcmp(tosec, ".init.text") != 0) && 526 if ((strcmp(tosec, ".init.text") != 0) &&
525 (strcmp(tosec, ".exit.text") != 0)) 527 (strcmp(tosec, ".exit.text") != 0) &&
528 (strcmp(tosec, ".init.data") != 0))
526 f2 = 0; 529 f2 = 0;
527 if (strcmp(fromsec, ".data") != 0) 530 if (strcmp(fromsec, ".data") != 0)
528 f2 = 0; 531 f2 = 0;
@@ -820,6 +823,7 @@ static int exit_section(const char *name)
820 * For our future {in}sanity, add a comment that this is the ppc .opd 823 * For our future {in}sanity, add a comment that this is the ppc .opd
821 * section, not the ia64 .opd section. 824 * section, not the ia64 .opd section.
822 * ia64 .opd should not point to discarded sections. 825 * ia64 .opd should not point to discarded sections.
826 * [.rodata] like for .init.text we ignore .rodata references -same reason
823 **/ 827 **/
824static int exit_section_ref_ok(const char *name) 828static int exit_section_ref_ok(const char *name)
825{ 829{
@@ -829,6 +833,7 @@ static int exit_section_ref_ok(const char *name)
829 ".exit.text", 833 ".exit.text",
830 ".exit.data", 834 ".exit.data",
831 ".init.text", 835 ".init.text",
836 ".rodata",
832 ".opd", /* See comment [OPD] */ 837 ".opd", /* See comment [OPD] */
833 ".toc1", /* used by ppc64 */ 838 ".toc1", /* used by ppc64 */
834 ".altinstructions", 839 ".altinstructions",