From 23c3360eeb4bd0b5610058dee5faa32cd662c12c Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Thu, 5 May 2022 20:32:51 +0800 Subject: [PATCH] arm/cortex-m/toolchain: try print runtime library only in clang fix compile warning: make: arm-nuttx-elf-gcc: Command not found Signed-off-by: chao.an --- arch/arm/src/armv6-m/Toolchain.defs | 10 ++++++---- arch/arm/src/armv7-m/Toolchain.defs | 10 ++++++---- arch/arm/src/armv8-m/Toolchain.defs | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/armv6-m/Toolchain.defs b/arch/arm/src/armv6-m/Toolchain.defs index bb184aac86192..04f9fe33a0c2c 100644 --- a/arch/arm/src/armv6-m/Toolchain.defs +++ b/arch/arm/src/armv6-m/Toolchain.defs @@ -185,10 +185,12 @@ endif # Add the builtin library COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name) -ifeq ($(wildcard $(COMPILER_RT_LIB)),) - # if "--print-libgcc-file-name" unable to find the correct libgcc PATH - # then go ahead and try "--print-file-name" - COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) +ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),CLANG) + ifeq ($(wildcard $(COMPILER_RT_LIB)),) + # if "--print-libgcc-file-name" unable to find the correct libgcc PATH + # then go ahead and try "--print-file-name" + COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) + endif endif EXTRA_LIBS += $(COMPILER_RT_LIB) diff --git a/arch/arm/src/armv7-m/Toolchain.defs b/arch/arm/src/armv7-m/Toolchain.defs index 680f208de2941..2c4289f99cb7d 100644 --- a/arch/arm/src/armv7-m/Toolchain.defs +++ b/arch/arm/src/armv7-m/Toolchain.defs @@ -257,10 +257,12 @@ endif # Add the builtin library COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name) -ifeq ($(wildcard $(COMPILER_RT_LIB)),) - # if "--print-libgcc-file-name" unable to find the correct libgcc PATH - # then go ahead and try "--print-file-name" - COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) +ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CLANG) + ifeq ($(wildcard $(COMPILER_RT_LIB)),) + # if "--print-libgcc-file-name" unable to find the correct libgcc PATH + # then go ahead and try "--print-file-name" + COMPILER_RT_LIB := -$(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) + endif endif EXTRA_LIBS += $(COMPILER_RT_LIB) diff --git a/arch/arm/src/armv8-m/Toolchain.defs b/arch/arm/src/armv8-m/Toolchain.defs index 1302e676e2899..ee6bf7d86aa97 100644 --- a/arch/arm/src/armv8-m/Toolchain.defs +++ b/arch/arm/src/armv8-m/Toolchain.defs @@ -266,10 +266,12 @@ endif # Add the builtin library COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name) -ifeq ($(wildcard $(COMPILER_RT_LIB)),) - # if "--print-libgcc-file-name" unable to find the correct libgcc PATH - # then go ahead and try "--print-file-name" - COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) +ifeq ($(CONFIG_ARMV8M_TOOLCHAIN),CLANG) + ifeq ($(wildcard $(COMPILER_RT_LIB)),) + # if "--print-libgcc-file-name" unable to find the correct libgcc PATH + # then go ahead and try "--print-file-name" + COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB)))) + endif endif EXTRA_LIBS += $(COMPILER_RT_LIB)