All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools lib api: respect CROSS_COMPILE for the linker
@ 2016-03-17 17:27 Lucas Stach
  2016-03-18 16:25 ` Arnaldo Carvalho de Melo
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Lucas Stach @ 2016-03-17 17:27 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel, kernel, patchwork-lst

This fixes cross compilation of libapi.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 tools/lib/api/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index d85904dc9b38..9383bb866664 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -10,6 +10,7 @@ endif
 
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
+LD = $(CROSS_COMPILE)ld
 
 MAKEFLAGS += --no-print-directory
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-17 17:27 [PATCH] tools lib api: respect CROSS_COMPILE for the linker Lucas Stach
@ 2016-03-18 16:25 ` Arnaldo Carvalho de Melo
  2016-03-18 16:38   ` Josh Poimboeuf
  2016-06-01  9:18 ` Lucas Stach
  2016-06-08  8:37 ` [tip:perf/core] tools lib api: Respect " tip-bot for Lucas Stach
  2 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-18 16:25 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Jiri Olsa, linux-kernel, kernel, patchwork-lst, Josh Poimboeuf

Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> This fixes cross compilation of libapi.

Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
there are also other cases where LD is not being set with CROSS_COMPILE,
Jiri, is there something else at play here?

/me needs to cross compile all this code...

- Arnaldo
 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  tools/lib/api/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
> index d85904dc9b38..9383bb866664 100644
> --- a/tools/lib/api/Makefile
> +++ b/tools/lib/api/Makefile
> @@ -10,6 +10,7 @@ endif
>  
>  CC = $(CROSS_COMPILE)gcc
>  AR = $(CROSS_COMPILE)ar
> +LD = $(CROSS_COMPILE)ld
>  
>  MAKEFLAGS += --no-print-directory
>  
> -- 
> 2.7.0

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 16:25 ` Arnaldo Carvalho de Melo
@ 2016-03-18 16:38   ` Josh Poimboeuf
  2016-03-18 16:43     ` Josh Poimboeuf
  2016-03-18 16:45     ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 19+ messages in thread
From: Josh Poimboeuf @ 2016-03-18 16:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst

On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> > This fixes cross compilation of libapi.
> 
> Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
> there are also other cases where LD is not being set with CROSS_COMPILE,
> Jiri, is there something else at play here?
> 
> /me needs to cross compile all this code...

