mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Drop -ffreestanding from CFLAGS
@ 2023-08-04 12:56 WANG Xuerui
  2023-08-04 15:25 ` Huacai Chen
  2023-08-04 20:46 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: WANG Xuerui @ 2023-08-04 12:56 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Nathan Chancellor, loongarch, llvm, linux-kernel, WANG Xuerui,
	Nick Desaulniers

From: WANG Xuerui <git@xen0n.name>

As explained by Nick in the original issue: the kernel usually does a
good job of providing library helpers that have similar semantics as
their ordinary userspace libc equivalents, but -ffreestanding disables
such libcall optimization and other related features in the compiler,
which can lead to unexpected things such as CONFIG_FORTIFY_SOURCE not
working (!).

As it turns out to be the case, removing the flag does not impact the
LoongArch kernel's normal operation at all; so just remove it to
restore expected libcall semantics globally on this architecture.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1897
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
 arch/loongarch/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index b1e5db51b61c..db0d7210272d 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -83,7 +83,6 @@ KBUILD_CFLAGS_KERNEL		+= -fPIE
 LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext
 endif
 
-cflags-y += -ffreestanding
 cflags-y += $(call cc-option, -mno-check-zero-division)
 
 load-y		= 0x9000000000200000
-- 
2.40.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-04 20:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-04 12:56 [PATCH] LoongArch: Drop -ffreestanding from CFLAGS WANG Xuerui
2023-08-04 15:25 ` Huacai Chen
2023-08-04 15:46   ` Nick Desaulniers
2023-08-04 15:56     ` Xi Ruoyao
2023-08-04 16:15       ` Nick Desaulniers
2023-08-04 20:46 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®