Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753420AbbGMUcj (ORCPT ); Mon, 13 Jul 2015 16:32:39 -0400 Received: from emh02.mail.saunalahti.fi ([62.142.5.108]:52649 "EHLO emh02.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752598AbbGMUch (ORCPT ); Mon, 13 Jul 2015 16:32:37 -0400 X-Greylist: delayed 499 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Jul 2015 16:32:36 EDT Date: Mon, 13 Jul 2015 23:24:06 +0300 From: Aaro Koskinen To: Alexey Brodkin Cc: linux-arch@vger.kernel.org, Vineet Gupta , Aaro Koskinen , Jiri Olsa , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Revert "perf tools: Allow to specify custom linker command" Message-ID: <20150713202406.GB5020@blackmetal.musicnaut.iki.fi> References: <1436785853-4260-1-git-send-email-abrodkin@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436785853-4260-1-git-send-email-abrodkin@synopsys.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1802 Lines: 45 Hi, On Mon, Jul 13, 2015 at 02:10:53PM +0300, Alexey Brodkin wrote: > This reverts commit 5ef7bbb09f7b > ("perf tools: Allow to specify custom linker command"). > > LD is a pre-defined variable in GNU Make. I.e. it is always defined. > Which means there's no point to check "LD ?= ..." because it will never > succeed. And so LD will be either that explicitly passed to make like > this: > ------->8------- > make LD=path_to_my_ld ... > ------->8------- > or default value, which is host's "ld". > > Latter leads to failure of cross-linkage because instead of cross linker > "$(CROSS_COMPILE)ld" host's "ld" is used. > > As for commit which is reverted here: > [1] Usually for selection of non-default flavour of CPU core/options > linker flags are used like "-mtune=xxx" or "-mMyCPUType" etc. > > [2] Still to implement ability to use "ld" that differs from > "$(CROSS_COMPILE)ld" one will need to add new makefile variable like > TARGET_LD and then check if $(TARGET_LD) is not specified on make > invocation then use "$(CROSS_COMPILE)ld". > > But for now to fix cross-building of perf this revert is enough. Hmm. You are probably right, my build system always exports LD with correct linker for cross builds so perhaps that's why I this "worked" for me when testing. Sorry. I guess the correct fix would be [1], i.e. there should be some new variable to pass flags to ld command. Or maybe [2], could we use make "origin" function? If LD is "default", then use "$(CROSS_COMPILE)ld", otherwise use what the user passed? A. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/