aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2007-06-02 18:41:22 -0400
committerSam Ravnborg <sam@ravnborg.org>2007-07-16 17:24:13 -0400
commit1d8af559f9ffd6847856f74658e501ed7ded9f01 (patch)
treeb406c4ba1fd8fac25de3b298f863cb2532a68ab6 /scripts/mod
parent1087247b7d8f1938425906d2ac983df76c6dcc18 (diff)
kbuild: consolidate section checks
Move more checks from whitelist to the section check functions. Remove the redundent pci_fixup check. Renumber the patterns. No functional changes. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f22c8b4911bc..1ef78753db97 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -612,14 +612,10 @@ static int strrcmp(const char *s, const char *sub)
612 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console 612 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
613 * 613 *
614 * Pattern 3: 614 * Pattern 3:
615 * Whitelist all references from .pci_fixup* section to .init.text
616 * This is part of the PCI init when built-in
617 *
618 * Pattern 4:
619 * Whitelist all refereces from .text.head to .init.data 615 * Whitelist all refereces from .text.head to .init.data
620 * Whitelist all refereces from .text.head to .init.text 616 * Whitelist all refereces from .text.head to .init.text
621 * 617 *
622 * Pattern 5: 618 * Pattern 4:
623 * Some symbols belong to init section but still it is ok to reference 619 * Some symbols belong to init section but still it is ok to reference
624 * these from non-init sections as these symbols don't have any memory 620 * these from non-init sections as these symbols don't have any memory
625 * allocated for them and symbol address and value are same. So even 621 * allocated for them and symbol address and value are same. So even
@@ -628,7 +624,7 @@ static int strrcmp(const char *s, const char *sub)
628 * This pattern is identified by 624 * This pattern is identified by
629 * refsymname = __init_begin, _sinittext, _einittext 625 * refsymname = __init_begin, _sinittext, _einittext
630 * 626 *
631 * Pattern 7: 627 * Pattern 5:
632 * Logos used in drivers/video/logo reside in __initdata but the 628 * Logos used in drivers/video/logo reside in __initdata but the
633 * funtion that references them are EXPORT_SYMBOL() so cannot be 629 * funtion that references them are EXPORT_SYMBOL() so cannot be
634 * marker __init. So we whitelist them here. 630 * marker __init. So we whitelist them here.
@@ -636,12 +632,6 @@ static int strrcmp(const char *s, const char *sub)
636 * tosec = .init.data 632 * tosec = .init.data
637 * fromsec = .text* 633 * fromsec = .text*
638 * refsymname = logo_ 634 * refsymname = logo_
639 *
640 * Pattern 10:
641 * ia64 has machvec table for each platform and
642 * powerpc has a machine desc table for each platform.
643 * It is mixture of function pointers of .init.text and .text.
644 * fromsec = .machvec | .machine.desc
645 **/ 635 **/
646static int secref_whitelist(const char *modname, const char *tosec, 636static int secref_whitelist(const char *modname, const char *tosec,
647 const char *fromsec, const char *atsym, 637 const char *fromsec, const char *atsym,
@@ -699,32 +689,22 @@ static int secref_whitelist(const char *modname, const char *tosec,
699 return 1; 689 return 1;
700 690
701 /* Check for pattern 3 */ 691 /* Check for pattern 3 */
702 if ((strncmp(fromsec, ".pci_fixup", strlen(".pci_fixup")) == 0) &&
703 (strcmp(tosec, ".init.text") == 0))
704 return 1;
705
706 /* Check for pattern 4 */
707 if ((strcmp(fromsec, ".text.head") == 0) && 692 if ((strcmp(fromsec, ".text.head") == 0) &&
708 ((strcmp(tosec, ".init.data") == 0) || 693 ((strcmp(tosec, ".init.data") == 0) ||
709 (strcmp(tosec, ".init.text") == 0))) 694 (strcmp(tosec, ".init.text") == 0)))
710 return 1; 695 return 1;
711 696
712 /* Check for pattern 5 */ 697 /* Check for pattern 4 */
713 for (s = pat3refsym; *s; s++) 698 for (s = pat3refsym; *s; s++)
714 if (strcmp(refsymname, *s) == 0) 699 if (strcmp(refsymname, *s) == 0)
715 return 1; 700 return 1;
716 701
717 /* Check for pattern 7 */ 702 /* Check for pattern 5 */
718 if ((strcmp(tosec, ".init.data") == 0) && 703 if ((strcmp(tosec, ".init.data") == 0) &&
719 (strncmp(fromsec, ".text", strlen(".text")) == 0) && 704 (strncmp(fromsec, ".text", strlen(".text")) == 0) &&
720 (strncmp(refsymname, "logo_", strlen("logo_")) == 0)) 705 (strncmp(refsymname, "logo_", strlen("logo_")) == 0))
721 return 1; 706 return 1;
722 707
723 /* Check for pattern 10 */
724 if ((strcmp(fromsec, ".machvec") == 0) ||
725 (strcmp(fromsec, ".machine.desc") == 0))
726 return 1;
727
728 return 0; 708 return 0;
729} 709}
730 710
@@ -1088,7 +1068,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
1088 * section, not the ia64 .opd section. 1068 * section, not the ia64 .opd section.
1089 * ia64 .opd should not point to discarded sections. 1069 * ia64 .opd should not point to discarded sections.
1090 * [.rodata] like for .init.text we ignore .rodata references -same reason 1070 * [.rodata] like for .init.text we ignore .rodata references -same reason
1091 **/ 1071 */
1092static int initexit_section_ref_ok(const char *name) 1072static int initexit_section_ref_ok(const char *name)
1093{ 1073{
1094 const char **s; 1074 const char **s;
@@ -1099,6 +1079,8 @@ static int initexit_section_ref_ok(const char *name)
1099 ".altinstructions", 1079 ".altinstructions",
1100 ".cranges", /* used by sh64 */ 1080 ".cranges", /* used by sh64 */
1101 ".fixup", 1081 ".fixup",
1082 ".machvec", /* ia64 + powerpc uses these */
1083 ".machine.desc",
1102 ".opd", /* See comment [OPD] */ 1084 ".opd", /* See comment [OPD] */
1103 ".parainstructions", 1085 ".parainstructions",
1104 ".pdr", 1086 ".pdr",