aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3db4edcc5a12..ee58ded021d7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -640,7 +640,7 @@ static int data_section(const char *name)
640 * Pattern 0: 640 * Pattern 0:
641 * Do not warn if funtion/data are marked with __init_refok/__initdata_refok. 641 * Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
642 * The pattern is identified by: 642 * The pattern is identified by:
643 * fromsec = .text.init.refok | .data.init.refok 643 * fromsec = .text.init.refok* | .data.init.refok*
644 * 644 *
645 * Pattern 1: 645 * Pattern 1:
646 * If a module parameter is declared __initdata and permissions=0 646 * If a module parameter is declared __initdata and permissions=0
@@ -675,11 +675,18 @@ static int data_section(const char *name)
675 * This pattern is identified by 675 * This pattern is identified by
676 * refsymname = __init_begin, _sinittext, _einittext 676 * refsymname = __init_begin, _sinittext, _einittext
677 * 677 *
678 * Pattern 5:
679 * Xtensa uses literal sections for constants that are accessed PC-relative.
680 * Literal sections may safely reference their text sections.
681 * (Note that the name for the literal section omits any trailing '.text')
682 * tosec = <section>[.text]
683 * fromsec = <section>.literal
678 **/ 684 **/
679static int secref_whitelist(const char *modname, const char *tosec, 685static int secref_whitelist(const char *modname, const char *tosec,
680 const char *fromsec, const char *atsym, 686 const char *fromsec, const char *atsym,
681 const char *refsymname) 687 const char *refsymname)
682{ 688{
689 int len;
683 const char **s; 690 const char **s;
684 const char *pat2sym[] = { 691 const char *pat2sym[] = {
685 "driver", 692 "driver",
@@ -701,8 +708,8 @@ static int secref_whitelist(const char *modname, const char *tosec,
701 }; 708 };
702 709
703 /* Check for pattern 0 */ 710 /* Check for pattern 0 */
704 if ((strcmp(fromsec, ".text.init.refok") == 0) || 711 if ((strncmp(fromsec, ".text.init.refok", strlen(".text.init.refok")) == 0) ||
705 (strcmp(fromsec, ".data.init.refok") == 0)) 712 (strncmp(fromsec, ".data.init.refok", strlen(".data.init.refok")) == 0))
706 return 1; 713 return 1;
707 714
708 /* Check for pattern 1 */ 715 /* Check for pattern 1 */
@@ -728,6 +735,15 @@ static int secref_whitelist(const char *modname, const char *tosec,
728 if (strcmp(refsymname, *s) == 0) 735 if (strcmp(refsymname, *s) == 0)
729 return 1; 736 return 1;
730 737
738 /* Check for pattern 5 */
739 if (strrcmp(tosec, ".text") == 0)
740 len = strlen(tosec) - strlen(".text");
741 else
742 len = strlen(tosec);
743 if ((strncmp(tosec, fromsec, len) == 0) && (strlen(fromsec) > len) &&
744 (strcmp(fromsec + len, ".literal") == 0))
745 return 1;
746
731 return 0; 747 return 0;
732} 748}
733 749
@@ -856,9 +872,9 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
856 refsymname = elf->strtab + refsym->st_name; 872 refsymname = elf->strtab + refsym->st_name;
857 873
858 /* check whitelist - we may ignore it */ 874 /* check whitelist - we may ignore it */
859 if (before && 875 if (secref_whitelist(modname, secname, fromsec,
860 secref_whitelist(modname, secname, fromsec, 876 before ? elf->strtab + before->st_name : "",
861 elf->strtab + before->st_name, refsymname)) 877 refsymname))
862 return; 878 return;
863 879
864 if (before && after) { 880 if (before && after) {
@@ -1111,6 +1127,8 @@ static int initexit_section_ref_ok(const char *name)
1111 ".smp_locks", 1127 ".smp_locks",
1112 ".stab", 1128 ".stab",
1113 ".m68k_fixup", 1129 ".m68k_fixup",
1130 ".xt.prop", /* xtensa informational section */
1131 ".xt.lit", /* xtensa informational section */
1114 NULL 1132 NULL
1115 }; 1133 };
1116 /* Start of section names */ 1134 /* Start of section names */