xtensa|risc-v: Make CXX exception and RTTI depend on Kconfig options

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2022-03-24 18:14:38 -03:00 committed by Xiang Xiao
parent a0617177e8
commit 06d0a9f1ad
19 changed files with 71 additions and 38 deletions

View File

@ -59,6 +59,17 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
ARCHCFLAGS =
ARCHCXXFLAGS =
ifneq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Generic GNU RVG toolchain
ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)

View File

@ -41,7 +41,11 @@ ifeq ($(CONFIG_XTENSA_TOOLCHAIN_ESP), y)
CROSSDEV = xtensa-esp32-elf-
endif
ARCHCPUFLAGS =
ARCHCPUFLAGS = -mlongcalls
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
@ -55,8 +59,15 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHCFLAGS =
ARCHCXXFLAGS =
ifneq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Default toolchain

View File

@ -41,7 +41,11 @@ ifeq ($(CONFIG_XTENSA_TOOLCHAIN_ESP), y)
CROSSDEV = xtensa-$(CONFIG_ARCH_CHIP)-elf-
endif
ARCHCPUFLAGS =
ARCHCPUFLAGS = -mlongcalls
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
@ -55,8 +59,15 @@ else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
ifeq ($(CONFIG_MM_KASAN),y)
ARCHCPUFLAGS += -fsanitize=kernel-address
ARCHCFLAGS =
ARCHCXXFLAGS =
ifneq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Default toolchain

View File

@ -41,8 +41,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCPUFLAGS += -mno-relax
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -ffunction-sections -fdata-sections -fno-exceptions -fcheck-new -std=c++17 -pipe -nostdinc++
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17 -pipe
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

View File

@ -48,8 +48,8 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef

View File

@ -41,8 +41,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -msmall-data-limit=0
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections -msmall-data-limit=0
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -msmall-data-limit=0 -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -41,8 +41,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

View File

@ -38,8 +38,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCPUFLAGS += -mcmodel=medany -mstrict-align
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef

View File

@ -37,8 +37,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

View File

@ -63,8 +63,8 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef

View File

@ -48,8 +48,8 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef

View File

@ -40,8 +40,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base

View File

@ -53,8 +53,8 @@ ifeq ($(CONFIG_RV32M1_OPENISA_TOOLCHAIN),y)
endif
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -46,8 +46,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -36,8 +36,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce
endif
ARCHCFLAGS = -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls
ARCHCXXFLAGS = $(ARCHCFLAGS) -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic