[linux-next:master 8956/10560] main.c:undefined reference to `__st_r13_to_r15'
Arnd Bergmann
arnd at arndb.de
Sun Nov 22 15:24:36 PST 2026
On Mon, Nov 23, 2026, at 00:14, Vineet Gupta wrote:
> On 11/21/26 02:18, Arnd Bergmann wrote:
>> On Sat, Nov 21, 2026, at 01:53, kernel test robot wrote:
>>>
>>> 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.
>
> Thanks I was trying to do this as well, but couldn't since I didn't have
> an older toolchain handy.
You can always use the toolchains from
https://mirrors.edge.kernel.org/pub/tools/crosstool/
>> 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__
>
> I thik this is the right fix.
> Ideally this is only needed for OPTIMIZE_FOR_SIZE, let me send a v2.
Ok
>> 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:
>
> I don't recall the history behind this is, seems like its been since
> since th eoriginal port.
> I can do a follow up cleanup.
Sounds good, thanks!
Arnd
More information about the linux-snps-arc
mailing list