[PATCH 4/8] kgdb: COPTIMIZE flag

From: jason . wessel
Date: Sat Feb 09 2008 - 08:37:51 EST


From: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>

This patch adds in the ability to unoptimize a single kernel module to
make source stepping more linear and not optimize out variables that
the developer might like to inspect. It used with adding
COPTIMIZE=-O0 to the build line when doing something like a single
kernel module only build. Or you could use it to override the default
optimization level entirely.

Signed-off-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
Makefile | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 89f2d8b..65aa7f8 100644
--- a/Makefile
+++ b/Makefile
@@ -502,10 +502,14 @@ endif # $(dot-config)
all: vmlinux

ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+COPTIMIZE += -Os
else
-KBUILD_CFLAGS += -O2
+COPTIMIZE += -O2
endif
+# COPTIMIZE may be overridden on the make command line with
+# make ... COPTIMIZE=""
+# The resulting object may be easier to debug with KGDB
+KBUILD_CFLAGS += $(COPTIMIZE)

include $(srctree)/arch/$(SRCARCH)/Makefile

--
1.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/