Yeah, I already fixed the libsubcmd issue with commit c1d45c3abd49 in
tip/core/objtool.  (Sorry, I probably should have CC'ed you and Jiri.)

> 
> - Arnaldo
>  
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  tools/lib/api/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
> > index d85904dc9b38..9383bb866664 100644
> > --- a/tools/lib/api/Makefile
> > +++ b/tools/lib/api/Makefile
> > @@ -10,6 +10,7 @@ endif
> >  
> >  CC = $(CROSS_COMPILE)gcc
> >  AR = $(CROSS_COMPILE)ar
> > +LD = $(CROSS_COMPILE)ld
> >  
> >  MAKEFLAGS += --no-print-directory
> >  
> > -- 
> > 2.7.0

-- 
Josh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 16:38   ` Josh Poimboeuf
@ 2016-03-18 16:43     ` Josh Poimboeuf
  2016-03-18 17:39       ` Arnaldo Carvalho de Melo
  2016-03-18 16:45     ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 19+ messages in thread
From: Josh Poimboeuf @ 2016-03-18 16:43 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst

On Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf wrote:
> On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> > > This fixes cross compilation of libapi.
> > 
> > Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
> > there are also other cases where LD is not being set with CROSS_COMPILE,
> > Jiri, is there something else at play here?
> > 
> > /me needs to cross compile all this code...
> 
> Yeah, I already fixed the libsubcmd issue with commit c1d45c3abd49 in
> tip/core/objtool.  (Sorry, I probably should have CC'ed you and Jiri.)

Hm, I wonder why the 0-day kbuild bot didn't catch this issue before,
since I know it does some cross-compiling.  Does it not build perf?

-- 
Josh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 16:38   ` Josh Poimboeuf
  2016-03-18 16:43     ` Josh Poimboeuf
@ 2016-03-18 16:45     ` Arnaldo Carvalho de Melo
  2016-03-18 17:16       ` Josh Poimboeuf
  1 sibling, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-18 16:45 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst,
	Wang Nan, acme

Em Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf escreveu:
> On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> > > This fixes cross compilation of libapi.
> > 
> > Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
> > there are also other cases where LD is not being set with CROSS_COMPILE,
> > Jiri, is there something else at play here?
> > 
> > /me needs to cross compile all this code...
> 
> Yeah, I already fixed the libsubcmd issue with commit c1d45c3abd49 in
> tip/core/objtool.  (Sorry, I probably should have CC'ed you and Jiri.)

Not a problem, it will all get merged eventually, but I noticed this:

-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
+CC ?= $(CROSS_COMPILE)gcc
+LD ?= $(CROSS_COMPILE)ld
+AR ?= $(CROSS_COMPILE)ar

This is how you fixed it, which is different from what other places do
for cross compiling, for instance, this is how tools/lib/bpf/Makefile
does (and it isn't setting LD as well):

# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,AR,$(CROSS_COMPILE)ar)

Which is different from what the kernel does in its main Makefile:

# Make variables (CC, etc...)
AS              = $(CROSS_COMPILE)as
LD              = $(CROSS_COMPILE)ld
CC              = $(CROSS_COMPILE)gcc

I wonder if we could settle in one of these styles or if there is really
a reason to be creative :-)

Better, all this could go to tools/scripts/Makefile.include?

- Arnaldo
 
> > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > > ---
> > >  tools/lib/api/Makefile | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
> > > index d85904dc9b38..9383bb866664 100644
> > > --- a/tools/lib/api/Makefile
> > > +++ b/tools/lib/api/Makefile
> > > @@ -10,6 +10,7 @@ endif
> > >  
> > >  CC = $(CROSS_COMPILE)gcc
> > >  AR = $(CROSS_COMPILE)ar
> > > +LD = $(CROSS_COMPILE)ld
> > >  
> > >  MAKEFLAGS += --no-print-directory
> > >  
> > > -- 
> > > 2.7.0
> 
> -- 
> Josh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 16:45     ` Arnaldo Carvalho de Melo
@ 2016-03-18 17:16       ` Josh Poimboeuf
  2016-03-18 17:38         ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 19+ messages in thread
From: Josh Poimboeuf @ 2016-03-18 17:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst,
	Wang Nan, acme

On Fri, Mar 18, 2016 at 01:45:22PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf escreveu:
> > On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> > > > This fixes cross compilation of libapi.
> > > 
> > > Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
> > > there are also other cases where LD is not being set with CROSS_COMPILE,
> > > Jiri, is there something else at play here?
> > > 
> > > /me needs to cross compile all this code...
> > 
> > Yeah, I already fixed the libsubcmd issue with commit c1d45c3abd49 in
> > tip/core/objtool.  (Sorry, I probably should have CC'ed you and Jiri.)
> 
> Not a problem, it will all get merged eventually, but I noticed this:
> 
> -CC = $(CROSS_COMPILE)gcc
> -AR = $(CROSS_COMPILE)ar
> +CC ?= $(CROSS_COMPILE)gcc
> +LD ?= $(CROSS_COMPILE)ld
> +AR ?= $(CROSS_COMPILE)ar
> 
> This is how you fixed it, which is different from what other places do
> for cross compiling, for instance, this is how tools/lib/bpf/Makefile
> does (and it isn't setting LD as well):
> 
> # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
> $(call allow-override,CC,$(CROSS_COMPILE)gcc)
> $(call allow-override,AR,$(CROSS_COMPILE)ar)
> 
> Which is different from what the kernel does in its main Makefile:
> 
> # Make variables (CC, etc...)
> AS              = $(CROSS_COMPILE)as
> LD              = $(CROSS_COMPILE)ld
> CC              = $(CROSS_COMPILE)gcc
> 
> I wonder if we could settle in one of these styles or if there is really
> a reason to be creative :-)
> 
> Better, all this could go to tools/scripts/Makefile.include?

Yeah, I agree that it would be good to come up with a common and
consistent approach tools-wide if possible.

The reason I used '?=' is because objtool needs to be built with the
host compiler, and the tools kbuild doesn't have hostprogs and HOSTCC.
So I and overrode the CC variable.  From tools/objtool/Makefile:

  # always use the host compiler
  CC = gcc
  LD = ld
  AR = ar

So the 'CC ?= $(CROSS_COMPILE)gcc' in tools/lib/subcmd/Makefile allows
the objtool Makefile to override the cross-compilation and use the host
compiler instead.

I _think_ 'allow-override' would also work, because the objtool Makefile
exports the CC/LD/AR variables to the environment before descending into
the subcmd directory.  And 'allow-override' seems to allow overriding
those variables if they were set in the environment.

So 'allow-override' would probably be a good option.

-- 
Josh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 17:16       ` Josh Poimboeuf
@ 2016-03-18 17:38         ` Arnaldo Carvalho de Melo
  2016-03-18 17:42           ` Josh Poimboeuf
  2016-03-21  8:08           ` Jiri Olsa
  0 siblings, 2 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-18 17:38 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst,
	Wang Nan, acme

Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
> On Fri, Mar 18, 2016 at 01:45:22PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf escreveu:
> > > On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > Which is different from what the kernel does in its main Makefile:

> > # Make variables (CC, etc...)
> > AS              = $(CROSS_COMPILE)as
> > LD              = $(CROSS_COMPILE)ld
> > CC              = $(CROSS_COMPILE)gcc

> > I wonder if we could settle in one of these styles or if there is really
> > a reason to be creative :-)

> > Better, all this could go to tools/scripts/Makefile.include?
 
> Yeah, I agree that it would be good to come up with a common and
> consistent approach tools-wide if possible.

<SNOP>
> So 'allow-override' would probably be a good option.

Humm, my preference is to make tools/ look like the kernel, and the
kernel doesn't use that allow-override thing, right? So perhaps add what
is missing to make it look exactly like the kernel and then ditch this
allow-override thing?

What about having all this in a single place in tools/script/?

- Arnaldo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 16:43     ` Josh Poimboeuf
@ 2016-03-18 17:39       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-18 17:39 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst, acme

Em Fri, Mar 18, 2016 at 11:43:39AM -0500, Josh Poimboeuf escreveu:
> On Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf wrote:
> > On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Mar 17, 2016 at 06:27:50PM +0100, Lucas Stach escreveu:
> > > > This fixes cross compilation of libapi.
> > > 
> > > Humm, I guess that tools/lib/subcmd/Makefile has the same problem? And
> > > there are also other cases where LD is not being set with CROSS_COMPILE,
> > > Jiri, is there something else at play here?
> > > 
> > > /me needs to cross compile all this code...
> > 
> > Yeah, I already fixed the libsubcmd issue with commit c1d45c3abd49 in
> > tip/core/objtool.  (Sorry, I probably should have CC'ed you and Jiri.)
> 
> Hm, I wonder why the 0-day kbuild bot didn't catch this issue before,
> since I know it does some cross-compiling.  Does it not build perf?

Unfortunately I don't think so, IIRC there was some discussion, with
Jiri perhaps, about having it building perf, but I don't know how that
ended up.

- Arnaldo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 17:38         ` Arnaldo Carvalho de Melo
@ 2016-03-18 17:42           ` Josh Poimboeuf
  2016-03-21  8:08           ` Jiri Olsa
  1 sibling, 0 replies; 19+ messages in thread
From: Josh Poimboeuf @ 2016-03-18 17:42 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Lucas Stach, Jiri Olsa, linux-kernel, kernel, patchwork-lst,
	Wang Nan, acme

On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
> > On Fri, Mar 18, 2016 at 01:45:22PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf escreveu:
> > > > On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Which is different from what the kernel does in its main Makefile:
> 
> > > # Make variables (CC, etc...)
> > > AS              = $(CROSS_COMPILE)as
> > > LD              = $(CROSS_COMPILE)ld
> > > CC              = $(CROSS_COMPILE)gcc
> 
> > > I wonder if we could settle in one of these styles or if there is really
> > > a reason to be creative :-)
> 
> > > Better, all this could go to tools/scripts/Makefile.include?
>  
> > Yeah, I agree that it would be good to come up with a common and
> > consistent approach tools-wide if possible.
> 
> <SNOP>
> > So 'allow-override' would probably be a good option.
> 
> Humm, my preference is to make tools/ look like the kernel, and the
> kernel doesn't use that allow-override thing, right? So perhaps add what
> is missing to make it look exactly like the kernel and then ditch this
> allow-override thing?

To achieve that I think the 'hostprogs' stuff would also need to be
ported over.  Not sure how much work that would be.

> What about having all this in a single place in tools/script/?

Having it in a single place sounds good to me.

-- 
Josh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-18 17:38         ` Arnaldo Carvalho de Melo
  2016-03-18 17:42           ` Josh Poimboeuf
@ 2016-03-21  8:08           ` Jiri Olsa
  2016-03-21 20:40             ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2016-03-21  8:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan, acme

On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
> > On Fri, Mar 18, 2016 at 01:45:22PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Fri, Mar 18, 2016 at 11:38:15AM -0500, Josh Poimboeuf escreveu:
> > > > On Fri, Mar 18, 2016 at 01:25:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Which is different from what the kernel does in its main Makefile:
> 
> > > # Make variables (CC, etc...)
> > > AS              = $(CROSS_COMPILE)as
> > > LD              = $(CROSS_COMPILE)ld
> > > CC              = $(CROSS_COMPILE)gcc
> 
> > > I wonder if we could settle in one of these styles or if there is really
> > > a reason to be creative :-)
> 
> > > Better, all this could go to tools/scripts/Makefile.include?
>  
> > Yeah, I agree that it would be good to come up with a common and
> > consistent approach tools-wide if possible.
> 
> <SNOP>
> > So 'allow-override' would probably be a good option.
> 
> Humm, my preference is to make tools/ look like the kernel, and the
> kernel doesn't use that allow-override thing, right? So perhaps add what
> is missing to make it look exactly like the kernel and then ditch this
> allow-override thing?

Steven explained his reason for allow-override in the comment above it,
please make sure the new solution follows that

> 
> What about having all this in a single place in tools/script/?

maybe tools/script/Makefile.comp

jirka

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-21  8:08           ` Jiri Olsa
@ 2016-03-21 20:40             ` Arnaldo Carvalho de Melo
  2016-03-22  7:10               ` Jiri Olsa
  0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-21 20:40 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan, acme

Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu:
> On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
> > > So 'allow-override' would probably be a good option.

> > Humm, my preference is to make tools/ look like the kernel, and the
> > kernel doesn't use that allow-override thing, right? So perhaps add what
> > is missing to make it look exactly like the kernel and then ditch this
> > allow-override thing?

> Steven explained his reason for allow-override in the comment above it,
> please make sure the new solution follows that

Sure, and I'm no make guru, but what puzzles me is why isn't this
required in:

[acme@jouet linux]$ grep -w ^CC Makefile 
CC		= $(CROSS_COMPILE)gcc
[acme@jouet linux]$

> > What about having all this in a single place in tools/script/?
> 
> maybe tools/script/Makefile.comp

But then we would have to include multiple files in each Makefile,
perhaps it would be better to stash this in
tools/scripts/Makefile.include, that way we wouldn't have to include
any new file.

- Arnaldo

P.S.

While looking at the main kernel Makefile git history I found goodies we
could use in tools/, like:

commit 84336466011c589b6af554f2f2f1fcfa1a5c1437
Author: Roland McGrath <roland@redhat.com>
Date:   Mon Dec 21 16:24:06 2009 -0800

    kconfig CROSS_COMPILE option

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


And also by trying hard to mimic (preferrably use a exact copy) the kernel we
can avoid suffering from subtle stuff like:

commit 2331d1a6cd3d6e580bc88b9a160066d9e1177fe1
Author: Sam Ravnborg <sam@ravnborg.org>
Date:   Sun Oct 11 23:22:58 2009 +0200

    kbuild: revert "save ARCH & CROSS_COMPILE ..."

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-21 20:40             ` Arnaldo Carvalho de Melo
@ 2016-03-22  7:10               ` Jiri Olsa
  2016-03-22 12:50                 ` Steven Rostedt
  0 siblings, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2016-03-22  7:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan, acme, Steven Rostedt

On Mon, Mar 21, 2016 at 05:40:30PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu:
> > On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
> > > > So 'allow-override' would probably be a good option.
> 
> > > Humm, my preference is to make tools/ look like the kernel, and the
> > > kernel doesn't use that allow-override thing, right? So perhaps add what
> > > is missing to make it look exactly like the kernel and then ditch this
> > > allow-override thing?
> 
> > Steven explained his reason for allow-override in the comment above it,
> > please make sure the new solution follows that
> 
> Sure, and I'm no make guru, but what puzzles me is why isn't this
> required in:
> 
> [acme@jouet linux]$ grep -w ^CC Makefile 
> CC		= $(CROSS_COMPILE)gcc
> [acme@jouet linux]$

Steve has special requirements I guess ;-) CC-ed

