VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Emil Renner Berthing <kernel@esmil.dk> 2021-12-06 21:27:07 +0100 committer: Emil Renner Berthing <kernel@esmil.dk> 2021-12-26 16:41:28 +0100 commit: 07ce55430559828180aa77e3b48b6172d084b7a1 parent: 3748ead13fc441b8aebddec1b61e49e25cb3bba1
Commit Summary:
riscv: Add -ffreestanding for string functions
Diffstat:
1 file changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index e33263cc622a..6dfa919d4cd6 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -4,4 +4,9 @@ lib-$(CONFIG_MMU)	+= uaccess.o
 lib-$(CONFIG_64BIT)	+= tishift.o
 lib-$(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE) += string.o
 
+# string.o implements standard library functions like memset/memcpy etc.
+# Use -ffreestanding to ensure that the compiler does not try to "optimize"
+# them into calls to themselves.
+CFLAGS_string.o := -ffreestanding
+
 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o