On Thu, 5 Jun 2008, Cristian Ionescu-Idbohrn wrote:
> On Thu, 5 Jun 2008, Denys Vlasenko wrote:
>
> > On Tuesday 03 June 2008 22:06, Cristian Ionescu-Idbohrn wrote:
> > > When using gdb, one would expect to have the source compiled with
> > > '-g -O0', and not '-g -Os'.
> >
> > There were people who disagree (they say "debug what you ship").
> > I see only one way to leave BOTH camps happy. Create a CONFIG_DEBUG0
> > option (dependent on CONFIG_DEBUG) which forces -O0 build.
> > Otherwise, -Os would be used.
> >
> > Can you do this?
>
> I'll have a look at it.
Well, I found traces of this old controverse in topdir Config.in,
DEBUG_PESSIMIZE commented out, so I just revived that. Attached the
result. What do you think?
Cheers,
--
Cristian
--- busybox-svn/Makefile.flags (revision 22268)
+++ busybox-svn/Makefile.flags (working copy)
@@ -35,7 +35,7 @@
# gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
-CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
+CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
# -fno-guess-branch-probability: prohibit pseudo-random guessing
# of branch probabilities (hopefully makes bloatcheck more stable):
CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
@@ -46,9 +46,16 @@
# be fixed..
#CFLAGS+=$(call cc-option,-Wconversion,)
-ifeq ($(CONFIG_DEBUG),y)
-CFLAGS += $(call cc-option,-g)
+ifneq ($(CONFIG_DEBUG),y)
+CFLAGS += $(call cc-option,-Os,)
+else
+CFLAGS += $(call cc-option,-g,)
+ifeq ($(CONFIG_DEBUG_PESSIMIZE),y)
+CFLAGS += $(call cc-option,-O0,)
+else
+CFLAGS += $(call cc-option,-Os,)
endif
+endif
# If arch/$(ARCH)/Makefile did not override it (with, say, -fPIC)...
ARCH_FPIC ?= -fpic
--- busybox-svn/Config.in (revision 22216)
+++ busybox-svn/Config.in (working copy)
@@ -396,6 +396,17 @@
Most people should answer N.
+config DEBUG_PESSIMIZE
+ bool "Disable compiler optimizations."
+ default n
+ depends on DEBUG
+ help
+ The compiler's optimization of source code can eliminate and reorder
+ code, resulting in an executable that's hard to understand when
+ stepping through it with a debugger. This switches it off, resulting
+ in a much bigger executable that more closely matches the source
+ code.
+
config WERROR
bool "Abort compilation on any warning"
default n
@@ -404,18 +415,6 @@
Most people should answer N.
-# Seems to be unused
-#config DEBUG_PESSIMIZE
-# bool "Disable compiler optimizations."
-# default n
-# depends on DEBUG
-# help
-# The compiler's optimization of source code can eliminate and reorder
-# code, resulting in an executable that's hard to understand when
-# stepping through it with a debugger. This switches it off, resulting
-# in a much bigger executable that more closely matches the source
-# code.
-
choice
prompt "Additional debugging library"
default NO_DEBUG_LIB
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox