compile/flags: add FRAME_POINTER into Toolchain.defs

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-12-27 12:13:48 +08:00 committed by Xiang Xiao
parent 8eb999ff03
commit a42aa8415d
14 changed files with 77 additions and 3 deletions

View File

@ -1919,6 +1919,14 @@ config DEBUG_SYMBOLS
---help---
Build with debug symbols (needed for use with a debugger).
config FRAME_POINTER
bool "Compile the NuttX with frame pointers"
default n
---help---
If you say Y here the resulting NuttX image will be slightly
larger and slower, but it gives very useful debugging information
in case of bugs.
endmenu # Debug Options
config ARCH_HAVE_CUSTOMOPT

View File

@ -67,6 +67,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT)

View File

@ -61,6 +61,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),BUILDROOT)

View File

@ -79,6 +79,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
ifeq ($(CONFIG_ENDIAN_BIG),y)
TARGET_ARCH := armeb
else

View File

@ -75,6 +75,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Parametrization for ARCHCPUFLAGS
ifeq ($(CONFIG_ARCH_CORTEXM4),y)

View File

@ -61,6 +61,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
ifeq ($(CONFIG_ENDIAN_BIG),y)
TARGET_ARCH := armeb
else

View File

@ -75,6 +75,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Parametrization for ARCHCPUFLAGS
ifeq ($(CONFIG_ARCH_CORTEXM23),y)
TOOLCHAIN_MTUNE := -mtune=cortex-m23

View File

@ -43,7 +43,7 @@ ifeq ($(CONFIG_STACK_CANARIES),y)
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
ifneq ($(CONFIG_ARMV8M_STACKCHECK),y)
#ARCHOPTIMIZATION += -flto -fuse-linker-plugin

View File

@ -259,6 +259,12 @@ ifeq ($(CONFIG_MIPS32_TOOLCHAIN),PINGUINOW)
LDSCRIPT = mips-elf-debug.ld
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Default toolchain
CC = $(CROSSDEV)gcc

View File

@ -53,6 +53,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Generic GNU RVG toolchain
ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)

View File

@ -53,6 +53,12 @@ else
MAXOPTIMIZATION ?= -Os
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
MAXOPTIMIZATION += -fomit-frame-pointer
endif
# Generic GNU RVG toolchain
ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)

View File

@ -61,7 +61,7 @@ config SIM_CYGWIN_DECORATED
config SIM_ASAN
bool "Address Sanitizer"
default n
depends on MM_CUSTOMIZE_MANAGER
depends on MM_CUSTOMIZE_MANAGER && FRAME_POINTER
---help---
AddressSanitizer (ASan) is a fast compiler-based tool for detecting memory
bugs in native code.
@ -69,6 +69,7 @@ config SIM_ASAN
config SIM_UBSAN
bool "Undefined Behaviour Sanitizer"
default n
depends on FRAME_POINTER
---help---
Compile-time instrumentation is used to detect various undefined behaviours
at runtime.

View File

@ -49,6 +49,12 @@ 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

View File

@ -29,7 +29,6 @@
# reliable code generation.
#
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CROSSDEV = xt-
endif
@ -50,6 +49,12 @@ 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