All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Feiner <pfeiner@google.com>,
	drjones@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests] build: don't reevaluate cc-option shell command
Date: Mon, 14 Mar 2016 15:03:44 +0100	[thread overview]
Message-ID: <56E6C4C0.2060106@redhat.com> (raw)
In-Reply-To: <b8c291828d51f4bebdabbf9679a278533846820a.1457742064.git.pfeiner@google.com>



On 12/03/2016 01:21, Peter Feiner wrote:
> Make was reevaluating the shell commands in CFLAGS for every recipe
> because CFLAGS was defined as a recursively-expanded variable. Doing a
> simple expansion before putting the command output in CFLAGS prevents
> this reevaluation.
> 
> The difference this change makes for the x86 build is stark:
> 
> BEFORE:
> 	make -j  6.17s user 5.74s system 167% cpu 7.117 total
> 	make  6.52s user 5.70s system 89% cpu 13.664 total
> 
> AFTER:
> 	make -j  4.03s user 1.47s system 1036% cpu 0.530 total
> 	make  3.69s user 2.16s system 92% cpu 6.310 total
> 
> Signed-off-by: Peter Feiner <pfeiner@google.com>
> ---
>  Makefile | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 09999c6..2a2d942 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -42,9 +42,13 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
>  
>  CFLAGS += -g
>  CFLAGS += $(autodepend-flags) -Wall -Werror
> -CFLAGS += $(call cc-option, -fomit-frame-pointer, "")
> -CFLAGS += $(call cc-option, -fno-stack-protector, "")
> -CFLAGS += $(call cc-option, -fno-stack-protector-all, "")
> +
> +fomit_frame_pointer := $(call cc-option, -fomit-frame-pointer, "")
> +fnostack_protector := $(call cc-option, -fno-stack-protector, "")
> +fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "")
> +CFLAGS += $(fomit_frame_pointer)
> +CFLAGS += $(fno_stack_protector)
> +CFLAGS += $(fno_stack_protector_all)
>  
>  CXXFLAGS += $(CFLAGS)
>  
> 

Thanks, looks good.

Paolo

      reply	other threads:[~2016-03-14 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12  0:21 [PATCH kvm-unit-tests] build: don't reevaluate cc-option shell command Peter Feiner
2016-03-14 14:03 ` Paolo Bonzini [this message]

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=56E6C4C0.2060106@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pfeiner@google.com \
    /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.