lto: Make asmlinkage __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, wan/sbni: Make inline assembler symbols visible and assembler global

- Inline assembler defining C callable code has to be global
- The function has to be visible

Do this in wan/sbni

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Add missing asmlinkages and __visible

This is an arch/x86 sweep to add asmlinkage or __visible
to all functions accessed by assembler code. A lot of
functions already had it, but not all.

This is needed for the LTO kernel so that these functions are
not optimized away.

I used asmlinkage for functions without arguments, and __visible
for functions with. This prevents any problems on x86-32 with
asmlinkage changing the calling convention to regparm(0)

I kept it all in a single patch for now. Please let me know
if you want it split up.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Change dotraplinkage into __visible on 32bit v2

Mark 32bit dotraplinkage functions as __visible for LTO.
64bit already is using asmlinkage which includes it.

v2: Clean up (M.Marek)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Make lockdep_sys_exit asmlinkage

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, mutex: Mark __visible

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Mark do_exit asmlinkage

... since it can be called from assembler code

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Fix sys_call_table type in asm/syscall.h v2

Make the sys_call_table type defined in asm/syscall.h match
the definition in syscall_64.c

v2: include asm/syscall.h in syscall_64.c too. I left uml alone
because it doesn't have an syscall.h on its own and including
the native one leads to other errors.
Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Mark EXPORT_SYMBOL symbols __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Make ksymtab and kcrctab symbols and __this_module __visible

Make the ksymtab symbols for EXPORT_SYMBOL visible.
This prevents the LTO compiler from adding a .NUMBER prefix,
which avoids various problems in later export processing.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Make amd.c vide visible

A label declared in inline assembler has to be visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Fix AMD K6 indirect call check

The AMD K6 errata check relies on timing a indirect call.
But the way it was written it could be optimized to a direct call.
Force gcc to actually do a indirect call and not just
constant resolve the target address.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Make various variables used by assembler code __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, PNP: Fix the inline assembler to use asmlinkage symbols

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto, apm: Make APM data structure used from assembler visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto, lguest: Fix C functions used by inline assembler

- Make the C code used by the paravirt stubs visible
- Since they have to be global now, give them a more unique
name.

Cc: rusty@rustcorp.com.au
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, crypto, aes: mark AES tables __visible

Various tables in aes_generic are accessed by assembler code.
Mark them __visible for LTO

Cc: herbert@gondor.apana.org.au
Signed-off-by: Andi Kleen <ak@linux.intel.com>
crypto, lto: remove unnecessary asmlinkage

No use to make the pointer asmlinkage.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, watchdog/hpwdt.c: Make assembler label global

We cannot assume that the inline assembler code always ends up
in the same file as the original C file. So make any assembler labels
that are called with "extern" by C global

Cc: wim@iguana.be
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto: Mark vdso variables __visible

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