Add gcc specific linker flag only when building for gcc.
The additional linker flag for fatal-warnings should not be used whe cross compiling with armclang, or on MacOS. Fixes #43885 #42049 #44181 #43887 #43865
This commit is contained in:
parent
fbcdf129b9
commit
e4828fe68d
tensorflow/lite/micro
@ -22,7 +22,7 @@ Required parameters:
|
||||
|
||||
Optional parameters:
|
||||
|
||||
- TOOLCHAIN: armgcc (default) or armmclang
|
||||
- TOOLCHAIN: gcc (default) or armmclang
|
||||
- For Cortex-M55, ARM Compiler 6.14 or later is required.
|
||||
|
||||
Some examples:
|
||||
|
@ -37,6 +37,7 @@ TARGET := $(HOST_OS)
|
||||
TARGET_ARCH := $(HOST_ARCH)
|
||||
|
||||
# Default compiler and tool names:
|
||||
TOOLCHAIN:=gcc
|
||||
CXX_TOOL := g++
|
||||
CC_TOOL := gcc
|
||||
AR_TOOL := ar
|
||||
@ -123,16 +124,20 @@ CXXFLAGS := \
|
||||
-fno-threadsafe-statics \
|
||||
$(COMMON_FLAGS)
|
||||
|
||||
CCFLAGS := \
|
||||
-std=c11 \
|
||||
$(COMMON_FLAGS)
|
||||
CCFLAGS := \
|
||||
-std=c11 \
|
||||
$(COMMON_FLAGS)
|
||||
|
||||
ARFLAGS := -r
|
||||
|
||||
ifeq ($(filter armclang,$(ALL_TAGS)),)
|
||||
LDFLAGS += \
|
||||
-Wl,--fatal-warnings \
|
||||
-Wl,--gc-sections
|
||||
ifeq ($(TOOLCHAIN), gcc)
|
||||
ifneq ($(TARGET), osx)
|
||||
# GCC on MacOS uses an LLVM backend so we avoid the additional linker flags
|
||||
# that are unsupported with LLVM.
|
||||
LDFLAGS += \
|
||||
-Wl,--fatal-warnings \
|
||||
-Wl,--gc-sections
|
||||
endif
|
||||
endif
|
||||
|
||||
# override these in the makefile.inc for specific compiler targets
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Generic Makefile target for ARM Cortex M builds.
|
||||
# For more info see: tensorflow/lite/micro/cortex_m_generic/README.md
|
||||
|
||||
TOOLCHAIN:=armgcc
|
||||
FLOAT := soft
|
||||
GCC_TARGET_ARCH := $(TARGET_ARCH)
|
||||
|
||||
@ -64,7 +63,7 @@ else
|
||||
endif
|
||||
|
||||
ifneq ($(filter cortex-m55%,$(TARGET_ARCH)),)
|
||||
ifeq ($(TOOLCHAIN), armgcc)
|
||||
ifeq ($(TOOLCHAIN), gcc)
|
||||
$(error "Micro architecure support is not available for arm-gcc for TARGET_ARCH=$(TARGET_ARCH)")
|
||||
endif
|
||||
|
||||
@ -97,7 +96,7 @@ ifeq ($(TOOLCHAIN), armclang)
|
||||
# https://developer.arm.com/documentation/100891/0611/troubleshooting/general-troubleshooting-advice
|
||||
MICROLITE_LIBS := $(filter-out -lm,$(MICROLITE_LIBS))
|
||||
|
||||
else ifeq ($(TOOLCHAIN), armgcc)
|
||||
else ifeq ($(TOOLCHAIN), gcc)
|
||||
export PATH := $(MAKEFILE_DIR)/downloads/gcc_embedded/bin/:$(PATH)
|
||||
$(eval $(call add_third_party_download,$(GCC_EMBEDDED_URL),$(GCC_EMBEDDED_MD5),gcc_embedded,))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user