Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line option to select -stdlib=libc++ with Xtensa. #47681

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion tensorflow/lite/micro/tools/make/targets/xtensa_makefile.inc
Expand Up @@ -9,6 +9,7 @@
# For example: hifimini

TARGET_ARCH :=
XTENSA_USE_LIBC :=

ifndef XTENSA_BASE
$(error XTENSA_BASE is undefined)
Expand Down Expand Up @@ -36,7 +37,6 @@ PLATFORM_FLAGS = \
-DTF_LITE_USE_CTIME \
--xtensa-core=$(XTENSA_CORE) \
-mcoproc \
-stdlib=libc++ \
-DMAX_RFFT_PWR=9 \
-DMIN_RFFT_PWR=MAX_RFFT_PWR \
$(TARGET_ARCH_DEFINES)
Expand All @@ -50,6 +50,21 @@ TARGET_TOOLCHAIN_PREFIX := xt-
CXX_TOOL := clang++
CC_TOOL := clang

# Unused exception related symbols make their way into a binary that links
# against TFLM as described in https://github.com/tensorflow/tensorflow/issues/47575.
# We have two options to avoid this. The first involves using -stdlib=libc++ and
# the second involves stubbing out and modifying some of the files in the Xtensa
# toolchain to prevent inclusion of the exception handling code
# (http://b/182209217#comment3). This Makefile supports building TFLM in a way
# that is compatible with either of the two approaches.
ifeq ($(XTENSA_USE_LIBC), true)
PLATFORM_FLAGS += -stdlib=libc++
else
# TODO(b/150240249): Do not filter-out -fno-rtti once that works for the
# Xtensa toolchain.
CXXFLAGS := $(filter-out -fno-rtti, $(CXXFLAGS))
endif

CXXFLAGS += $(PLATFORM_FLAGS)
CCFLAGS += $(PLATFORM_FLAGS)

Expand Down