> 
> > > What about having all this in a single place in tools/script/?
> > 
> > maybe tools/script/Makefile.comp
> 
> But then we would have to include multiple files in each Makefile,
> perhaps it would be better to stash this in
> tools/scripts/Makefile.include, that way we wouldn't have to include
> any new file.

sure, np

jirka

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-22  7:10               ` Jiri Olsa
@ 2016-03-22 12:50                 ` Steven Rostedt
  2016-03-22 14:42                   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 19+ messages in thread
From: Steven Rostedt @ 2016-03-22 12:50 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Josh Poimboeuf, Lucas Stach, Jiri Olsa,
	linux-kernel, kernel, patchwork-lst, Wang Nan, acme, David Sharp

On Tue, 22 Mar 2016 08:10:10 +0100
Jiri Olsa <jolsa@redhat.com> wrote:

> On Mon, Mar 21, 2016 at 05:40:30PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu:  
> > > On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:  
> > > > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:  
> > > > > So 'allow-override' would probably be a good option.  
> >   
> > > > Humm, my preference is to make tools/ look like the kernel, and the
> > > > kernel doesn't use that allow-override thing, right? So perhaps add what
> > > > is missing to make it look exactly like the kernel and then ditch this
> > > > allow-override thing?  
> >   
> > > Steven explained his reason for allow-override in the comment above it,
> > > please make sure the new solution follows that  
> > 
> > Sure, and I'm no make guru, but what puzzles me is why isn't this
> > required in:
> > 
> > [acme@jouet linux]$ grep -w ^CC Makefile 
> > CC		= $(CROSS_COMPILE)gcc
> > [acme@jouet linux]$  
> 
> Steve has special requirements I guess ;-) CC-ed
> 

