Browse Source

add option for special CFLAGS/CXXFLAGS

Do not disable exception handling and unwinding options by default, as this
breaks exception handling in C++ applications using libstdc++.

Reported-by: Tom Deblauwe
Waldemar Brodkorb 5 years ago
parent
commit
c0c6ccec78
2 changed files with 14 additions and 2 deletions
  1. 7 2
      mk/vars.mk
  2. 7 0
      target/config/Config.in.toolchain

+ 7 - 2
mk/vars.mk

@@ -283,14 +283,19 @@ else
 TARGET_CPPFLAGS+=	-DNDEBUG
 TARGET_CFLAGS+=		-fomit-frame-pointer
 TARGET_CXXFLAGS+=	-fomit-frame-pointer
-# stop generating eh_frame stuff
+endif
+
+# stop generating eh_frame stuff, do not use it for C++
+ifeq ($(ADK_TARGET_CFLAGS_DISABLE_EH),y)
 TARGET_CFLAGS+=		-fno-unwind-tables -fno-asynchronous-unwind-tables
 TARGET_CXXFLAGS+=	-fno-unwind-tables -fno-asynchronous-unwind-tables
+endif
+
+# workaround gcc bug for m68k/coldfire
 ifeq ($(ADK_TARGET_CPU_CF),y)
 TARGET_CFLAGS+=		-fno-dwarf2-cfi-asm
 TARGET_CXXFLAGS+=	-fno-dwarf2-cfi-asm
 endif
-endif
 
 ifeq ($(ADK_TARGET_ARCH_ARM),y)
 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_NEON),y)

+ 7 - 0
target/config/Config.in.toolchain

@@ -32,6 +32,13 @@ config ADK_TARGET_CFLAGS_OPT_O0
 
 endchoice
 
+config ADK_TARGET_CFLAGS_DISABLE_EH
+	bool "Disable exception handling and unwindung via compiler flags"
+	depends on !ADK_DEBUG
+	help
+	  Do not use this optimization flags if you are planning to use C++
+	  applications, which are often using exception handling.
+
 menu "Compiler language support"
 config ADK_TOOLCHAIN_WITH_CXX
 	bool "enable C++"