[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141005155816.GB9377@pd.tnic>
Date: Sun, 5 Oct 2014 17:58:16 +0200
From: Borislav Petkov <bp@...en8.de>
To: linux-kbuild@...r.kernel.org
Cc: Michal Marek <mmarek@...e.cz>, LKML <linux-kernel@...r.kernel.org>,
X86 ML <x86@...nel.org>
Subject: Re: [PATCH] Kbuild: Check for CONFIG_READABLE_ASM when building .s
targets
On Sun, Oct 05, 2014 at 05:32:34PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.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.
Not really: so this is enabled by CONFIG_DEBUG_INFO and there are two
options: we make CONFIG_READABLE_ASM depend on it which makes people
answer a couple more questions or we simply add it to the command
building the .s file.
I say we do the second thing:
--
From: Borislav Petkov <bp@...e.de>
Subject: [PATCH -v1.1] Kbuild: Check for CONFIG_READABLE_ASM when building .s targets
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.
So issue a warning that the asm output might not be optimally readable
if that option is disabled.
Additionally, add the -g switch to the .s build command so that gcc
issues line numbers too.
Signed-off-by: Borislav Petkov <bp@...e.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..d55651d39638 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 -g -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
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists