From: Borislav Petkov <bp@alien8.de>
To: linux-kbuild@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>,
LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>
Subject: [PATCH] Kbuild: Check for CONFIG_READABLE_ASM when building .s targets
Date: Sun, 5 Oct 2014 17:32:34 +0200 [thread overview]
Message-ID: <1412523154-25602-1-git-send-email-bp@alien8.de> (raw)
From: Borislav Petkov <bp@suse.de>
We do need to look at the asm output of c files for various reasons. In
order to do so, we do make <path-to-filename>.s.
However, it can happen that the Kconfig option which enables the
creation of readable asm CONFIG_READABLE_ASM is disabled. What is more,
we want this option enabled because it indirectly enables the issue of
line numbers in the asm done by gcc's switch -g.
So issue a warning that the asm output might not be optimally readable
if that option is disabled.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
Makefile | 2 +-
scripts/Makefile.build | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index e43244263306..d9b505360c2a 100644
--- a/Makefile
+++ b/Makefile
@@ -1513,7 +1513,7 @@ else
endif
%.s: %.c prepare scripts FORCE
- $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+ $(Q)$(MAKE) $(build)=$(build-dir) asm_target=$@ $(target-dir)$(notdir $@)
%.i: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.o: %.c prepare scripts FORCE
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index bf3e6778cd71..8aaf1c04fe18 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -147,7 +147,12 @@ $(multi-objs-y:.o=.s) : modname = $(modname-multi)
$(multi-objs-y:.o=.lst) : modname = $(modname-multi)
quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
-cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
+cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< \
+ $(if $(findstring $(asm_target),$@),\
+ $(if $(__cmd_cc_s_c_once),,\
+ $(if $(CONFIG_READABLE_ASM),,\
+ $(warning Enable CONFIG_READABLE_ASM for more helpful asm); \
+ $(eval __cmd_cc_s_c_once=1)))) \
$(obj)/%.s: $(src)/%.c FORCE
$(call if_changed_dep,cc_s_c)
--
2.0.0
next reply other threads:[~2014-10-05 15:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-05 15:32 Borislav Petkov [this message]
2014-10-05 15:58 ` [PATCH] Kbuild: Check for CONFIG_READABLE_ASM when building .s targets Borislav Petkov
2014-10-07 12:13 ` Michal Marek
2014-10-07 12:27 ` Borislav Petkov
2014-10-07 13:45 ` Michal Marek
2014-10-07 14:11 ` Borislav Petkov
2014-10-23 19:24 ` Borislav Petkov
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=1412523154-25602-1-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox