All of lore.kernel.org
 help / color / mirror / Atom feed
* undefined reference to `__multi3' when building with gcc 7.x
@ 2017-08-03 20:55 Thomas Petazzoni
  2017-08-04  0:05 ` Ralf Baechle
  2017-12-03  9:56 ` Thomas Petazzoni
  0 siblings, 2 replies; 26+ messages in thread
From: Thomas Petazzoni @ 2017-08-03 20:55 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips, Waldemar Brodkorb

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

Hello,

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 <ethtool_set_per_queue_coalesce+0x7c>
    1ab4:       14600000        bnez    v1,1ab8 <ethtool_set_per_queue_coalesce+0x80>

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
http://toolchains.free-electrons.com/downloads/2017.08-rc1-fix-binutils/toolchains/mips64r6el-n32/tarballs/mips64r6el-n32--glibc--bleeding-edge-2017.05-1453-ga703fdd-1.tar.bz2
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
function.

FWIW, sparc64 had a similar issue, and they added __multi3 in their
libgcc replacement, see commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/sparc/lib?id=1b4af13ff2cc6897557bb0b8d9e2fad4fa4d67aa.

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: defconfig --]
[-- Type: application/octet-stream, Size: 654 bytes --]

CONFIG_MIPS_MALTA=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_CPU_MIPS64_R6=y
CONFIG_64BIT=y
CONFIG_SYSVIPC=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_PCI=y
CONFIG_MIPS32_O32=y
CONFIG_MIPS32_N32=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_IDE=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_IDE_GENERIC=y
CONFIG_BLK_DEV_GENERIC=y
CONFIG_BLK_DEV_PIIX=y
CONFIG_NETDEVICES=y
CONFIG_PCNET32=y
CONFIG_INPUT_EVDEV=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FB=y
CONFIG_FB_CIRRUS=y
CONFIG_USB=y
CONFIG_USB_UHCI_HCD=y
CONFIG_EXT4_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-12-27  8:31 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03 20:55 undefined reference to `__multi3' when building with gcc 7.x Thomas Petazzoni
2017-08-04  0:05 ` Ralf Baechle
2017-08-04 15:19   ` Ralf Baechle
2017-08-04 15:41     ` Thomas Petazzoni
2017-08-04 22:25       ` Ralf Baechle
2017-08-05 11:56         ` Thomas Petazzoni
2017-08-07  8:34           ` Ralf Baechle
2017-08-13 20:46             ` Thomas Petazzoni
2017-08-17  7:15               ` Ralf Baechle
2017-08-17  8:49                 ` Matthew Fortune
2017-08-17 22:19                   ` Ralf Baechle
2017-10-07 19:22                     ` Thomas Petazzoni
2017-11-07 17:39                     ` Thomas Petazzoni
2017-08-17  1:01         ` Maciej W. Rozycki
2017-08-17  1:01           ` Maciej W. Rozycki
2017-12-03  9:56 ` Thomas Petazzoni
2017-12-05 23:49   ` James Hogan
2017-12-05 23:49     ` James Hogan
2017-12-06  7:50     ` Thomas Petazzoni
2017-12-06  7:50       ` Thomas Petazzoni
2017-12-07  7:20       ` [PATCH] MIPS: Implement __multi3 for GCC7 MIPS64r6 builds James Hogan
2017-12-08 23:52         ` Maciej W. Rozycki
2017-12-08 23:52           ` Maciej W. Rozycki
2017-12-09  7:15           ` James Hogan
2017-12-09  7:15             ` James Hogan
2017-12-27  8:31         ` Waldemar Brodkorb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.