aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-01-20 14:07:28 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:21:17 -0500
commiteb8f689046b857874e964463619f09df06d59fad (patch)
treeec726cd06764746a07689ede3b782c36a24d3e55 /scripts
parentf3fe866d59d707c7a2bba0b23add078e19edb3dc (diff)
Use separate sections for __dev/__cpu/__mem code/data
Introducing separate sections for __dev* (HOTPLUG), __cpu* (HOTPLUG_CPU) and __mem* (MEMORY_HOTPLUG) allows us to do a much more reliable Section mismatch check in modpost. We are no longer dependent on the actual configuration of for example HOTPLUG. This has the effect that all users see much more Section mismatch warnings than before because they were almost all hidden when HOTPLUG was enabled. The advantage of this is that when building a piece of code then it is much more likely that the Section mismatch errors are spotted and the warnings will be felt less random of nature. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Greg KH <greg@kroah.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Adrian Bunk <bunk@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 986513dcd700..730b321680cd 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -670,27 +670,41 @@ int match(const char *sym, const char * const pat[])
670static const char *section_white_list[] = 670static const char *section_white_list[] =
671 { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL }; 671 { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
672 672
673#define INIT_DATA_SECTIONS ".init.data$" 673#define ALL_INIT_DATA_SECTIONS \
674#define EXIT_DATA_SECTIONS ".exit.data$" 674 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
675#define ALL_EXIT_DATA_SECTIONS \
676 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
675 677
676#define INIT_TEXT_SECTIONS ".init.text$" 678#define ALL_INIT_TEXT_SECTIONS \
677#define EXIT_TEXT_SECTIONS ".exit.text$" 679 ".init.text$", ".devinit.text$", ".cpuinit.text$", ".meminit.text$"
680#define ALL_EXIT_TEXT_SECTIONS \
681 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
678 682
679#define INIT_SECTIONS INIT_DATA_SECTIONS, INIT_TEXT_SECTIONS 683#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS
680#define EXIT_SECTIONS EXIT_DATA_SECTIONS, EXIT_TEXT_SECTIONS 684#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS
681 685
682#define DATA_SECTIONS ".data$", ".data.rel$" 686#define DATA_SECTIONS ".data$", ".data.rel$"
683#define TEXT_SECTIONS ".text$" 687#define TEXT_SECTIONS ".text$"
684 688
689#define INIT_SECTIONS ".init.data$", ".init.text$"
690#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$"
691#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$"
692#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$"
693
694#define EXIT_SECTIONS ".exit.data$", ".exit.text$"
695#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$"
696#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$"
697#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$"
698
685/* init data sections */ 699/* init data sections */
686static const char *init_data_sections[] = { INIT_DATA_SECTIONS, NULL }; 700static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
687 701
688/* all init sections */ 702/* all init sections */
689static const char *init_sections[] = { INIT_SECTIONS, NULL }; 703static const char *init_sections[] = { ALL_INIT_SECTIONS, NULL };
690 704
691/* All init and exit sections (code + data) */ 705/* All init and exit sections (code + data) */
692static const char *init_exit_sections[] = 706static const char *init_exit_sections[] =
693 {INIT_SECTIONS, EXIT_SECTIONS, NULL }; 707 {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
694 708
695/* data section */ 709/* data section */
696static const char *data_sections[] = { DATA_SECTIONS, NULL }; 710static const char *data_sections[] = { DATA_SECTIONS, NULL };
@@ -734,22 +748,32 @@ const struct sectioncheck sectioncheck[] = {
734 */ 748 */
735{ 749{
736 .fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL }, 750 .fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
737 .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL } 751 .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
752},
753/* Do not reference init code/data from devinit/cpuinit/meminit code/data */
754{
755 .fromsec = { DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, MEM_INIT_SECTIONS, NULL },
756 .tosec = { INIT_SECTIONS, NULL }
757},
758/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
759{
760 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
761 .tosec = { EXIT_SECTIONS, NULL }
738}, 762},
739/* Do not use exit code/data from init code */ 763/* Do not use exit code/data from init code */
740{ 764{
741 .fromsec = { INIT_SECTIONS, NULL }, 765 .fromsec = { ALL_INIT_SECTIONS, NULL },
742 .tosec = { EXIT_SECTIONS, NULL }, 766 .tosec = { ALL_EXIT_SECTIONS, NULL },
743}, 767},
744/* Do not use init code/data from exit code */ 768/* Do not use init code/data from exit code */
745{ 769{
746 .fromsec = { EXIT_SECTIONS, NULL }, 770 .fromsec = { ALL_EXIT_SECTIONS, NULL },
747 .tosec = { INIT_SECTIONS, NULL } 771 .tosec = { ALL_INIT_SECTIONS, NULL }
748}, 772},
749/* Do not export init/exit functions or data */ 773/* Do not export init/exit functions or data */
750{ 774{
751 .fromsec = { "__ksymtab*", NULL }, 775 .fromsec = { "__ksymtab*", NULL },
752 .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL } 776 .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }
753} 777}
754}; 778};
755 779