Skip to content

Commit db76d20

Browse files
paulburtonZhengShunQian
authored andcommitted
MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7
commit 690d916 upstream. Some versions of GCC suboptimally generate calls to the __multi3() intrinsic for MIPS64r6 builds, resulting in link failures due to the missing function: LD vmlinux.o MODPOST vmlinux.o kernel/bpf/verifier.o: In function `kmalloc_array': include/linux/slab.h:631: undefined reference to `__multi3' fs/select.o: In function `kmalloc_array': include/linux/slab.h:631: undefined reference to `__multi3' ... We already have a workaround for this in which we provide the instrinsic, but we do so selectively for GCC 7 only. Unfortunately the issue occurs with older GCC versions too - it has been observed with both GCC 5.4.0 & GCC 6.4.0. MIPSr6 support was introduced in GCC 5, so all major GCC versions prior to GCC 8 are affected and we extend our workaround accordingly to all MIPS64r6 builds using GCC versions older than GCC 8. Signed-off-by: Paul Burton <[email protected]> Reported-by: Vladimir Kondratiev <[email protected]> Fixes: ebabcf1 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds") Patchwork: https://patchwork.linux-mips.org/patch/20297/ Cc: James Hogan <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: [email protected] Cc: [email protected] # 4.15+ Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5a08bf7 commit db76d20

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/mips/lib/multi3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#include "libgcc.h"
55

66
/*
7-
* GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that
8-
* specific case only we'll implement it here.
7+
* GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for
8+
* that specific case only we implement that intrinsic here.
99
*
1010
* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981
1111
*/
12-
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7)
12+
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8)
1313

1414
/* multiply 64-bit values, low 64-bits returned */
1515
static inline long long notrace dmulu(long long a, long long b)

0 commit comments

Comments
 (0)