[Precise] Section mismatch warnings

Tetsuo Handa from-ubuntu at I-love.SAKURA.ne.jp
Thu Mar 29 05:47:36 UTC 2012


I noticed a section mismatch warning while building 3.2.0-20.33 for X86_32.

 AR      arch/x86/lib/lib.a
  LD      vmlinux.o
  MODPOST vmlinux.o
WARNING: vmlinux.o(.text+0x187833): Section mismatch in reference from the function load_elf_binary() to the variable .cpuinit.data:disable_nx
The function load_elf_binary() references
the variable __cpuinitdata disable_nx.
This is often because load_elf_binary lacks a __cpuinitdata
annotation or the annotation of disable_nx is wrong.

  GEN     .version
  CHK     include/generated/compile.h
  LD      .tmp_vmlinux1
  KSYM    .tmp_kallsyms1.S
  AS      .tmp_kallsyms1.o
  LD      .tmp_vmlinux2
  KSYM    .tmp_kallsyms2.S
  AS      .tmp_kallsyms2.o
  LD      vmlinux

The load_elf_binary() in question has

#ifdef CONFIG_X86_32
        /*
         * Turn off the CS limit completely if exec-shield disabled or
         * NX active:
         */
        if (disable_nx || executable_stack != EXSTACK_DISABLE_X || (__supported_pte_mask & _PAGE_NX))
                arch_add_exec_range(current->mm, -1);
#endif

As far as I know, Fedora 15/16 and Ubuntu 11.04/11.10/12.04 have this code but
they did not remove "__cpuinitdata" annotation when removing "static".

fedora-15/linux-2.6.42.12-1.fc15/arch/x86/mm/setup_nx.c:int disable_nx __cpuinitdata;
fedora-16/linux-3.3.0-4.fc16/arch/x86/mm/setup_nx.c:int disable_nx __cpuinitdata;
ubuntu-11.04/linux-2.6.38-13.57/arch/x86/mm/setup_nx.c:int disable_nx __cpuinitdata;
ubuntu-11.10/linux-3.0.0-17.30/arch/x86/mm/setup_nx.c:int disable_nx __cpuinitdata;
ubuntu-12.04/linux-3.2.0-20.33/arch/x86/mm/setup_nx.c:int disable_nx __cpuinitdata;

load_elf_binary() is definitely called after initialization.
Don't we need to remove __cpuinitdata annotation like
https://lkml.org/lkml/2006/12/13/300 ?



There are many similar warnings with this kernel build.
Maybe we should recheck.

  MODPOST 3524 modules
WARNING: drivers/net/ethernet/3com/3c509.o(.data+0x1bc): Section mismatch in reference from the variable el3_eisa_driver to the function .init.text:el3_eisa_probe()
The variable el3_eisa_driver references
the function __init el3_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/3com/3c509.o(.data+0x1e0): Section mismatch in reference from the variable el3_mca_driver to the variable .init.data:el3_mca_adapter_ids
The variable el3_mca_driver references
the variable __initdata el3_mca_adapter_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/3com/3c509.o(.data+0x204): Section mismatch in reference from the variable el3_mca_driver to the function .init.text:el3_mca_probe()
The variable el3_mca_driver references
the function __init el3_mca_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/3com/3c59x.o(.data+0xdc): Section mismatch in reference from the variable vortex_eisa_driver to the function .init.text:vortex_eisa_probe()
The variable vortex_eisa_driver references
the function __init vortex_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/8390/ne3210.o(.data+0x5c): Section mismatch in reference from the variable ne3210_eisa_driver to the function .init.text:ne3210_eisa_probe()
The variable ne3210_eisa_driver references
the function __init ne3210_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/8390/smc-mca.o(.data+0x0): Section mismatch in reference from the variable ultra_driver to the variable .init.data:smc_mca_adapter_ids
The variable ultra_driver references
the variable __initdata smc_mca_adapter_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/8390/smc-mca.o(.data+0x24): Section mismatch in reference from the variable ultra_driver to the function .init.text:ultramca_probe()
The variable ultra_driver references
the function __init ultramca_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/amd/depca.o(.data+0x44): Section mismatch in reference from the variable depca_mca_driver to the function .init.text:depca_mca_probe()
The variable depca_mca_driver references
the function __init depca_mca_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/amd/depca.o(.data+0x9c): Section mismatch in reference from the variable depca_eisa_driver to the function .init.text:depca_eisa_probe()
The variable depca_eisa_driver references
the function __init depca_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/amd/depca.o(.devinit.text+0x1b): Section mismatch in reference from the function depca_isa_probe() to the function .init.text:depca_common_init()
The function __devinit depca_isa_probe() references
a function __init depca_common_init().
If depca_common_init is only used by depca_isa_probe then
annotate depca_common_init with a matching annotation.

