[PATCH 05/15] debug: Add CONFIG_DEBUG_READABLE_ASM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on linux v3.3 patch: 1873e870fd63ee4b87dbe0125ca373e420fb4987

    debug: Add CONFIG_READABLE_ASM

    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@xxxxxxxxxxxxxxx>
    Link: http://lkml.kernel.org/r/1332960678-11879-2-git-send-email-andi@xxxxxxxxxxxxxx
    Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxx>

Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
 Makefile       | 11 +++++++++++
 common/Kconfig |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git a/Makefile b/Makefile
index cddff1267972..ee6c8fc82d5a 100644
--- a/Makefile
+++ b/Makefile
@@ -478,6 +478,17 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 # disable pointer signed / unsigned warnings in gcc 4.0
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
+ifdef CONFIG_DEBUG_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
+CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
+          $(call cc-option,-fno-ipa-cp-clone,) \
+          $(call cc-option,-fno-partial-inlining)
+endif
+
+
 # KBUILD_IMAGE: Default barebox image to build
 # Depending on the architecture, this can be either compressed or not.
 # It will also include any necessary headers to be bootable.
diff --git a/common/Kconfig b/common/Kconfig
index 2ad92158c145..c97beea81513 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1228,6 +1228,14 @@ config DEBUG_INITCALLS
 	help
 	  If enabled this will print initcall traces.
 
+config DEBUG_READABLE_ASM
+        bool "Generate readable assembler code"
+        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.
+
 endmenu
 
 config HAS_DEBUG_LL
-- 
2.19.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux