Browse Source

add some debug related optimization

Waldemar Brodkorb 10 years ago
parent
commit
acb6713155
4 changed files with 24 additions and 21 deletions
  1. 3 0
      mk/package.mk
  2. 11 10
      mk/vars.mk
  3. 2 1
      package/libthread_db/Makefile
  4. 8 10
      target/config/Config.in.toolchain

+ 3 - 0
mk/package.mk

@@ -90,6 +90,7 @@ build-all-pkgs: ${_IPKGS_COOKIE}
 #     noremove -> do not remove files from $(STAGING_TARGET_DIR) while
 #                 cleaning (needed for toolchain packages like glibc)
 #     nostaging -> do not install files to $(STAGING_TARGET_DIR)
+#     nostrip -> do not strip files
 #     dev -> create a development subpackage with headers and pkg-config files
 #     devonly -> create a development package only
 # should be package format independent and modular in the future
@@ -192,12 +193,14 @@ ifneq (,$(filter dev,$(7)))
 endif
 
 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $${_FAKE_COOKIE}
+ifeq (,$(filter nostrip,$(7)))
 ifeq ($(ADK_DEBUG),)
 	@$${RSTRIP} $${IDIR_$(1)} $(MAKE_TRACE)
 endif
 ifeq ($(ADK_DEBUG_STRIP),y)
 	@$${RSTRIP} $${IDIR_$(1)} $(MAKE_TRACE)
 endif
+endif
 ifeq (${ADK_LEAVE_ETC_ALONE}$(filter force_etc,$(7)),y)
 	-rm -rf $${IDIR_$(1)}/etc
 else

+ 11 - 10
mk/vars.mk

@@ -153,14 +153,18 @@ TARGET_CFLAGS+=		-mlongcalls -mtext-section-literals
 TARGET_CXXFLAGS+=	-mlongcalls -mtext-section-literals
 endif
 
+# add configured cflags for optimization
+TARGET_CFLAGS+=		$(ADK_TARGET_CFLAGS_OPT)
+TARGET_CXXFLAGS+=	$(ADK_TARGET_CFLAGS_OPT)
+# always add debug information
+TARGET_CFLAGS+=		-g3
+TARGET_CXXFLAGS+=	-g3
+
 ifneq ($(ADK_DEBUG),)
-ifeq ($(ADK_DEBUG_OPTS),y)
-TARGET_CFLAGS+=		-g3 -fno-omit-frame-pointer $(ADK_TARGET_CFLAGS_OPT)
-TARGET_CXXFLAGS+=	-g3 -fno-omit-frame-pointer $(ADK_TARGET_CFLAGS_OPT)
-else
-TARGET_CFLAGS+=		-O0 -g3 -fno-omit-frame-pointer
-TARGET_CXXFLAGS+=	-O0 -g3 -fno-omit-frame-pointer
-endif
+TARGET_CFLAGS+=		-fno-omit-frame-pointer
+TARGET_CXXFLAGS+=	-fno-omit-frame-pointer
+TARGET_CFLAGS+=		-funwind-tables -fasynchronous-unwind-tables
+TARGET_CXXFLAGS+=	-funwind-tables -fasynchronous-unwind-tables
 else
 TARGET_CPPFLAGS+=	-DNDEBUG
 TARGET_CFLAGS+=		-fomit-frame-pointer $(ADK_TARGET_CFLAGS_OPT)
@@ -168,9 +172,6 @@ TARGET_CXXFLAGS+=	-fomit-frame-pointer $(ADK_TARGET_CFLAGS_OPT)
 # stop generating eh_frame stuff
 TARGET_CFLAGS+=		-fno-unwind-tables -fno-asynchronous-unwind-tables
 TARGET_CXXFLAGS+=	-fno-unwind-tables -fno-asynchronous-unwind-tables
-# always add debug information
-TARGET_CFLAGS+=		-g3
-TARGET_CXXFLAGS+=	-g3
 endif
 
 ifeq ($(ADK_LINUX_ARM),y)

+ 2 - 1
package/libthread_db/Makefile

@@ -19,6 +19,7 @@ endif
 PKG_NAME:=		libthread-db
 PKG_DESCR:=		posix threads library for gdb/gdbserver
 PKG_SECTION:=		libs/misc
+PKG_OPTS:=		nostrip
 
 PKG_CFLINE_LIBTHREAD_DB:=depends on ADK_PACKAGE_GDB || ADK_PACKAGE_GDBSERVER
 
@@ -26,7 +27,7 @@ NO_DISTFILES:=		1
 
 include ${ADK_TOPDIR}/mk/package.mk
 
-$(eval $(call PKG_template,LIBTHREAD_DB,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+$(eval $(call PKG_template,LIBTHREAD_DB,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
 CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual

+ 8 - 10
target/config/Config.in.toolchain

@@ -105,25 +105,23 @@ config ADK_TARGET_USE_GNU_HASHSTYLE
 	  dependencies. See http://www.akkadia.org/drepper/dsohowto.pdf
 
 config ADK_DEBUG
-	bool "Compile applications with debug support by default"
+	bool "Compile applications with debug support and do not strip"
 	default n
 	help
-	  All packages and libc will be compiled and packaged with debug information.
+	  All software for the target will be compiled with:
+	  -fno-omit-frame-pointer
+	  -funwind-tables
+	  -fasynchronous-unwind-tables  
+	  Software will not be stripped.
 	  Mostly useful for NFS root or big USB/CF or hard disk setups.
 
-config ADK_DEBUG_OPTS
-	bool "use optimization cflags"
-	depends on ADK_DEBUG
-	default n
-	help
-	  All packages and C library will be compiled with debug information and optimization flags on.
-
 config ADK_DEBUG_STRIP
 	bool "strip target binaries/libraries for gdbserver usage"
 	depends on ADK_DEBUG
 	default n
 	help
-	  All packages and C library will be compiled with debug information, but stripped for the target.
+	  All packages and C library will be compiled with debug information, 
+	  but stripped for the target.
 
 config ADK_TARGET_USE_STATIC_LIBS
 	bool "Link applications statically by default"