toolchain/lto: enable lto flags only on GNU toolchain

Some commercial customized toolchains do not support these options

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-02-18 13:44:26 +08:00 committed by Xiang Xiao
parent b871783889
commit 39a0e6fa74
2 changed files with 11 additions and 5 deletions

View file

@ -24,9 +24,11 @@ ifeq ($(CONFIG_STACK_CANARIES),y)
CSRCS += lib_stackchk.c
endif
ifeq ($(CONFIG_LTO_NONE),n)
assert/lib_assert.c_CFLAGS += -fno-lto
assert/lib_stackchk.c_CFLAGS += -fno-lto
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
ifeq ($(CONFIG_LTO_NONE),n)
assert/lib_assert.c_CFLAGS += -fno-lto
assert/lib_stackchk.c_CFLAGS += -fno-lto
endif
endif
# Add the assert directory to the build

View file

@ -24,8 +24,12 @@ CSRCS += kasan.c
# Disable kernel-address in mm subsystem
CFLAGS += -fno-sanitize=kernel-address
CFLAGS += -fno-lto
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CFLAGS += -fno-sanitize=kernel-address
ifeq ($(CONFIG_LTO_NONE),n)
CFLAGS += -fno-lto
endif
endif
# Add the core heap directory to the build