[Top] [All Lists]

undefined reference to `__multi3' when building with gcc 7.x

To: Ralf Baechle <>,, Waldemar Brodkorb <>
Subject: undefined reference to `__multi3' when building with gcc 7.x
From: Thomas Petazzoni <>
Date: Thu, 3 Aug 2017 22:55:47 +0200
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Organization: Free Electrons
Original-recipient: rfc822;

When trying to build the current Linux master with a gcc 7.x toolchain
for mips64r6-n32, I'm getting the following build failure:

crypto/scompress.o: In function `.L31':
scompress.c:(.text+0x2a0): undefined reference to `__multi3'
drivers/base/component.o: In function `.L97':
component.c:(.text+0x4a4): undefined reference to `__multi3'
drivers/base/component.o: In function `component_master_add_with_match':
component.c:(.text+0x8c4): undefined reference to `__multi3'
net/core/ethtool.o: In function `ethtool_set_per_queue_coalesce':
ethtool.c:(.text+0x1ab0): undefined reference to `__multi3'
Makefile:1000: recipe for target 'vmlinux' failed
make[2]: *** [vmlinux] Error 1

Taking the example from net/core/ethtool.o, objdump says:

    1aac:       00408025        move    s0,v0
    1ab0:       e8000000        balc    1ab4 
    1ab4:       14600000        bnez    v1,1ab8 

And readelf tells us:

Relocation section '.rela.text' at offset 0xaa00 contains 1189 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000001ab0  023a0000003d R_MIPS_PC26_S2    0000000000000000 __multi3 - 4
                    Type2: R_MIPS_NONE      
                    Type3: R_MIPS_NONE      
Symbol table '.symtab' contains 586 entries:
   570: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND __multi3

__multi3() is normally provided by libgcc, but of course the kernel
doesn't link with libgcc.

The bug can be reproduced by building with the toolchain available at
and building with the attached kernel configuration file.

It is not clear to me if this is a kernel issue (lack of __multi3 in
arch/mips/lib/), or a gcc bug in that it shouldn't emit a call to this

FWIW, sparc64 had a similar issue, and they added __multi3 in their
libgcc replacement, see commit

Best regards,

Thomas Petazzoni
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering

Attachment: defconfig
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>