Drivers must not reference functions marked with __exit as these likely are not available when the code is built-in. There are few creative offenders uncovered for example in ARCH=amd64 allmodconfig builds. So only trigger the section mismatch warning for W=1 builds. The dual rule that drivers must not reference .init.* is implemented since commit 0db252452378 ("modpost: don't allow *driver to reference .init.*") which however missed that .exit.* should be handled in the same way. Thanks to Masahiro Yamada and Arnd Bergmann who gave valuable hints to find this improvement.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -1015,9 +1015,20 @@ static int secref_whitelist(const char *fromsec, const char *fromsym, · 1014 unmodified lines | ||
| 1015 | 1015 | "*_console"))) |
| 1016 | 1016 | return 0; |
| 1017 | 1017 | |
| 1018 | − /* symbols in data sections that may refer to meminit/exit sections */ | |
| 1018 | + /* symbols in data sections that may refer to meminit sections */ | |
| 1019 | 1019 | if (match(fromsec, PATTERNS(DATA_SECTIONS)) && |
| 1020 | − match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) && | |
| 1020 | + match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) && | |
| 1021 | + match(fromsym, PATTERNS("*driver"))) | |
| 1022 | + return 0; | |
| 1023 | + | |
| 1024 | + /* | |
| 1025 | + * symbols in data sections must not refer to .exit.*, but there are | |
| 1026 | + * quite a few offenders, so hide these unless for W=1 builds until | |
| 1027 | + * these are fixed. | |
| 1028 | + */ | |
| 1029 | + if (!extra_warn && | |
| 1030 | + match(fromsec, PATTERNS(DATA_SECTIONS)) && | |
| 1031 | + match(tosec, PATTERNS(EXIT_SECTIONS)) && | |
| 1021 | 1032 | match(fromsym, PATTERNS("*driver"))) |
| 1022 | 1033 | return 0; |
| 1023 | 1034 | |