diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/mod/modpost.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1c2101bf63d2..91ee1b2e0f9a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -908,6 +908,9 @@ static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL }; | |||
| 908 | static const char *const init_exit_sections[] = | 908 | static const char *const init_exit_sections[] = |
| 909 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; | 909 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; |
| 910 | 910 | ||
| 911 | /* all text sections */ | ||
| 912 | static const char *const text_sections[] = { ALL_TEXT_SECTIONS, NULL }; | ||
| 913 | |||
| 911 | /* data section */ | 914 | /* data section */ |
| 912 | static const char *const data_sections[] = { DATA_SECTIONS, NULL }; | 915 | static const char *const data_sections[] = { DATA_SECTIONS, NULL }; |
| 913 | 916 | ||
| @@ -926,6 +929,7 @@ static const char *const data_sections[] = { DATA_SECTIONS, NULL }; | |||
| 926 | static const char *const head_sections[] = { ".head.text*", NULL }; | 929 | static const char *const head_sections[] = { ".head.text*", NULL }; |
| 927 | static const char *const linker_symbols[] = | 930 | static const char *const linker_symbols[] = |
| 928 | { "__init_begin", "_sinittext", "_einittext", NULL }; | 931 | { "__init_begin", "_sinittext", "_einittext", NULL }; |
| 932 | static const char *const optim_symbols[] = { "*.constprop.*", NULL }; | ||
| 929 | 933 | ||
| 930 | enum mismatch { | 934 | enum mismatch { |
| 931 | TEXT_TO_ANY_INIT, | 935 | TEXT_TO_ANY_INIT, |
| @@ -1136,6 +1140,17 @@ static const struct sectioncheck *section_mismatch( | |||
| 1136 | * This pattern is identified by | 1140 | * This pattern is identified by |
| 1137 | * refsymname = __init_begin, _sinittext, _einittext | 1141 | * refsymname = __init_begin, _sinittext, _einittext |
| 1138 | * | 1142 | * |
| 1143 | * Pattern 5: | ||
| 1144 | * GCC may optimize static inlines when fed constant arg(s) resulting | ||
| 1145 | * in functions like cpumask_empty() -- generating an associated symbol | ||
| 1146 | * cpumask_empty.constprop.3 that appears in the audit. If the const that | ||
| 1147 | * is passed in comes from __init, like say nmi_ipi_mask, we get a | ||
| 1148 | * meaningless section warning. May need to add isra symbols too... | ||
| 1149 | * This pattern is identified by | ||
| 1150 | * tosec = init section | ||
| 1151 | * fromsec = text section | ||
| 1152 | * refsymname = *.constprop.* | ||
| 1153 | * | ||
| 1139 | **/ | 1154 | **/ |
| 1140 | static int secref_whitelist(const struct sectioncheck *mismatch, | 1155 | static int secref_whitelist(const struct sectioncheck *mismatch, |
| 1141 | const char *fromsec, const char *fromsym, | 1156 | const char *fromsec, const char *fromsym, |
| @@ -1168,6 +1183,12 @@ static int secref_whitelist(const struct sectioncheck *mismatch, | |||
| 1168 | if (match(tosym, linker_symbols)) | 1183 | if (match(tosym, linker_symbols)) |
| 1169 | return 0; | 1184 | return 0; |
| 1170 | 1185 | ||
| 1186 | /* Check for pattern 5 */ | ||
| 1187 | if (match(fromsec, text_sections) && | ||
| 1188 | match(tosec, init_sections) && | ||
| 1189 | match(fromsym, optim_symbols)) | ||
| 1190 | return 0; | ||
| 1191 | |||
| 1171 | return 1; | 1192 | return 1; |
| 1172 | } | 1193 | } |
| 1173 | 1194 | ||
