Skip to content

Commit

Permalink
LoongArch: Drop -ffreestanding from CFLAGS
Browse files Browse the repository at this point in the history
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: ClangBuiltLinux#1897
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: WANG Xuerui <git@xen0n.name>
  • Loading branch information
xen0n authored and intel-lab-lkp committed Aug 4, 2023
1 parent c1a515d commit cba9c07
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion arch/loongarch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cba9c07

Please sign in to comment.