I just copied what I had in trace-cmd. David Sharp is the one that
added that code.

 Link: http://lkml.kernel.org/r/1299791491-1805-1-git-send-email-dhsharp@google.com

-- Steve

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-22 12:50                 ` Steven Rostedt
@ 2016-03-22 14:42                   ` Arnaldo Carvalho de Melo
  2016-03-22 18:22                     ` David Sharp
  0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-22 14:42 UTC (permalink / raw)
  To: David Sharp
  Cc: Steven Rostedt, Jiri Olsa, Arnaldo Carvalho de Melo,
	Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan

Em Tue, Mar 22, 2016 at 08:50:42AM -0400, Steven Rostedt escreveu:
> On Tue, 22 Mar 2016 08:10:10 +0100
> Jiri Olsa <jolsa@redhat.com> wrote:
> 
> > On Mon, Mar 21, 2016 at 05:40:30PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu:  
> > > > On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:  
> > > > > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:  
> > > > > > So 'allow-override' would probably be a good option.  
> > >   
> > > > > Humm, my preference is to make tools/ look like the kernel, and the
> > > > > kernel doesn't use that allow-override thing, right? So perhaps add what
> > > > > is missing to make it look exactly like the kernel and then ditch this
> > > > > allow-override thing?  
> > >   
> > > > Steven explained his reason for allow-override in the comment above it,
> > > > please make sure the new solution follows that  
> > > 
> > > Sure, and I'm no make guru, but what puzzles me is why isn't this
> > > required in:
> > > 
> > > [acme@jouet linux]$ grep -w ^CC Makefile 
> > > CC		= $(CROSS_COMPILE)gcc
> > > [acme@jouet linux]$  
> > 
> > Steve has special requirements I guess ;-) CC-ed
> > 
> 
> I just copied what I had in trace-cmd. David Sharp is the one that
> added that code.
> 
>  Link: http://lkml.kernel.org/r/1299791491-1805-1-git-send-email-dhsharp@google.com

David, so, what was the usecase for that? Something we can try to
reproduce so that we can check if the kernel solution covers your
specific case?

- Arnaldo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-22 14:42                   ` Arnaldo Carvalho de Melo
@ 2016-03-22 18:22                     ` David Sharp
  2016-03-22 18:38                       ` David Sharp
  0 siblings, 1 reply; 19+ messages in thread
