From patchwork Sun Oct 5 15:58:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 5033981 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 567DD9F295 for ; Sun, 5 Oct 2014 15:58:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A157201D3 for ; Sun, 5 Oct 2014 15:58:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F0EB201C8 for ; Sun, 5 Oct 2014 15:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbaJEP6Y (ORCPT ); Sun, 5 Oct 2014 11:58:24 -0400 Received: from mail.skyhub.de ([78.46.96.112]:38105 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751555AbaJEP6X (ORCPT ); Sun, 5 Oct 2014 11:58:23 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1412524700; bh=EETxmX3mHz1h2oFMXr+hJZpeAe9R80Jqo/Mp/Kcx6TI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=tmo/qfiJvXXOSG3jMVOpdhfGrV1SF0tqXToUWb yXuM0OfOJeHN7fook4ioFBdMh9qnWt6gcJXVH5ijmXGz6Foqmyhne9Fl/TkuiL/tv/l 30ktPZZ+TBHsrWw1S1kqasysHd4l2Xw5uKGvZNpZVLRrTEI8rbeIwE7aNJNVLFxD10= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LYUGpKrn0nss; Sun, 5 Oct 2014 17:58:20 +0200 (CEST) Received: from liondog.tnic (p5DDC4E49.dip0.t-ipconnect.de [93.220.78.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B1AD61D9895; Sun, 5 Oct 2014 17:58:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1412524700; bh=EETxmX3mHz1h2oFMXr+hJZpeAe9R80Jqo/Mp/Kcx6TI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=tmo/qfiJvXXOSG3jMVOpdhfGrV1SF0tqXToUWb yXuM0OfOJeHN7fook4ioFBdMh9qnWt6gcJXVH5ijmXGz6Foqmyhne9Fl/TkuiL/tv/l 30ktPZZ+TBHsrWw1S1kqasysHd4l2Xw5uKGvZNpZVLRrTEI8rbeIwE7aNJNVLFxD10= Received: by liondog.tnic (Postfix, from userid 1000) id 82E531002DA; Sun, 5 Oct 2014 17:58:16 +0200 (CEST) Date: Sun, 5 Oct 2014 17:58:16 +0200 From: Borislav Petkov To: linux-kbuild@vger.kernel.org Cc: Michal Marek , LKML , X86 ML Subject: Re: [PATCH] Kbuild: Check for CONFIG_READABLE_ASM when building .s targets Message-ID: <20141005155816.GB9377@pd.tnic> References: <1412523154-25602-1-git-send-email-bp@alien8.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1412523154-25602-1-git-send-email-bp@alien8.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sun, Oct 05, 2014 at 05:32:34PM +0200, Borislav Petkov wrote: > From: Borislav Petkov > > We do need to look at the asm output of c files for various reasons. In > order to do so, we do make .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 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 .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 --- 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)