diff --git a/libs/libc/assert/Make.defs b/libs/libc/assert/Make.defs index 87017b57c14..4b236fd02ab 100644 --- a/libs/libc/assert/Make.defs +++ b/libs/libc/assert/Make.defs @@ -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 diff --git a/mm/kasan/Make.defs b/mm/kasan/Make.defs index e8e464da5a6..a629b48e3bb 100644 --- a/mm/kasan/Make.defs +++ b/mm/kasan/Make.defs @@ -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