From: David Sharp @ 2016-03-22 18:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Steven Rostedt, Jiri Olsa, Arnaldo Carvalho de Melo,
	Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan

On Tue, Mar 22, 2016 at 7:42 AM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Tue, Mar 22, 2016 at 08:50:42AM -0400, Steven Rostedt escreveu:
>> On Tue, 22 Mar 2016 08:10:10 +0100
>> Jiri Olsa <jolsa@redhat.com> wrote:
>>
>> > On Mon, Mar 21, 2016 at 05:40:30PM -0300, Arnaldo Carvalho de Melo wrote:
>> > > Em Mon, Mar 21, 2016 at 09:08:52AM +0100, Jiri Olsa escreveu:
>> > > > On Fri, Mar 18, 2016 at 02:38:52PM -0300, Arnaldo Carvalho de Melo wrote:
>> > > > > Em Fri, Mar 18, 2016 at 12:16:23PM -0500, Josh Poimboeuf escreveu:
>> > > > > > So 'allow-override' would probably be a good option.
>> > >
>> > > > > Humm, my preference is to make tools/ look like the kernel, and the
>> > > > > kernel doesn't use that allow-override thing, right? So perhaps add what
>> > > > > is missing to make it look exactly like the kernel and then ditch this
>> > > > > allow-override thing?
>> > >
>> > > > Steven explained his reason for allow-override in the comment above it,
>> > > > please make sure the new solution follows that
>> > >
>> > > Sure, and I'm no make guru, but what puzzles me is why isn't this
>> > > required in:
>> > >
>> > > [acme@jouet linux]$ grep -w ^CC Makefile
>> > > CC                = $(CROSS_COMPILE)gcc

