x86: 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: Change dotraplinkage into __visible on 32bit

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
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>
Change kernel_execve to asmlinkage for all architectures

The x86 kernel_execve has to be asmlinkage because it's called from
assembler code. To make it consistent I have to also change
the prototype in linux/syscalls.h

This in turn requires adding asmlinkage to all architectures.

Do this here in a tree sweep.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
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>
Mark do_exit asmlinkage

... since it can be called from assembler code

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86: 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>
sound: Fix export symbols for !CONFIG_MODULES

The new LTO EXPORT_SYMBOL references symbols even without CONFIG_MODULES.
Since these functions are macros in this case this doesn't work.
Add a ifdef to fix the build.

Cc: tiwai@suse.de
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/lpfc: drop -Werror

gcc 4.7 errors out on some potentially unitialized variables otherwise.
They actually look like a false positive, but we should
never have -Werror in production code that people compile with
unknown compilers.

drivers/scsi/lpfc/lpfc_els.c: In function 'lpfc_els_rcv_rscn':
drivers/scsi/lpfc/lpfc_els.c:4763:5: error: 'cmd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/lpfc/lpfc_els.c:4763:5: error: 'length' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Cc: james.smart@emulex.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Mark EXPORT_SYMBOL symbols __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Make ksymtab and kcrctab symbols __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: 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: 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: Make various variables used by assembler code __visible

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

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, 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.

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

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
crypto, camelia: Make camelia tables used by assembler __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
KVM: Don't assume asm statements end up in the same assembler file

The VMX code references a local assembler label between two inline
assembler statements. This assumes they both end up in the same
assembler files. In some experimental builds of gcc this is not
necessarily true, causing linker failures.

Replace the local label reference with a more traditional asmlinkage
extern.

This also eliminates one assembler statement and
generates a bit better code on 64bit: the compiler can
use a RIP relative LEA instead of a movabs, saving
a few bytes.

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