aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <sebastian@breakpoint.cc>2012-06-03 14:48:17 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-16 14:44:30 -0400
commitbb15d8db7cce766b62cab624120916d25e94ac7a (patch)
treebc8e4ff510770606aab3a54d27ada7fe7b90072d /scripts/mod
parent1359bac229637cd9e317f6069e5fb3544d64b7ca (diff)
scripts/modpost: check for bad references in .pci.fixups area
Functions used for PCI fixups (like DECLARE_PCI_FIXUP_HEADER) are often marked __init. This is okay as long as nobody is using PCI hotplug. However if one does execute | echo 1 > /sys/bus/pci/rescan and we hit a module which is marked __init istead of __devinit then we go boom because the code is removed after the kernel booted. This patch help to see those section mismatches. Cc: Michal Marek <mmarek@suse.cz> Cc: linux-kbuild@vger.kernel.org Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0f84bb38eb0d..68e9f5ed0a6f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -865,6 +865,11 @@ static void check_section(const char *modname, struct elf_info *elf,
865#define ALL_EXIT_TEXT_SECTIONS \ 865#define ALL_EXIT_TEXT_SECTIONS \
866 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 866 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
867 867
868#define ALL_PCI_INIT_SECTIONS \
869 ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \
870 ".pci_fixup_enable$", ".pci_fixup_resume$", \
871 ".pci_fixup_resume_early$", ".pci_fixup_suspend$"
872
868#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ 873#define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \
869 MEM_INIT_SECTIONS 874 MEM_INIT_SECTIONS
870#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ 875#define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \
@@ -1027,6 +1032,12 @@ const struct sectioncheck sectioncheck[] = {
1027 .mismatch = ANY_EXIT_TO_ANY_INIT, 1032 .mismatch = ANY_EXIT_TO_ANY_INIT,
1028 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, 1033 .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
1029}, 1034},
1035{
1036 .fromsec = { ALL_PCI_INIT_SECTIONS, NULL },
1037 .tosec = { INIT_SECTIONS, NULL },
1038 .mismatch = ANY_INIT_TO_ANY_EXIT,
1039 .symbol_white_list = { NULL },
1040},
1030/* Do not export init/exit functions or data */ 1041/* Do not export init/exit functions or data */
1031{ 1042{
1032 .fromsec = { "__ksymtab*", NULL }, 1043 .fromsec = { "__ksymtab*", NULL },