This works, but doesn't allow setting CC from env since it is
unconditionally overwritten here.

>> > > [acme@jouet linux]$
>> >
>> > Steve has special requirements I guess ;-) CC-ed
>> >
>>
>> I just copied what I had in trace-cmd. David Sharp is the one that
>> added that code.
>>
>>  Link: http://lkml.kernel.org/r/1299791491-1805-1-git-send-email-dhsharp@google.com
>
> David, so, what was the usecase for that? Something we can try to
> reproduce so that we can check if the kernel solution covers your
> specific case?
>
> - Arnaldo

It was a very long time ago, so I don't fully remember my specific
requirements at the time.

However, I'm sure I was wanting to set just "CROSS_COMPILE" from the
environment rather than all of CC, LD, AS, AR, etc, while still
allowing the flexibility to set CC, etc from the environment.

If you have just:

CC ?= $(CROSS_COMPILE)gcc

well, that line will never have any effect (not even the value of
"gcc"), because CC is already set by default by make itself (to "cc").

Demo (gmail won't let me paste tabs, so you'll have to fix the tabs in
the "all" rule):

"""
$ cat Makefile
define allow-override
  $(if $(or $(findstring environment,$(origin $(1))),\
            $(findstring command line,$(origin $(1)))),,\
    $(eval $(1) = $(2)))
endef

CC ?= $(CROSS_COMPILE)gcc
$(call allow-override,cross_CC,$(CROSS_COMPILE)gcc)

all:
        @echo "CC: $(CC)"
        @echo "cross_CC: $(cross_CC)"
$ make -f Makefile
CC: cc
cross_CC: gcc
$ CC=other-gcc cross_CC=other-gcc make -f Makefile
CC: other-gcc
cross_CC: other-gcc
$ CROSS_COMPILE=cross- make -f Makefile
CC: cc
cross_CC: cross-gcc
"""

