Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7009723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:53:55+00:00 2026-05-27T21:53:55+00:00

When compiling a kernel module, I got a WARNING with a note to add

  • 0

When compiling a kernel module, I got a WARNING with a note to add a compile option, CONFIG_DEBUG_SECTION_MISMATCH=y. It give me more detailed info about issue:

WARNING: \**\*path to module\***(.text+0x8d2): Section mismatch in reference from the function Pch_Spi_Enable_Bios_Wr() to the variable .devinit.data:ich9_pci_tbl.22939
The function Pch_Spi_Enable_Bios_Wr() references
the variable __devinitdata ich9_pci_tbl.22939.
This is often because Pch_Spi_Enable_Bios_Wr lacks a __devinitdata
annotation or the annotation of ich9_pci_tbl.22939 is wrong.

I could not find what exactly kernel section mismatch is, not to mention how to go about fixing it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:53:56+00:00Added an answer on May 27, 2026 at 9:53 pm

    It means that a function that is in a section with a given lifetime references something that is in a section with a different lifetime.

    When the kernel binary is linked, different parts of the code and data are split up into different sections. Some of these sections are kept loaded all the time, but some others are removed once they are no longer needed (things that are only required during boot for example can be freed once boot is done – this saves memory).

    If a function that is in a long-lasting section refers to data in one of the discardable sections, there is a problem – it might try to access that data when it has already been released, leading to all kinds of runtime issues.

    This is not a warning you’ll fix yourself, unless you wrote that code or are very familiar with it. It gets fixed by correctly annotating the function (or the data it refers to) so that it goes into the right section. The right fix can only be determined with detailed knowledge of that part of the kernel.


    For a list of these sections and annotations, refer to the include/linux/init.h header in your kernel source tree:

    /* These macros are used to mark some functions or 
     * initialized data (doesn't apply to uninitialized data)
     * as `initialization' functions. The kernel can take this
     * as hint that the function is used only during the initialization
     * phase and free up used memory resources after
     *
     * Usage:
     * For functions:
     * 
     * You should add __init immediately before the function name, like:
     *
     * static void __init initme(int x, int y)
     * {
     *    extern int z; z = x * y;
     * }
     *
     * If the function has a prototype somewhere, you can also add
     * __init between closing brace of the prototype and semicolon:
     *
     * extern int initialize_foobar_device(int, int, int) __init;
     *
     * For initialized data:
     * You should insert __initdata between the variable name and equal
     * sign followed by value, e.g.:
     *
     * static int init_variable __initdata = 0;
     * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
     *
     * Don't forget to initialize data not at file scope, i.e. within a function,
     * as gcc otherwise puts the data into the bss section and not into the init
     * section.
     * 
     * Also note, that this data cannot be "const".
     */
    
    /* These are for everybody (although not all archs will actually
       discard it in modules) */
    #define __init      __section(.init.text) __cold notrace
    #define __initdata  __section(.init.data)
    #define __initconst __section(.init.rodata)
    #define __exitdata  __section(.exit.data)
    #define __exit_call __used __section(.exitcall.exit)
    

    Others follow, with more comments and explanations.

    See also the help text for the CONFIG_DEBUG_SECTION_MISMATCH Kconfig symbol:

    The section mismatch analysis checks if there are illegal
    references from one section to another section.
    Linux will during link or during runtime drop some sections
    and any use of code/data previously in these sections will
    most likely result in an oops.
    In the code functions and variables are annotated with
    __init, __devinit etc. (see full list in include/linux/init.h)
    which results in the code/data being placed in specific sections.
    The section mismatch analysis is always done after a full
    kernel build but enabling this option will in addition
    do the following:

    • Add the option -fno-inline-functions-called-once to gcc
      When inlining a function annotated __init in a non-init
      function we would lose the section information and thus
      the analysis would not catch the illegal reference.
      This option tells gcc to inline less but will also
      result in a larger kernel.
    • Run the section mismatch analysis for each module/built-in.o
      When we run the section mismatch analysis on vmlinux.o we
      lose valueble information about where the mismatch was
      introduced.
      Running the analysis for each module/built-in.o file
      will tell where the mismatch happens much closer to the
      source. The drawback is that we will report the same
      mismatch at least twice.
    • Enable verbose reporting from modpost to help solving
      the section mismatches reported.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am compiling my first Linux Kernel Module, when i got this error: from
Compiling a kernel module on 32-Bit Linux kernel results in __udivdi3 [mymodule.ko] undefined! __umoddi3
I am compiling a kernel module and it has many compilation errors in it.
I am compiling a kernel module, containing a structure of size 34, using the
I have a somewhat complex kernel with the following stats: ptxas info : Compiling
I am compiling a kernel module in linux related to creating kthreads to achieve
I am interested in cross-compiling a Linux kernel for an ARM target on a
I'm following the kernel tutorial from here im having problems compiling my files. i
I don't quite understand the compiling process of the Linux kernel when I install
When compiling my C++ .Net application I get 104 warnings of the type: Warning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.