Skip to content

Commit 78bdbba

Browse files
masahir0ytsbogend
authored andcommitted
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]: ClangBuiltLinux#515 Reported-by: kbuild test robot <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 3e49901 commit 78bdbba

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

arch/mips/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,9 @@ config CAVIUM_OCTEON_SOC
975975
select SYS_HAS_EARLY_PRINTK
976976
select SYS_HAS_CPU_CAVIUM_OCTEON
977977
select HAVE_PCI
978+
select HAVE_PLAT_DELAY
979+
select HAVE_PLAT_FW_INIT_CMDLINE
980+
select HAVE_PLAT_MEMCPY
978981
select ZONE_DMA32
979982
select HOLES_IN_ZONE
980983
select GPIOLIB
@@ -1231,6 +1234,15 @@ config GENERIC_ISA_DMA_SUPPORT_BROKEN
12311234
bool
12321235
select GENERIC_ISA_DMA
12331236

1237+
config HAVE_PLAT_DELAY
1238+
bool
1239+
1240+
config HAVE_PLAT_FW_INIT_CMDLINE
1241+
bool
1242+
1243+
config HAVE_PLAT_MEMCPY
1244+
bool
1245+
12341246
config ISA_DMA_API
12351247
bool
12361248

arch/mips/fw/lib/cmdline.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ int fw_argc;
1616
int *_fw_argv;
1717
int *_fw_envp;
1818

19+
#ifndef CONFIG_HAVE_PLAT_FW_INIT_CMDLINE
1920
void __init fw_init_cmdline(void)
2021
{
2122
int i;
@@ -41,6 +42,7 @@ void __init fw_init_cmdline(void)
4142
strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
4243
}
4344
}
45+
#endif
4446

4547
char * __init fw_getcmdline(void)
4648
{

arch/mips/lib/delay.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#define GCC_DADDI_IMM_ASM() "r"
2525
#endif
2626

27+
#ifndef CONFIG_HAVE_PLAT_DELAY
28+
2729
void __delay(unsigned long loops)
2830
{
2931
__asm__ __volatile__ (
@@ -63,3 +65,5 @@ void __ndelay(unsigned long ns)
6365
__delay((ns * 0x00000005ull * HZ * lpj) >> 32);
6466
}
6567
EXPORT_SYMBOL(__ndelay);
68+
69+
#endif

arch/mips/lib/memcpy.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ SEXC(1)
598598
nop
599599
.endm
600600

601+
#ifndef CONFIG_HAVE_PLAT_MEMCPY
601602
.align 5
602603
LEAF(memmove)
603604
EXPORT_SYMBOL(memmove)
@@ -665,6 +666,8 @@ EXPORT_SYMBOL(__copy_user)
665666
/* Legacy Mode, user <-> user */
666667
__BUILD_COPY_USER LEGACY_MODE USEROP USEROP
667668

669+
#endif
670+
668671
#ifdef CONFIG_EVA
669672

670673
/*

0 commit comments

Comments
 (0)