So, note that without allow-override:
- The set default of "gcc" is not respected.
- Setting CC from the env does work.
- Setting CROSS_COMPILE from the env is not effective.

Hence the title of the patch and macro: "Makefiles suck". ;)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-22 18:22                     ` David Sharp
@ 2016-03-22 18:38                       ` David Sharp
  0 siblings, 0 replies; 19+ messages in thread
From: David Sharp @ 2016-03-22 18:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Steven Rostedt, Jiri Olsa, Arnaldo Carvalho de Melo,
	Josh Poimboeuf, Lucas Stach, Jiri Olsa, linux-kernel, kernel,
	patchwork-lst, Wang Nan

BTW: s/env/command line/ is true as well, i.e. running: `make
CROSS_COMPILE=cross-`

On Tue, Mar 22, 2016 at 11:22 AM, David Sharp <dhsharp@google.com> wrote:
> So, note that without allow-override:
> - The set default of "gcc" is not respected.
> - Setting CC from the env does work.
> - Setting CROSS_COMPILE from the env is not effective.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-03-17 17:27 [PATCH] tools lib api: respect CROSS_COMPILE for the linker Lucas Stach
  2016-03-18 16:25 ` Arnaldo Carvalho de Melo
@ 2016-06-01  9:18 ` Lucas Stach
  2016-06-01 13:07   ` Arnaldo Carvalho de Melo
  2016-06-08  8:37 ` [tip:perf/core] tools lib api: Respect " tip-bot for Lucas Stach
  2 siblings, 1 reply; 19+ messages in thread
From: Lucas Stach @ 2016-06-01  9:18 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: kernel, linux-kernel, Jiri Olsa, patchwork-lst

Am Donnerstag, den 17.03.2016, 18:27 +0100 schrieb Lucas Stach:
> This fixes cross compilation of libapi.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

There has been a fair amount of discussion going on in reply to this
patch, most of which had more general nature and didn't really discuss
the content of this patch.

Unfortunately it hasn't been applied, leaving the current mainline
unable to cross compile libapi. Can we please apply this patch to fix
this?

Thanks,
Lucas

