Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572156 > unrolled thread

[PATCH 3/4] tools lib feature: Do not redefine compiler configuration

Started byDavid Carrillo-Cisneros <davidcc@google.com>
First post2017-02-02 07:40 +0100
Last post2017-02-06 16:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/4] tools lib feature: Do not redefine compiler configuration David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 07:40 +0100
    Re: [PATCH 3/4] tools lib feature: Do not redefine compiler  configuration Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-06 14:40 +0100
      Re: [PATCH 3/4] tools lib feature: Do not redefine compiler  configuration Jiri Olsa <jolsa@redhat.com> - 2017-02-06 16:50 +0100

#1572156 — [PATCH 3/4] tools lib feature: Do not redefine compiler configuration

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-02 07:40 +0100
Subject[PATCH 3/4] tools lib feature: Do not redefine compiler configuration
Message-ID<t6jdL-fC-5@gated-at.bofh.it>
Feature detection redefines CC, CCX and PKG_CONFIG, making the
output of feature detection inconsistent with the actual features
available during compilation when the above variables are used.

Fix it by using conditional assignment.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/build/feature/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 3dd2c600d250..d39e76f3a063 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -52,9 +52,9 @@ FILES=                                          \
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
-CC := $(CROSS_COMPILE)gcc -MD
-CXX := $(CROSS_COMPILE)g++ -MD
-PKG_CONFIG := $(CROSS_COMPILE)pkg-config
+CC ?= $(CROSS_COMPILE)gcc -MD
+CXX ?= $(CROSS_COMPILE)g++ -MD
+PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
 LLVM_CONFIG ?= llvm-config
 
 all: $(FILES)
-- 
2.11.0.483.g087da7b7c-goog

[toc] | [next] | [standalone]


#1574684 — Re: [PATCH 3/4] tools lib feature: Do not redefine compiler configuration

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-06 14:40 +0100
SubjectRe: [PATCH 3/4] tools lib feature: Do not redefine compiler configuration
Message-ID<t7RGq-5x6-17@gated-at.bofh.it>
In reply to#1572156
Em Wed, Feb 01, 2017 at 10:38:03PM -0800, David Carrillo-Cisneros escreveu:
> Feature detection redefines CC, CCX and PKG_CONFIG, making the
> output of feature detection inconsistent with the actual features
> available during compilation when the above variables are used.
> 
> Fix it by using conditional assignment.

This one is tricky, the real meaning of that line got lost somewhere,
its original intent, in commit 8b6eb56a9570 ("tools/perf/build: Add
'autodep' functionality, generate feature test dependencies
automatically") was to just add that "-MD" to whatever definition CC
had, be it the default one or a value set by the user in the make
command line.

At some point someone added that CROSS_COMPILE there, which it should
have gotten from the default CC definition

It was here: a8a5cd8b472c ("perf: tools: Fix cross building")

    perf: tools: Fix cross building
    
    Currently the feature-checks Makefile does not inherit $(CC), and calls
    cc rather than $(CROSS_COMPILE)gcc. Thus the feature checks invoke the
    native toolchain rather than the cross toolchain, and can identify
    features as available when they are not. This can break the build

----------------------------------

Mark, do you recall why can't we make tools/perf/Makefile.perf pass the
definitions of CC, AR and PKG_CONFIG to tools/perf/config/Makefile (now
tools/build/feature/Makefile) so that the original intent (adding -MD to
whatever was in CC) can be kept?

Jiri?

- Arnaldo
 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/build/feature/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 3dd2c600d250..d39e76f3a063 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -52,9 +52,9 @@ FILES=                                          \
>  
>  FILES := $(addprefix $(OUTPUT),$(FILES))
>  
> -CC := $(CROSS_COMPILE)gcc -MD
> -CXX := $(CROSS_COMPILE)g++ -MD
> -PKG_CONFIG := $(CROSS_COMPILE)pkg-config
> +CC ?= $(CROSS_COMPILE)gcc -MD
> +CXX ?= $(CROSS_COMPILE)g++ -MD
> +PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
>  LLVM_CONFIG ?= llvm-config
>  
>  all: $(FILES)
> -- 
> 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1574917 — Re: [PATCH 3/4] tools lib feature: Do not redefine compiler configuration

FromJiri Olsa <jolsa@redhat.com>
Date2017-02-06 16:50 +0100
SubjectRe: [PATCH 3/4] tools lib feature: Do not redefine compiler configuration
Message-ID<t7TIe-6NW-15@gated-at.bofh.it>
In reply to#1574684
On Mon, Feb 06, 2017 at 10:38:59AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Feb 01, 2017 at 10:38:03PM -0800, David Carrillo-Cisneros escreveu:
> > Feature detection redefines CC, CCX and PKG_CONFIG, making the
> > output of feature detection inconsistent with the actual features
> > available during compilation when the above variables are used.
> > 
> > Fix it by using conditional assignment.
> 
> This one is tricky, the real meaning of that line got lost somewhere,
> its original intent, in commit 8b6eb56a9570 ("tools/perf/build: Add
> 'autodep' functionality, generate feature test dependencies
> automatically") was to just add that "-MD" to whatever definition CC
> had, be it the default one or a value set by the user in the make
> command line.
> 
> At some point someone added that CROSS_COMPILE there, which it should
> have gotten from the default CC definition
> 
> It was here: a8a5cd8b472c ("perf: tools: Fix cross building")
> 
>     perf: tools: Fix cross building
>     
>     Currently the feature-checks Makefile does not inherit $(CC), and calls
>     cc rather than $(CROSS_COMPILE)gcc. Thus the feature checks invoke the
>     native toolchain rather than the cross toolchain, and can identify
>     features as available when they are not. This can break the build
> 
> ----------------------------------
> 
> Mark, do you recall why can't we make tools/perf/Makefile.perf pass the
> definitions of CC, AR and PKG_CONFIG to tools/perf/config/Makefile (now
> tools/build/feature/Makefile) so that the original intent (adding -MD to
> whatever was in CC) can be kept?
> 
> Jiri?

I guess we could remove -MD from the gcc like and add it to the CFLAGS
if we want to keep the CC/CXX lines alone..

jirka

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web