[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211206203703.67597-1-kernel@esmil.dk>
Date: Mon, 6 Dec 2021 21:37:03 +0100
From: Emil Renner Berthing <kernel@...il.dk>
To: Ley Foon Tan <lftan.linux@...il.com>,
Matteo Croce <mcroce@...ux.microsoft.com>
Cc: Emil Renner Berthing <kernel@...il.dk>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Akira Tsukamoto <akira.tsukamoto@...il.com>,
Drew Fustini <drew@...gleboard.org>,
Bin Meng <bmeng.cn@...il.com>,
David Laight <David.Laight@...lab.com>,
Guo Ren <guoren@...nel.org>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v5 3/3] riscv: optimized memset
Hi Ley Foon,
You're right it doesn't boot for me either when building with
make ARCH=riscv LLVM=1
The following patch fixes it for me though. In hindsigt it's perhaps a
bit surprising it works without -ffreestanding in GCC.
/Emil
---
arch/riscv/lib/Makefile | 5 +++++
1 file changed, 5 insertions(+)
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
--
2.34.1
Powered by blists - more mailing lists