kbuild: Increase kallsyms max symbol length

[AK: This seems like a ticking time bomb even without LTO,
so should be merged now. It causes very weird problems.
Thanks to Joe for tracking them down.]

With the added postfixes that LTO adds for local
symbols, the longest name in the kernel overflows
the namebuf[KSYM_NAME_LEN] array by two bytes.  That name is:
__pci_fixup_resumePCI_VENDOR_ID_SERVERWORKSPCI_DEVICE_ID_SERVERWORKS_HT1000SBquirk_disable_broadcom_boot_interrupt.1488004.672802

Double the max symbol name length.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Kbuild: Handle longer symbols in kallsyms.c

Also warn for too long symbols

Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto, Kbuild, bloat-o-meter: fix static detection

Disable static detection: the static currently drops a lot of useful information
including clones generated by gcc. Drop this. The statics will appear now
without static. prefix.

But remove the LTO .NUMBER postfixes that look ugly

Signed-off-by: Andi Kleen <ak@linux.intel.com>
kprobes: Use KSYM_NAME_LEN to size identifier buffers

Use KSYM_NAME_LEN to size identifier buffers, so that it can
be easier increased.

Cc: ananth@in.ibm.com
Signed-off-by: Joe Mario <jmario@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: Make asmlinkage __visible

Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto, lguest: Pass in globals into assembler statement

Tell the compiler that the inline assembler statement
references lguest_entry.

This fixes compile problems with LTO where the variable
and the assembler code may end up in different files.

Cc: x86@kernel.org
Cc: rusty@rustcorp.com.au
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
Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto, paravirt: Don't rely on local assembler labels

The paravirt patching code assumes that it can reference a
local assembler label between two different top level assembler
statements. This does not work with LTO
where the assembler code may end up in different assembler files.

Replace it with extern / global /asm linkage labels.

This also removes one redundant copy of the macro.

Cc: jeremy@goop.org
Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86, lto, paravirt: Make paravirt thunks global v2

The paravirt thunks use a hack of using a static reference to a static
function to reference that function from the top level statement.

This assumes that gcc always generates static function names in a specific
format, which is not necessarily true.

Simply make these functions global and asmlinkage or __visible. This way the
static __used variables are not needed and everything works.

Functions with arguments are __visible to keep the register calling
convention on 32bit.

Changed in paravirt and in all users (Xen and vsmp)

v2: Use __visible for functions with arguments
Cc: jeremy@goop.org
Cc: Ido Yariv <ido@wizery.com>
Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
x86: Use inline assembler instead of global register variable to get sp v2

LTO in gcc 4.6/47. has trouble with global register variables. They were used
to read the stack pointer. Use a simple inline assembler statement with
a mov instead.

This also helps LLVM/clang, who do not support global register
variables.

v2: More general asm constraint. Fix description (Jan Beulich)
Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
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>
lto: 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 __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>
lto: 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>
lto: 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>
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.

Cc: rusty@rustcorp.com.au
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

Cc: mingo@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
lto: 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>
lto: Mark rwsem functions that can be called from assembler asmlinkage

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

Cc: netdev@vger.kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>