[linux-next:master 8956/10560] main.c:undefined reference to `__st_r13_to_r15'

Arnd Bergmann arnd at arndb.de
Sat Nov 21 02:18:34 PST 2026


On Sat, Nov 21, 2026, at 01:53, kernel test robot wrote:
> tree:   
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
> master
> head:   909ef7a9a30fa139e69e555e3606680f5cca7726
> commit: 86a4eab2bd8313fec6e54742e3ea187b65b86b07 [8956/10560] ARC: stop 
> linking libgcc
> config: arc-randconfig-2000-20261120 
> (https://download.01.org/0day-ci/archive/20261121/20261121004452.TskH9STt-lkp@intel.com/config)
> compiler: arc-linux-gcc (GCC) 9.5.0
> reproduce (this is a W=1 build): 
> (https://download.01.org/0day-ci/archive/20261121/20261121004452.TskH9STt-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp at intel.com>
> | Closes: https://lore.kernel.org/r/20261121004452.TskH9STt-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>    arc-linux-ld: init/main.o: in function `__traceiter_initcall_finish':
>>> main.c:(.text+0x90): undefined reference to `__st_r13_to_r15'
>>> arc-linux-ld: main.c:(.text+0x90): undefined reference to `__st_r13_to_r15'
>>> arc-linux-ld: main.c:(.text+0xba): undefined reference to `__ld_r13_to_r15_ret'
>>> arc-linux-ld: main.c:(.text+0xba): undefined reference to `__ld_r13_to_r15_ret'

I've managed to reproduce this, but only with gcc-12 and older,
not gcc-13 and up. I also found a workaround, but I'm not sure if this
is a good idea or not:

--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -9,7 +9,7 @@ ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux- arc-linux-gnu-)
 endif
 
-cflags-y       += -fno-common -pipe -fno-builtin -mmedium-calls -mswape -D__linux__
+cflags-y       += -fno-common -pipe -fno-builtin -mmedium-calls -mswape -mno-millicode -D__linux__
 
 tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT)  := -mcpu=arc700
 tune-mcpu-def-$(CONFIG_ISA_ARCV2)      := -mcpu=hs38

The alternative of course is to include the libgcc file that includes the
millicode helpers.

I also came across the "-fno-builtin", which seems like a bad idea because
it prevents a number of optimizations. I could get it to build without the
argument using two oneline changes, but that doesn't mean this is correct
or complete:

--- a/arch/arc/include/asm/bitops.h
+++ b/arch/arc/include/asm/bitops.h
@@ -143,7 +143,7 @@ static inline __attribute__ ((const)) unsigned long __fls(unsigned long x)
  * ffs = Find First Set in word (LSB to MSB)
  * @result: [1-32], 0 if all 0's
  */
-static inline __attribute__ ((const)) int ffs(unsigned int x)
+static inline __attribute__ ((const)) int ffs(int x)
 {
        int n;
 
a/arch/arc/kernel/traps.c
+++ b/arch/arc/kernel/traps.c
@@ -156,4 +156,5 @@ void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs)
 void abort(void)
 {
        __asm__ __volatile__("trap_s  5\n");
+       unreachable();
 }

     Arnd



More information about the linux-snps-arc mailing list