diff options
author | WANG Xuerui <git@xen0n.name> | 2023-08-25 17:40:26 +0200 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-08-25 17:40:26 +0200 |
commit | 3f301dc292eb122eff61b8b2906e519154b0327f (patch) | |
tree | eed036a6c477a92ae5bf010d93771023f39a2237 /arch/loongarch/Makefile | |
parent | LoongArch: Remove redundant "source drivers/firmware/Kconfig" (diff) | |
download | linux-3f301dc292eb122eff61b8b2906e519154b0327f.tar.xz linux-3f301dc292eb122eff61b8b2906e519154b0327f.zip |
LoongArch: Replace -ffreestanding with finer-grained -fno-builtin's
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 (!).
However, due to the desire for better control over unaligned accesses
with respect to CONFIG_ARCH_STRICT_ALIGN, and also for avoiding the
GCC bug https://gcc.gnu.org/PR109465, we do want to still disable
optimizations for the memory libcalls (memcpy, memmove and memset for
now). Use finer-grained -fno-builtin-* toggles to achieve this without
losing source fortification and other libcall optimizations.
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>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to '')
-rw-r--r-- | arch/loongarch/Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index b1e5db51b61c..ef87bab46754 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -83,8 +83,8 @@ 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) +cflags-y += -fno-builtin-memcpy -fno-builtin-memmove -fno-builtin-memset load-y = 0x9000000000200000 bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) |