aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d439856f8176..7094a57273b9 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -925,7 +925,8 @@ enum mismatch {
925 925
926struct sectioncheck { 926struct sectioncheck {
927 const char *fromsec[20]; 927 const char *fromsec[20];
928 const char *tosec[20]; 928 const char *bad_tosec[20];
929 const char *good_tosec[20];
929 enum mismatch mismatch; 930 enum mismatch mismatch;
930 const char *symbol_white_list[20]; 931 const char *symbol_white_list[20];
931}; 932};
@@ -936,19 +937,19 @@ static const struct sectioncheck sectioncheck[] = {
936 */ 937 */
937{ 938{
938 .fromsec = { TEXT_SECTIONS, NULL }, 939 .fromsec = { TEXT_SECTIONS, NULL },
939 .tosec = { ALL_INIT_SECTIONS, NULL }, 940 .bad_tosec = { ALL_INIT_SECTIONS, NULL },
940 .mismatch = TEXT_TO_ANY_INIT, 941 .mismatch = TEXT_TO_ANY_INIT,
941 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 942 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
942}, 943},
943{ 944{
944 .fromsec = { DATA_SECTIONS, NULL }, 945 .fromsec = { DATA_SECTIONS, NULL },
945 .tosec = { ALL_XXXINIT_SECTIONS, NULL }, 946 .bad_tosec = { ALL_XXXINIT_SECTIONS, NULL },
946 .mismatch = DATA_TO_ANY_INIT, 947 .mismatch = DATA_TO_ANY_INIT,
947 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 948 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
948}, 949},
949{ 950{
950 .fromsec = { DATA_SECTIONS, NULL }, 951 .fromsec = { DATA_SECTIONS, NULL },
951 .tosec = { INIT_SECTIONS, NULL }, 952 .bad_tosec = { INIT_SECTIONS, NULL },
952 .mismatch = DATA_TO_ANY_INIT, 953 .mismatch = DATA_TO_ANY_INIT,
953 .symbol_white_list = { 954 .symbol_white_list = {
954 "*_template", "*_timer", "*_sht", "*_ops", 955 "*_template", "*_timer", "*_sht", "*_ops",
@@ -957,54 +958,54 @@ static const struct sectioncheck sectioncheck[] = {
957}, 958},
958{ 959{
959 .fromsec = { TEXT_SECTIONS, NULL }, 960 .fromsec = { TEXT_SECTIONS, NULL },
960 .tosec = { ALL_EXIT_SECTIONS, NULL }, 961 .bad_tosec = { ALL_EXIT_SECTIONS, NULL },
961 .mismatch = TEXT_TO_ANY_EXIT, 962 .mismatch = TEXT_TO_ANY_EXIT,
962 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 963 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
963}, 964},
964{ 965{
965 .fromsec = { DATA_SECTIONS, NULL }, 966 .fromsec = { DATA_SECTIONS, NULL },
966 .tosec = { ALL_EXIT_SECTIONS, NULL }, 967 .bad_tosec = { ALL_EXIT_SECTIONS, NULL },
967 .mismatch = DATA_TO_ANY_EXIT, 968 .mismatch = DATA_TO_ANY_EXIT,
968 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 969 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
969}, 970},
970/* Do not reference init code/data from meminit code/data */ 971/* Do not reference init code/data from meminit code/data */
971{ 972{
972 .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, 973 .fromsec = { ALL_XXXINIT_SECTIONS, NULL },
973 .tosec = { INIT_SECTIONS, NULL }, 974 .bad_tosec = { INIT_SECTIONS, NULL },
974 .mismatch = XXXINIT_TO_SOME_INIT, 975 .mismatch = XXXINIT_TO_SOME_INIT,
975 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 976 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
976}, 977},
977/* Do not reference exit code/data from memexit code/data */ 978/* Do not reference exit code/data from memexit code/data */
978{ 979{
979 .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, 980 .fromsec = { ALL_XXXEXIT_SECTIONS, NULL },
980 .tosec = { EXIT_SECTIONS, NULL }, 981 .bad_tosec = { EXIT_SECTIONS, NULL },
981 .mismatch = XXXEXIT_TO_SOME_EXIT, 982 .mismatch = XXXEXIT_TO_SOME_EXIT,
982 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 983 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
983}, 984},
984/* Do not use exit code/data from init code */ 985/* Do not use exit code/data from init code */
985{ 986{
986 .fromsec = { ALL_INIT_SECTIONS, NULL }, 987 .fromsec = { ALL_INIT_SECTIONS, NULL },
987 .tosec = { ALL_EXIT_SECTIONS, NULL }, 988 .bad_tosec = { ALL_EXIT_SECTIONS, NULL },
988 .mismatch = ANY_INIT_TO_ANY_EXIT, 989 .mismatch = ANY_INIT_TO_ANY_EXIT,
989 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 990 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
990}, 991},
991/* Do not use init code/data from exit code */ 992/* Do not use init code/data from exit code */
992{ 993{
993 .fromsec = { ALL_EXIT_SECTIONS, NULL }, 994 .fromsec = { ALL_EXIT_SECTIONS, NULL },
994 .tosec = { ALL_INIT_SECTIONS, NULL }, 995 .bad_tosec = { ALL_INIT_SECTIONS, NULL },
995 .mismatch = ANY_EXIT_TO_ANY_INIT, 996 .mismatch = ANY_EXIT_TO_ANY_INIT,
996 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 997 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
997}, 998},
998{ 999{
999 .fromsec = { ALL_PCI_INIT_SECTIONS, NULL }, 1000 .fromsec = { ALL_PCI_INIT_SECTIONS, NULL },
1000 .tosec = { INIT_SECTIONS, NULL }, 1001 .bad_tosec = { INIT_SECTIONS, NULL },
1001 .mismatch = ANY_INIT_TO_ANY_EXIT, 1002 .mismatch = ANY_INIT_TO_ANY_EXIT,
1002 .symbol_white_list = { NULL }, 1003 .symbol_white_list = { NULL },
1003}, 1004},
1004/* Do not export init/exit functions or data */ 1005/* Do not export init/exit functions or data */
1005{ 1006{
1006 .fromsec = { "__ksymtab*", NULL }, 1007 .fromsec = { "__ksymtab*", NULL },
1007 .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, 1008 .bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
1008 .mismatch = EXPORT_TO_INIT_EXIT, 1009 .mismatch = EXPORT_TO_INIT_EXIT,
1009 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 1010 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
1010} 1011}
@@ -1018,9 +1019,12 @@ static const struct sectioncheck *section_mismatch(
1018 const struct sectioncheck *check = &sectioncheck[0]; 1019 const struct sectioncheck *check = &sectioncheck[0];
1019 1020
1020 for (i = 0; i < elems; i++) { 1021 for (i = 0; i < elems; i++) {
1021 if (match(fromsec, check->fromsec) && 1022 if (match(fromsec, check->fromsec)) {
1022 match(tosec, check->tosec)) 1023 if (check->bad_tosec[0] && match(tosec, check->bad_tosec))
1023 return check; 1024 return check;
1025 if (check->good_tosec[0] && !match(tosec, check->good_tosec))
1026 return check;
1027 }
1024 check++; 1028 check++;
1025 } 1029 }
1026 return NULL; 1030 return NULL;