WARNING: drivers/net/ethernet/amd/depca.o(.devinit.text+0x2e): Section mismatch in reference from the function depca_isa_probe() to the function .init.text:depca_shmem_probe()
The function __devinit depca_isa_probe() references
a function __init depca_shmem_probe().
If depca_shmem_probe is only used by depca_isa_probe then
annotate depca_shmem_probe with a matching annotation.

WARNING: drivers/net/ethernet/amd/depca.o(.devinit.text+0x65): Section mismatch in reference from the function depca_isa_probe() to the function .init.text:depca_hw_init()
The function __devinit depca_isa_probe() references
a function __init depca_hw_init().
If depca_hw_init is only used by depca_isa_probe then
annotate depca_hw_init with a matching annotation.

WARNING: drivers/net/ethernet/dec/tulip/de4x5.o(.data+0xbc): Section mismatch in reference from the variable de4x5_eisa_driver to the function .init.text:de4x5_eisa_probe()
The variable de4x5_eisa_driver references
the function __init de4x5_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/hp/hp100.o(.data+0x7c): Section mismatch in reference from the variable hp100_eisa_driver to the function .init.text:hp100_eisa_probe()
The variable hp100_eisa_driver references
the function __init hp100_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/ethernet/natsemi/ibmlana.o(.data+0x0): Section mismatch in reference from the variable ibmlana_driver to the variable .init.data:ibmlana_adapter_ids
The variable ibmlana_driver references
the variable __initdata ibmlana_adapter_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/net/tokenring/madgemc.o(.data+0x0): Section mismatch in reference from the variable madgemc_driver to the variable .init.data:madgemc_adapter_ids
The variable madgemc_driver references
the variable __initdata madgemc_adapter_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/scsi/NCR_Q720_mod.o(.data+0x24): Section mismatch in reference from the variable NCR_Q720_driver to the function .init.text:NCR_Q720_probe()
The variable NCR_Q720_driver references
the function __init NCR_Q720_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/scsi/sim710.o(.data+0x64): Section mismatch in reference from the variable sim710_mca_driver to the function .init.text:sim710_mca_probe()
The variable sim710_mca_driver references
the function __init sim710_mca_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/scsi/sim710.o(.data+0xbc): Section mismatch in reference from the variable sim710_eisa_driver to the function .init.text:sim710_eisa_probe()
The variable sim710_eisa_driver references
the function __init sim710_eisa_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/staging/comedi/drivers/s626.o(.text+0x236d): Section mismatch in reference from the function s626_attach() to the variable .devinit.rodata:s626_pci_table
The function s626_attach() references
the variable __devinitconst s626_pci_table.
This is often because s626_attach lacks a __devinitconst
annotation or the annotation of s626_pci_table is wrong.

WARNING: drivers/staging/comedi/drivers/s626.o(.text+0x2373): Section mismatch in reference from the function s626_attach() to the variable .devinit.rodata:s626_pci_table
The function s626_attach() references
the variable __devinitconst s626_pci_table.
This is often because s626_attach lacks a __devinitconst
annotation or the annotation of s626_pci_table is wrong.

WARNING: drivers/staging/comedi/drivers/s626.o(.text+0x2379): Section mismatch in reference from the function s626_attach() to the variable .devinit.rodata:s626_pci_table
The function s626_attach() references
the variable __devinitconst s626_pci_table.
This is often because s626_attach lacks a __devinitconst
annotation or the annotation of s626_pci_table is wrong.

WARNING: drivers/staging/comedi/drivers/s626.o(.text+0x2381): Section mismatch in reference from the function s626_attach() to the variable .devinit.rodata:s626_pci_table
The function s626_attach() references
the variable __devinitconst s626_pci_table.
This is often because s626_attach lacks a __devinitconst
annotation or the annotation of s626_pci_table is wrong.

WARNING: drivers/usb/gadget/g_ffs.o(.text+0x6c53): Section mismatch in reference from the function eth_bind_config() to the function .init.text:geth_bind_config()
The function eth_bind_config() references
the function __init geth_bind_config().
This is often because eth_bind_config lacks a __init
annotation or the annotation of geth_bind_config is wrong.

WARNING: drivers/video/vesafb.o(.exit.text+0x42): Section mismatch in reference from the function vesafb_remove() to the (unknown reference) .init.data:(unknown)
The function __exit vesafb_remove() references
a (unknown reference) __initdata (unknown).
This is often seen when error handling in the exit function
uses functionality in the init path.
The fix is often to remove the __initdata annotation of
(unknown) so it may be used outside an init section.

WARNING: drivers/video/vesafb.o(.exit.text+0x4a): Section mismatch in reference from the function vesafb_remove() to the variable .init.data:vesafb_fix
The function __exit vesafb_remove() references
a variable __initdata vesafb_fix.
This is often seen when error handling in the exit function
uses functionality in the init path.
The fix is often to remove the __initdata annotation of
vesafb_fix so it may be used outside an init section.




More information about the kernel-team mailing list