walnux/arch/xtensa/src/lx6/Toolchain.defs
Xiang Xiao 2c3020ddaf arch/Toolchain.defs: Replace --print-file-name=libgcc.a with --print-libgcc-file-name
to more compatable with clang: https://reviews.llvm.org/D25338

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 09:46:04 +01:00

90 lines
2.6 KiB
Text

############################################################################
# arch/xtensa/src/lx6/Toolchain.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
# Supported toolchains
#
# Each toolchain definition should set:
#
# CROSSDEV The GNU toolchain triple (command prefix)
# ARCHCPUFLAGS CPU-specific flags selecting the instruction set
# FPU options, etc.
# MAXOPTIMIZATION The maximum optimization level that results in
# reliable code generation.
#
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CROSSDEV = xt-
endif
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCLANG), y)
CROSSDEV = xt-
endif
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_ESP), y)
CROSSDEV = xtensa-esp32-elf-
endif
ARCHCPUFLAGS =
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Default toolchain
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CC = $(CROSSDEV)xcc
CXX = $(CROSSDEV)xc++
CPP = $(CROSSDEV)xcc -E -P -x c
else ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCLANG), y)
CC = $(CROSSDEV)clang
CXX = $(CROSSDEV)clang++
CPP = $(CROSSDEV)clang -E -P -x c
else
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E -P -x c
endif
LD = $(CROSSDEV)ld
STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library
EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}
endif
ifeq ($(CONFIG_LIBSUPCXX),y)
EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}
endif