diff --git a/arch/Kconfig b/arch/Kconfig index 522a5efae2f..58410eaa585 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -288,6 +288,7 @@ config ARCH_TOOLCHAIN_TASKING config ARCH_TOOLCHAIN_GHS bool + select ARCH_TOOLCHAIN_GNU default n config ARCH_GNU_NO_WEAKFUNCTIONS diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index 647ee14f606..cc937853ef2 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -366,8 +366,10 @@ ZIGFLAGS = -target $(ZARCH)-freestanding-$(ZEABI) $(ZARCHCPUFLAGS) ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),) ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y) - LDFLAGS += --gc-sections - ARCHOPTIMIZATION += -ffunction-sections -fdata-sections + ifeq ($(CONFIG_ARCH_TOOLCHAIN_GHS),) + LDFLAGS += --gc-sections + ARCHOPTIMIZATION += -ffunction-sections -fdata-sections + endif endif endif