asmlinkage, kvm: Make kvm_rebooting visible

kvm_rebooting is referenced from assembler code, thus
needs to be visible.

Cc: gleb@redhat.com
Cc: pbonzini@redhat.com
Cc: kvm@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make __iowrite32_copy visible

This is a assembler function on x86, so it should be visible.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make jiffies visible

Jiffies is referenced by the linker script, so it has to be visible.

Handled both the generic and the x86 version.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage, pnp: Make variables used from assembler code visible

Mark variables referenced from assembler files visible.

This fixes compile problems with LTO

Cc: perex@perex.cz
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make lockdep_sys_exit asmlinkage

lockdep_sys_exit can be called from assembler code, so make it
asmlinkage

Cc: peterz@infradead.org
Cc: mingo@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make trace_hardirq visible

Can be called from assembler code.

Cc: peterz@infradead.org
Cc: mingo@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage, mutex: Mark __visible

Various kernel/mutex.c functions can be called from
inline assembler, so they should be all global and
__visible

Cc: mingo@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make main_extable_sort_needed visible

main_extable_sort_needed is used by the build system and needs
to be a normal ELF symbol. Make it visible so that LTO
does not remove or mangle it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Mark rwsem functions that can be called from assembler asmlinkage

Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage Make __stack_chk_failed and memcmp visible

In LTO symbols implicitely referenced by the compiler need
to be visible. Earlier these symbols were visible implicitely
from being exported, but we disabled implicit visibility fo
 EXPORTs when modules are disabled to improve code size. So
now these symbols have to be marked visible explicitely.

Do this for __stack_chk_fail (with stack protector)
and memcmp.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage, x86: Fix 32bit memcpy for LTO

These functions can be called implicitely from gcc, and thus need to be
visible.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
asmlinkage: Make trace_hardirqs_on/off_caller visible

These functions are called from assembler, and thus need to be
__visible

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
initconst: Fix initconst mistake in dcdbas

const must be __initconst

Cc: Douglas_Warzecha@dell.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
initconst, x86: Fix initconst mistake in ts5500 code

const data must be initconst.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, sections, numachip: Remove useless __read_mostly

const __read_mostly does not make any sense, because const
data is already read-only. Remove the __read_mostly
for the numachip APIC driver. This avoids a LTO
section conflict compile problem.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
sections, ipvs: Remove useless __read_mostly for ipvs genl_ops

const __read_mostly does not make any sense, because const
data is already read-only. Remove the __read_mostly
for the ipvs genl_ops. This avoids a LTO
section conflict compile problem.

Cc: Wensong Zhang <wensong@linux-vs.org>
Cc: Simon Horman <horms@verge.net.au>
Cc: Patrick McHardy <kaber@trash.net>
Cc: lvs-devel@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Disable LTO for the x86 VDSO

The VDSO does not play well with LTO, so just disable LTO for it.
Also pass a 32bit linker flag for the 32bit version.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Disable fancy hweight optimizations for LTO v2

The fancy x86 hweight uses different compiler options for the
hweight file. This does not work with LTO. Just disable the optimization
with LTO

v2: Simplify Kconfig checks (Jan Beulich)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Make asmlinkage __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, workaround: Add workaround for initcall reordering

Work around a LTO gcc problem: when there is no reference to a variable
in a module it will be moved to the end of the program. This causes
reordering of initcalls which the kernel does not like.
Add a dummy reference function to avoid this. The function is
deleted by the linker.

This replaces a previous much slower workaround.

Thanks to Honza Hubicka for suggesting this technique.

Signed-off-by: Andi Kleen <ak@linux.intel.com>