From cba9c07198e9e240664c09febba833b13d2482fd Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Fri, 4 Aug 2023 20:56:09 +0800 Subject: [PATCH] LoongArch: Drop -ffreestanding from CFLAGS 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 Suggested-by: Nick Desaulniers Signed-off-by: WANG Xuerui --- arch/loongarch/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index b1e5db51b61cac..db0d7210272dea 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