parisc: Enable -mlong-calls gcc option with CONFIG_COMPILE_TEST
authorHelge Deller <deller@gmx.de>
Tue, 2 Mar 2021 20:07:07 +0000 (21:07 +0100)
committerHelge Deller <deller@gmx.de>
Tue, 2 Mar 2021 20:21:17 +0000 (21:21 +0100)
commit778e45d7720d663811352943dd515b41f6849637
tree11f884ed1275cf800a9bc2b091234e24bf2267f9
parentfe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
parisc: Enable -mlong-calls gcc option with CONFIG_COMPILE_TEST

The kernel test robot reported multiple linkage problems like this:

    hppa64-linux-ld: init/main.o(.init.text+0x56c): cannot reach printk
    init/main.o: in function `unknown_bootoption':
    (.init.text+0x56c): relocation truncated to fit: R_PARISC_PCREL22F against
symbol `printk' defined in .text.unlikely section in kernel/printk/printk.o

There are two ways to solve it:
a) Enable the -mlong-call compiler option (CONFIG_MLONGCALLS),
b) Add long branch stub support in 64-bit linker.

While b) is the long-term solution, this patch works around the issue by
automatically enabling the CONFIG_MLONGCALLS option when
CONFIG_COMPILE_TEST is set, which indicates that a non-production kernel
(e.g. 0-day kernel) is built.

Signed-off-by: Helge Deller <deller@gmx.de>
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 00e35f2b0e8a ("parisc: Enable -mlong-calls gcc option by default when !CONFIG_MODULES")
Cc: stable@vger.kernel.org # v5.6+
arch/parisc/Kconfig