title: How to fix section mismatch errors during cross compile of android
body: <p>I am using the google ndk toolchain to cross compile an image for my Samsung Note 3 SM-N900P model. I downloaded the Kitkat version of Samsung Source code, and believe I have followed the instructions in the Kernel Readme file. It stated to use 4.7 toolchain, and I found it in NDK version 8d. But I get the following error:</p>
  
  <pre><code>ERROR: modpost: Found 2 section mismatch(es).
  To see full details build your kernel with:
  'make CONFIG_DEBUG_SECTION_MISMATCH=y'
  To build the kernel despite the mismatches, build with:
  'make CONFIG_NO_ERROR_ON_MISMATCH=y'
  (NOTE: This is not recommended)
  /home/sansari/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
  make[1]: *** [vmlinux.o] Error 1
  Makefile:935: recipe for target 'vmlinux.o' failed
  make: *** [vmlinux.o] Error
  </code></pre>
  
  <p>After doing some searching online, I see two different posts <a href="https://stackoverflow.com/questions/6807766/linux-kernel-config-debug-section-mismatch-make-errors">here</a>and <a href="https://stackoverflow.com/questions/8563978/what-is-kernel-section-mismatch">here</a>. One seems to imply that I can not fix the issue, while the other says somewhat the opposite. This is based on my limited knowledge of the make file. I have basically read the first three chapters of the user's guide. I know what recepies are, and what it's basic structure is. I did look at line 935 of my Makefile and Here it is:</p>
  
  <pre><code>modpost-init := $(filter-out init/built-in.o, $(vmlinux-init))
  vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
  $(call if_changed_rule,vmlinux-modpost)
  </code></pre>
  
  <p>I am posting this to find out if I can fix this error, and how I should go about it. Can anyone provide advice on how involved this problem is? Is it something I can fix? </p>
  
  <p>Here is the error when make debug option is turned on: </p>
  
  <pre><code>WARNING: vmlinux.o(.data+0x8434): Section mismatch in reference from the variable     msm_mpm_debug_mask to the function .init.text:mpm_irq_domain_linear_size()
  The variable msm_mpm_debug_mask references
  the function __init mpm_irq_domain_linear_size()
  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: vmlinux.o(.data+0x844c): Section mismatch in reference from the variable  msm_mpm_debug_mask to the function .init.text:mpm_irq_domain_legacy_size()
  The variable msm_mpm_debug_mask references
  the function __init mpm_irq_domain_legacy_size()
  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
  
  To build the kernel despite the mismatches, build with:
  'make CONFIG_NO_ERROR_ON_MISMATCH=y'
  (NOTE: This is not recommended)
  /home/sansari/android/kernel/scripts/Makefile.modpost:98: recipe for target 'vmlinux.o' failed
  make[1]: *** [vmlinux.o] Error 1
  Makefile:935: recipe for target 'vmlinux.o' failed
  make: *** [vmlinux.o] Error 2
  </code></pre>