563125fde3
This pr will avoid targets with the same name can not be archive in the same library Signed-off-by: chao an <anchao@xiaomi.com>
180 lines
5.0 KiB
Plaintext
180 lines
5.0 KiB
Plaintext
############################################################################
|
|
# arch/arm64/src/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.
|
|
# ARCHOPTIMIZATION The optimization level that results in
|
|
# reliable code generation.
|
|
#
|
|
|
|
ifeq ($(CONFIG_ARCH_ARMV8A),y)
|
|
ARCHCPUFLAGS += -march=armv8-a
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_ARMV8R),y)
|
|
ARCHCPUFLAGS += -march=armv8-r
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_CORTEX_A53),y)
|
|
ARCHCPUFLAGS += -mtune=cortex-a53
|
|
else ifeq ($(CONFIG_ARCH_CORTEX_A57),y)
|
|
ARCHCPUFLAGS += -mtune=cortex-a57
|
|
else ifeq ($(CONFIG_ARCH_CORTEX_A72),y)
|
|
ARCHCPUFLAGS += -mtune=cortex-a72
|
|
else ifeq ($(CONFIG_ARCH_CORTEX_R82),y)
|
|
ARCHCPUFLAGS += -mtune=cortex-r82
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
|
ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
|
|
else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
|
|
ARCHOPTIMIZATION += -Os
|
|
endif
|
|
|
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
|
ARCHOPTIMIZATION += -fno-strict-aliasing
|
|
endif
|
|
|
|
ifeq ($(CONFIG_FRAME_POINTER),y)
|
|
ARCHOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
else
|
|
ARCHOPTIMIZATION += -fomit-frame-pointer
|
|
endif
|
|
|
|
ifeq ($(CONFIG_STACK_CANARIES),y)
|
|
ARCHOPTIMIZATION += -fstack-protector-all
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
endif
|
|
|
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
|
endif
|
|
|
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
|
ARCHOPTIMIZATION += -fsanitize-undefined-trap-on-error
|
|
endif
|
|
|
|
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
|
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
|
ARCHCXXFLAGS += -D_LDBL_EQ_DBL
|
|
ARCHCFLAGS += -D_LDBL_EQ_DBL
|
|
endif
|
|
|
|
ARCHCFLAGS += -fno-common
|
|
ARCHCXXFLAGS += -fno-common -nostdinc++
|
|
|
|
ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Werror -Wno-attributes -Wno-unknown-pragmas
|
|
ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas
|
|
|
|
# When all C++ code is built using GCC 7.1 or a higher version,
|
|
# we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1."
|
|
# Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m
|
|
|
|
ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
|
|
ARCHCFLAGS += -Wno-psabi
|
|
ARCHCXXFLAGS += -Wno-psabi
|
|
endif
|
|
|
|
ifneq ($(CONFIG_CXX_STANDARD),)
|
|
ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD)
|
|
endif
|
|
|
|
ifneq ($(CONFIG_CXX_EXCEPTION),y)
|
|
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
|
|
endif
|
|
|
|
ifneq ($(CONFIG_CXX_RTTI),y)
|
|
ARCHCXXFLAGS += -fno-rtti
|
|
endif
|
|
|
|
LDFLAGS += -nostdlib
|
|
|
|
# Optimization of unused sections
|
|
|
|
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
|
|
LDFLAGS += --gc-sections
|
|
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
|
|
endif
|
|
|
|
# Debug link map
|
|
|
|
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
|
|
LDFLAGS += --cref -Map=$(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx.map)
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
|
ARCHOPTIMIZATION += -g
|
|
endif
|
|
|
|
CROSSDEV ?= aarch64-none-elf-
|
|
|
|
# Default toolchain
|
|
|
|
CC = $(CROSSDEV)gcc
|
|
CXX = $(CROSSDEV)g++
|
|
CPP = $(CROSSDEV)gcc -E -P -x c
|
|
STRIP = $(CROSSDEV)strip --strip-unneeded
|
|
OBJCOPY = $(CROSSDEV)objcopy
|
|
OBJDUMP = $(CROSSDEV)objdump
|
|
LD = $(CROSSDEV)ld
|
|
AR = $(CROSSDEV)ar rcsP
|
|
NM = $(CROSSDEV)nm
|
|
|
|
# Link Time Optimization
|
|
|
|
ifeq ($(CONFIG_LTO_FULL),y)
|
|
ARCHOPTIMIZATION += -flto
|
|
ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
|
|
LD := $(CROSSDEV)gcc
|
|
AR := $(CROSSDEV)gcc-ar rcsP
|
|
NM := $(CROSSDEV)gcc-nm
|
|
ARCHOPTIMIZATION += -fuse-linker-plugin
|
|
ARCHOPTIMIZATION += -fno-builtin
|
|
endif
|
|
endif
|
|
|
|
# Add the builtin library
|
|
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name))
|
|
|
|
ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
|
|
endif
|
|
|
|
ifeq ($(CONFIG_LIBSUPCXX),y)
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
|
endif
|
|
|
|
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
|
endif
|