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.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 161b7846733e..4522948a012e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf,
763 763
764 764
765#define ALL_INIT_DATA_SECTIONS \ 765#define ALL_INIT_DATA_SECTIONS \
766 ".init.setup$", ".init.rodata$", \
767 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
766 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" 768 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
767#define ALL_EXIT_DATA_SECTIONS \ 769#define ALL_EXIT_DATA_SECTIONS \
768 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" 770 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
@@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf,
772#define ALL_EXIT_TEXT_SECTIONS \ 774#define ALL_EXIT_TEXT_SECTIONS \
773 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 775 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
774 776
775#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS 777#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \
776#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS 778 CPU_INIT_SECTIONS, MEM_INIT_SECTIONS
779#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \
780 CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS
777 781
778#define DATA_SECTIONS ".data$", ".data.rel$" 782#define DATA_SECTIONS ".data$", ".data.rel$"
779#define TEXT_SECTIONS ".text$" 783#define TEXT_SECTIONS ".text$"
780 784
781#define INIT_SECTIONS ".init.data$", ".init.text$" 785#define INIT_SECTIONS ".init.*"
782#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" 786#define DEV_INIT_SECTIONS ".devinit.*"
783#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" 787#define CPU_INIT_SECTIONS ".cpuinit.*"
784#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" 788#define MEM_INIT_SECTIONS ".meminit.*"
785 789
786#define EXIT_SECTIONS ".exit.data$", ".exit.text$" 790#define EXIT_SECTIONS ".exit.*"
787#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" 791#define DEV_EXIT_SECTIONS ".devexit.*"
788#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" 792#define CPU_EXIT_SECTIONS ".cpuexit.*"
789#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" 793#define MEM_EXIT_SECTIONS ".memexit.*"
790 794
791/* init data sections */ 795/* init data sections */
792static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; 796static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
@@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = {
869 .tosec = { INIT_SECTIONS, NULL }, 873 .tosec = { INIT_SECTIONS, NULL },
870 .mismatch = XXXINIT_TO_INIT, 874 .mismatch = XXXINIT_TO_INIT,
871}, 875},
876/* Do not reference cpuinit code/data from meminit code/data */
877{
878 .fromsec = { MEM_INIT_SECTIONS, NULL },
879 .tosec = { CPU_INIT_SECTIONS, NULL },
880 .mismatch = XXXINIT_TO_INIT,
881},
882/* Do not reference meminit code/data from cpuinit code/data */
883{
884 .fromsec = { CPU_INIT_SECTIONS, NULL },
885 .tosec = { MEM_INIT_SECTIONS, NULL },
886 .mismatch = XXXINIT_TO_INIT,
887},
872/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ 888/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
873{ 889{
874 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, 890 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
875 .tosec = { EXIT_SECTIONS, NULL }, 891 .tosec = { EXIT_SECTIONS, NULL },
876 .mismatch = XXXEXIT_TO_EXIT, 892 .mismatch = XXXEXIT_TO_EXIT,
877}, 893},
894/* Do not reference cpuexit code/data from memexit code/data */
895{
896 .fromsec = { MEM_EXIT_SECTIONS, NULL },
897 .tosec = { CPU_EXIT_SECTIONS, NULL },
898 .mismatch = XXXEXIT_TO_EXIT,
899},
900/* Do not reference memexit code/data from cpuexit code/data */
901{
902 .fromsec = { CPU_EXIT_SECTIONS, NULL },
903 .tosec = { MEM_EXIT_SECTIONS, NULL },
904 .mismatch = XXXEXIT_TO_EXIT,
905},
878/* Do not use exit code/data from init code */ 906/* Do not use exit code/data from init code */
879{ 907{
880 .fromsec = { ALL_INIT_SECTIONS, NULL }, 908 .fromsec = { ALL_INIT_SECTIONS, NULL },
@@ -1168,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1168 "The variable %s references\n" 1196 "The variable %s references\n"
1169 "the %s %s%s%s\n" 1197 "the %s %s%s%s\n"
1170 "If the reference is valid then annotate the\n" 1198 "If the reference is valid then annotate the\n"
1171 "variable with __init* (see linux/init.h) " 1199 "variable with __init* or __refdata (see linux/init.h) "
1172 "or name the variable:\n", 1200 "or name the variable:\n",
1173 fromsym, to, sec2annotation(tosec), tosym, to_p); 1201 fromsym, to, sec2annotation(tosec), tosym, to_p);
1174 while (*s) 1202 while (*s)