Re: /tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

From: Masami Hiramatsu
Date: Tue Mar 15 2022 - 05:26:11 EST


On Tue, 15 Mar 2022 06:00:48 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9
> commit: 7e9bf33b812471ee57a03ec7f9b544ca437cc706 ARM: kprobes: Make a frame pointer on __kretprobe_trampoline
> date: 5 months ago
> config: arm-randconfig-r002-20220313 (https://download.01.org/0day-ci/archive/20220315/202203150516.KTorSVVU-lkp@xxxxxxxxx/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7e9bf33b812471ee57a03ec7f9b544ca437cc706
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 7e9bf33b812471ee57a03ec7f9b544ca437cc706
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> arch/arm/probes/kprobes/core.c:236:16: warning: no previous prototype for 'kprobe_handler' [-Wmissing-prototypes]
> 236 | void __kprobes kprobe_handler(struct pt_regs *regs)
> | ^~~~~~~~~~~~~~
> arch/arm/probes/kprobes/core.c: In function 'arch_init_kprobes':
> arch/arm/probes/kprobes/core.c:465:12: warning: old-style function definition [-Wold-style-definition]
> 465 | int __init arch_init_kprobes()
> | ^~~~~~~~~~~~~~~~~
> /tmp/ccIWiggX.s: Assembler messages:
> >> /tmp/ccIWiggX.s:22: Error: invalid literal constant: pool needs to be closer

OK, I finally reproduced it and could make a fix.
It seems that I have to avoid accessing a C function address from the inline assembler in that function.
This can be gcc-11's bug, but to avoid this issue, I decided not using inline asm in the function.

Thank you,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>