> ---
>  tools/lib/api/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
> index d85904dc9b38..9383bb866664 100644
> --- a/tools/lib/api/Makefile
> +++ b/tools/lib/api/Makefile
> @@ -10,6 +10,7 @@ endif
>  
>  CC = $(CROSS_COMPILE)gcc
>  AR = $(CROSS_COMPILE)ar
> +LD = $(CROSS_COMPILE)ld
>  
>  MAKEFLAGS += --no-print-directory
>  

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker
  2016-06-01  9:18 ` Lucas Stach
@ 2016-06-01 13:07   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-06-01 13:07 UTC (permalink / raw)
  To: Lucas Stach
  Cc: kernel, linux-kernel, Jiri Olsa, patchwork-lst, David Sharp,
	Steven Rostedt

Em Wed, Jun 01, 2016 at 11:18:13AM +0200, Lucas Stach escreveu:
> Am Donnerstag, den 17.03.2016, 18:27 +0100 schrieb Lucas Stach:
> > This fixes cross compilation of libapi.
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> 
> There has been a fair amount of discussion going on in reply to this
> patch, most of which had more general nature and didn't really discuss
> the content of this patch.
> 
> Unfortunately it hasn't been applied, leaving the current mainline
> unable to cross compile libapi. Can we please apply this patch to fix
> this?

I just completely lost track of this, sorry, will try to read it
again...

- Arnaldo

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [tip:perf/core] tools lib api: Respect CROSS_COMPILE for the linker
  2016-03-17 17:27 [PATCH] tools lib api: respect CROSS_COMPILE for the linker Lucas Stach
  2016-03-18 16:25 ` Arnaldo Carvalho de Melo
  2016-06-01  9:18 ` Lucas Stach
@ 2016-06-08  8:37 ` tip-bot for Lucas Stach
  2 siblings, 0 replies; 19+ messages in thread
From: tip-bot for Lucas Stach @ 2016-06-08  8:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, l.stach, jolsa, hpa, tglx, linux-kernel, mingo

Commit-ID:  703e01652d25edbd249e3043c26543157f0ef15c
Gitweb:     http://git.kernel.org/tip/703e01652d25edbd249e3043c26543157f0ef15c
Author:     Lucas Stach <l.stach@pengutronix.de>
AuthorDate: Thu, 17 Mar 2016 18:27:50 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 3 Jun 2016 14:53:46 -0300

tools lib api: Respect CROSS_COMPILE for the linker

This fixes cross compilation of libapi.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: kernel@pengutronix.de
Cc: patchwork-lst@pengutronix.de
Link: http://lkml.kernel.org/r/1458235670-27341-1-git-send-email-l.stach@pengutronix.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 316f308..67ff93e 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -10,6 +10,7 @@ endif
 
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
+LD = $(CROSS_COMPILE)ld
 
 MAKEFLAGS += --no-print-directory
 

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-06-08  8:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-17 17:27 [PATCH] tools lib api: respect CROSS_COMPILE for the linker Lucas Stach
2016-03-18 16:25 ` Arnaldo Carvalho de Melo
2016-03-18 16:38   ` Josh Poimboeuf
2016-03-18 16:43     ` Josh Poimboeuf
2016-03-18 17:39       ` Arnaldo Carvalho de Melo
2016-03-18 16:45     ` Arnaldo Carvalho de Melo
2016-03-18 17:16       ` Josh Poimboeuf
2016-03-18 17:38         ` Arnaldo Carvalho de Melo
2016-03-18 17:42           ` Josh Poimboeuf
2016-03-21  8:08           ` Jiri Olsa
2016-03-21 20:40             ` Arnaldo Carvalho de Melo
2016-03-22  7:10               ` Jiri Olsa
2016-03-22 12:50                 ` Steven Rostedt
2016-03-22 14:42                   ` Arnaldo Carvalho de Melo
2016-03-22 18:22                     ` David Sharp
2016-03-22 18:38                       ` David Sharp
2016-06-01  9:18 ` Lucas Stach
2016-06-01 13:07   ` Arnaldo Carvalho de Melo
2016-06-08  8:37 ` [tip:perf/core] tools lib api: Respect " tip-bot for Lucas Stach

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.