modpost: don't emit section mismatch warnings for compiler optimizations
authorPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 20 Apr 2015 00:50:40 +0000 (10:20 +0930)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 19 Mar 2018 18:58:24 +0000 (18:58 +0000)
commitf00e1e66622e2d4617db1e4bb24c1ea5616c4dd0
treec8ca04d15dbe885abcb8034458a22a815fd5c76e
parentd4a3239fa159342be1b8a6b1e2346fa40314e4e0
modpost: don't emit section mismatch warnings for compiler optimizations

commit 4a3893d069b788f3570c19c12d9e986e8e15870f upstream.

Currently an allyesconfig build [gcc-4.9.1] can generate the following:

   WARNING: vmlinux.o(.text.unlikely+0x3864): Section mismatch in
   reference from the function cpumask_empty.constprop.3() to the
   variable .init.data:nmi_ipi_mask

which comes from the cpumask_empty usage in arch/x86/kernel/nmi_selftest.c.

Normally we would not see a symbol entry for cpumask_empty since it is:

static inline bool cpumask_empty(const struct cpumask *srcp)

however in this case, the variant of the symbol gets emitted when GCC does
constant propagation optimization.

Fix things up so that any locally optimized constprop variants don't warn
when accessing variables that live in the __init sections.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[bwh: Backported to 3.2: Add definitions of {OTHER,ALL}_TEXT_SECTIONS]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
scripts/mod/modpost.c