Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: do not compile generic functions for CONFIG_CAVIUM_OCTEON_SOC

MIPS provides multiple definitions for the following functions:

fw_init_cmdline
__delay
__udelay
__ndelay
memmove
__rmemcpy
memcpy
__copy_user

The generic ones are defined in lib-y objects, which are overridden by
the Octeon ones when CONFIG_CAVIUM_OCTEON_SOC is enabled.

The use of EXPORT_SYMBOL in static libraries potentially causes a
problem for the llvm linker [1]. So, I want to forcibly link lib-y
objects to vmlinux when CONFIG_MODULES=y.

As a groundwork, we must fix multiple definitions that have previously
been hidden by lib-y.

If you look at lib/string.c, arch can define __HAVE_ARCH_* to opt out
the generic implementation.

Similarly, this commit adds CONFIG_HAVE_PLAT_* to allow a platform
to opt out the MIPS generic code.

[1]: https://github.com/ClangBuiltLinux/linux/issues/515

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Masahiro Yamada and committed by
Thomas Bogendoerfer
78bdbbac 3e499013

+21
+12
arch/mips/Kconfig
··· 975 975 select SYS_HAS_EARLY_PRINTK 976 976 select SYS_HAS_CPU_CAVIUM_OCTEON 977 977 select HAVE_PCI 978 + select HAVE_PLAT_DELAY 979 + select HAVE_PLAT_FW_INIT_CMDLINE 980 + select HAVE_PLAT_MEMCPY 978 981 select ZONE_DMA32 979 982 select HOLES_IN_ZONE 980 983 select GPIOLIB ··· 1233 1230 config GENERIC_ISA_DMA_SUPPORT_BROKEN 1234 1231 bool 1235 1232 select GENERIC_ISA_DMA 1233 + 1234 + config HAVE_PLAT_DELAY 1235 + bool 1236 + 1237 + config HAVE_PLAT_FW_INIT_CMDLINE 1238 + bool 1239 + 1240 + config HAVE_PLAT_MEMCPY 1241 + bool 1236 1242 1237 1243 config ISA_DMA_API 1238 1244 bool
+2
arch/mips/fw/lib/cmdline.c
··· 16 16 int *_fw_argv; 17 17 int *_fw_envp; 18 18 19 + #ifndef CONFIG_HAVE_PLAT_FW_INIT_CMDLINE 19 20 void __init fw_init_cmdline(void) 20 21 { 21 22 int i; ··· 42 41 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); 43 42 } 44 43 } 44 + #endif 45 45 46 46 char * __init fw_getcmdline(void) 47 47 {
+4
arch/mips/lib/delay.c
··· 24 24 #define GCC_DADDI_IMM_ASM() "r" 25 25 #endif 26 26 27 + #ifndef CONFIG_HAVE_PLAT_DELAY 28 + 27 29 void __delay(unsigned long loops) 28 30 { 29 31 __asm__ __volatile__ ( ··· 65 63 __delay((ns * 0x00000005ull * HZ * lpj) >> 32); 66 64 } 67 65 EXPORT_SYMBOL(__ndelay); 66 + 67 + #endif
+3
arch/mips/lib/memcpy.S
··· 598 598 nop 599 599 .endm 600 600 601 + #ifndef CONFIG_HAVE_PLAT_MEMCPY 601 602 .align 5 602 603 LEAF(memmove) 603 604 EXPORT_SYMBOL(memmove) ··· 665 664 EXPORT_SYMBOL(__copy_user) 666 665 /* Legacy Mode, user <-> user */ 667 666 __BUILD_COPY_USER LEGACY_MODE USEROP USEROP 667 + 668 + #endif 668 669 669 670 #ifdef CONFIG_EVA 670 671