Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752447AbcCRQp1 (ORCPT ); Fri, 18 Mar 2016 12:45:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52503 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbcCRQpY (ORCPT ); Fri, 18 Mar 2016 12:45:24 -0400 Date: Fri, 18 Mar 2016 13:45:22 -0300 From: Arnaldo Carvalho de Melo To: Josh Poimboeuf Cc: Lucas Stach , Jiri Olsa , linux-kernel@vger.kernel.org, kernel@pengutronix.de, patchwork-lst@pengutronix.de, Wang Nan , acme@kernel.org Subject: Re: [PATCH] tools lib api: respect CROSS_COMPILE for the linker Message-ID: <20160318164522.GB2701@redhat.com> References: <1458235670-27341-1-git-send-email-l.stach@pengutronix.de> <20160318162547.GA2701@redhat.com> <20160318163815.qe7f7cwzis4riwnj@treble.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160318163815.qe7f7cwzis4riwnj@treble.redhat.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 18 Mar 2016 16:45:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2151 Lines: 66 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 > > > --- > > > 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