[uClibc]DODEBUG vs. OPTIMIZE

Miles Bader miles at lsi.nec.co.jp
Fri Dec 21 08:29:19 UTC 2001


I notice that the DODEBUG configuration option has been changed so that
when it's true, the contents of the OPTIMIZATION configuration option
are no longer added to CFLAGS when compiling, so that `debugging' builds
are no longer optimized at all.

I beleive this is a bad change, because it reduces flexibility, and adds
no functionality.

Previously, it was quite easy to make an optimized build with debugging
information, by doing:

  DODEBUG = true

and also to make a _non_-optimized build with debugging information, by
doing:

  DODEBUG = true
  OPTIMIZATION = 

However, under the new scheme, the former is no longer possible (only
the latter).  This is especially harmful because (at least when using
gcc) optimization and debugging are quite compatible, and it's very
useful to built things with debugging information even when not actively
debugging.  Gcc produces _very_ poor code when optimization is turned
off, so it's rarely desirable to turn it off.

Here's a patch to revert this change; please apply it:


Index: Rules.mak
===================================================================
RCS file: /var/cvs/uClibc/Rules.mak,v
retrieving revision 1.54
diff -u -r1.54 Rules.mak
--- Rules.mak	2001/11/26 11:37:52	1.54
+++ Rules.mak	2001/12/21 08:14:18
@@ -47,7 +47,7 @@
 
 ARFLAGS=r
 
-CCFLAGS=$(WARNINGS) -fno-builtin -nostdinc $(CPUFLAGS) -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D_LIBC
+CCFLAGS=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D_LIBC
 TARGET_CCFLAGS=--uclibc-use-build-dir $(WARNINGS) $(CPUFLAGS)
 CFLAGS=$(ARCH_CFLAGS) $(CCFLAGS) $(DEFS) $(ARCH_CFLAGS2)
 TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
@@ -60,8 +60,8 @@
     TARGET_LDFLAGS = --uclibc-use-build-dir -Wl,-warn-common
     STRIPTOOL = /bin/true -Since_we_are_debugging
 else
-    CFLAGS  += $(OPTIMIZATION) -DNDEBUG #-fomit-frame-pointer
-    TARGET_CFLAGS += $(OPTIMIZATION) -DNDEBUG #-fomit-frame-pointer
+    CFLAGS  += -DNDEBUG #-fomit-frame-pointer
+    TARGET_CFLAGS += -DNDEBUG #-fomit-frame-pointer
     LDFLAGS  = -s -nostdlib -Wl,-warn-common
     TARGET_LDFLAGS = --uclibc-use-build-dir -s -Wl,-warn-common
 endif


Thanks,

-miles
-- 
Love is a snowmobile racing across the tundra.  Suddenly it flips over,
pinning you underneath.  At night the ice weasels come.  --Nietzsche




More information about the uClibc mailing list