From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/2] Add CONFIG_READABLE_ASM
Date: Wed, 28 Mar 2012 11:51:18 -0700 [thread overview]
Message-ID: <1332960678-11879-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1332960678-11879-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Add a config option to disable various gcc compiler optimizations that
make assembler listings much harder to read. This is everything that reorders
code significantly or creates partial functions.
This is mainly to keep kernel hackers sane.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
Makefile | 10 ++++++++++
lib/Kconfig.debug | 9 +++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 1932984..6f7328b 100644
--- a/Makefile
+++ b/Makefile
@@ -564,6 +564,16 @@ else
KBUILD_CFLAGS += -O2
endif
+ifdef CONFIG_READABLE_ASM
+# Disable optimizations that make assembler listings hard to read.
+# reorder blocks reorders the control in the function
+# ipa clone creates specialized cloned functions
+# partial inlining inlines only parts of functions
+KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
+ $(call cc-option,-fno-ipa-cp-clone,) \
+ $(call cc-option,-fno-partial-inlining)
+endif
+
include $(srctree)/arch/$(SRCARCH)/Makefile
ifneq ($(CONFIG_FRAME_WARN),0)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f7af95d..d6102f3 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -70,6 +70,15 @@ config STRIP_ASM_SYMS
that look like '.Lxxx') so they don't pollute the output of
get_wchan() and suchlike.
+config READABLE_ASM
+ bool "Generate readable assembler code"
+ depends on DEBUG_KERNEL
+ help
+ Disable some compiler optimizations that tend to generate human unreadable
+ assembler output. This may make the kernel slightly slower, but it helps
+ to keep kernel developers who have to stare a lot at assembler listings
+ sane.
+
config UNUSED_SYMBOLS
bool "Enable unused/obsolete exported symbols"
default y if X86
--
1.7.7.6
next prev parent reply other threads:[~2012-03-28 18:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 18:51 [PATCH 1/2] x86: Use -mno-avx when available Andi Kleen
2012-03-28 18:51 ` Andi Kleen [this message]
2012-03-30 17:41 ` [tip:x86/cleanups] debug: Add CONFIG_READABLE_ASM tip-bot for Andi Kleen
2012-04-12 19:08 ` [PATCH 2/2] " Geert Uytterhoeven
2012-04-12 19:36 ` H. Peter Anvin
2012-04-12 19:42 ` Geert Uytterhoeven
2012-04-12 19:40 ` Sam Ravnborg
2012-04-12 19:47 ` Geert Uytterhoeven
2012-04-12 19:52 ` Sam Ravnborg
2012-04-12 19:57 ` Andi Kleen
2012-04-12 20:07 ` Sam Ravnborg
2012-04-12 20:17 ` Geert Uytterhoeven
2012-04-12 20:35 ` Sam Ravnborg
2012-05-08 19:36 ` Geert Uytterhoeven
2012-05-12 20:23 ` Geert Uytterhoeven
2012-05-12 20:25 ` Sam Ravnborg
2012-03-30 17:16 ` [tip:x86/urgent] x86: Use -mno-avx when available tip-bot for Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332960678-11879-2-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.