From patchwork Thu Jul 28 12:23:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 653699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s0WGp51DPz9t1F for ; Thu, 28 Jul 2016 22:23:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=tuEjSfIm; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s0WGp3v5tzDrPZ for ; Thu, 28 Jul 2016 22:23:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=tuEjSfIm; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-qk0-x243.google.com (mail-qk0-x243.google.com [IPv6:2607:f8b0:400d:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s0WGg5sQSzDrP2 for ; Thu, 28 Jul 2016 22:23:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=tuEjSfIm; dkim-atps=neutral Received: by mail-qk0-x243.google.com with SMTP id p126so4731500qke.1 for ; Thu, 28 Jul 2016 05:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ej6aQNoh+Q3Azm8fciujyKCyd4tMbtGLnO34AYiyVlQ=; b=tuEjSfIm6SVxwOvUzTBqaH9rmgLXYkStHQ7ZV/FeGm4GKgqfaBJTSl/yi6b93NptSn fYZmabo4aH6EcRa85/NqHugG+IVVwH3qibeGBZNbL4H1kUmmD5LGOJkj7dKD9IWdzUSj 5C131yfxFJlvWCRL4DbDhCLjGB6N4fB1E08QFiVLRNVFrb9hr+8duAYvxVRWKm2FAcro tNlRnCvIHjJ80MeaLDzlfwmi1TbRo+fx/Tjwu1LW319FKr62HYVrC7K5qPV+zzQaIEmP GKYK4rsleaQBIpdIyZ5TPBMKtUqPt15mewqe9WILrWzY/rfIMMLAszgHh0CGXJLKnndx lNUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ej6aQNoh+Q3Azm8fciujyKCyd4tMbtGLnO34AYiyVlQ=; b=NIcFqbVzphCx135Ycu5+4r4czJEFomdJNLwAM8t7Ojma86DBCQi8yKD95P/z+sAK27 6dIUOs50Jnf6ZCyMAnUVJkF9wxy3jvcjtrp4V1J/HUi7k9KFHoR3Nn4J/AI+DOZNH8tp 3EqsgnHRDgX3LpJRMjc88YOAJeTsg2om9rtiZdoithtIuruvC5nu7dsUg02c8i1UNluE 4587wMSxASn4uGBhUWOD6lYK5vSsFl8OpkC6u2aBkboY4OLvW6vlaMu3ix4WMi4B9bNT K0C/oGEVxSfjeePsyIA8MzfXNwhoXyavcL9kHBRGasCwuiyT+uhPuRrcs3d7UiUkm5FO GjdQ== X-Gm-Message-State: AEkoout/8Eg2Q0mhJHc6KnJmg/OLvD34ELbDzRZz3N3IEu+utnAJoiM4X1YOeAMcP4RcMkr5WQHW6GO4cQcrfA== X-Received: by 10.55.22.144 with SMTP id 16mr5734576qkw.118.1469708585605; Thu, 28 Jul 2016 05:23:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.40.6 with HTTP; Thu, 28 Jul 2016 05:23:05 -0700 (PDT) In-Reply-To: <20160728104050.l7gegw5gdh6b2yj3@asimov> References: <1469698538-25614-1-git-send-email-hegdevasant@linux.vnet.ibm.com> <20160728104050.l7gegw5gdh6b2yj3@asimov> From: oliver Date: Thu, 28 Jul 2016 22:23:05 +1000 Message-ID: To: Patrick Williams Subject: Re: [Skiboot] [PATCH] external: Fix cross compilation issue X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" On Thu, Jul 28, 2016 at 8:40 PM, Patrick Williams wrote: > On Thu, Jul 28, 2016 at 03:05:38PM +0530, Vasant Hegde wrote: >> For some reason Makefile thinks compiler variables like CC is already >> assigned and ignores CROSS_COMPILE flags. Hence I'm not able to generate >> arm binary on x86. >> >> Use default assignment operator instead of conditional assignment >> operator (?=) in Makefile. >> >> Fixes: 3137d249 (pflash: Allow building under yocto.) >> CC: Patrick Williams >> CC: Stewart Smith >> Signed-off-by: Vasant Hegde >> --- >> external/common/rules.mk | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/external/common/rules.mk b/external/common/rules.mk >> index bb12fd5..416a40d 100644 >> --- a/external/common/rules.mk >> +++ b/external/common/rules.mk >> @@ -1,5 +1,5 @@ >> -CC ?= $(CROSS_COMPILE)gcc >> -LD ?= $(CROSS_COMPILE)ld >> +CC = $(CROSS_COMPILE)gcc >> +LD = $(CROSS_COMPILE)ld > > This effectively undoes the change I made in 3137d249, so I'm not sure > why we would want it or why it is needed. make automatically defines CC so the ?= assignment is never done. You can get the desired behaviour with and ifdef block though: > Yocto sets CC and LD directly and actually adds some of the CFLAGS onto > the CC variable (for right or wrong). Thus it doesn't use CROSS_COMPILE > directly. Also, by forcing 'CC = $(CROSS_COMPILE)gcc' we preclude the > use of clang. Forcing the assignment is a bad idea, but keep in mind that most of us aren't using Yocto. I hit this problem while trying to build a copy of pflash for an unopened BMC and needed to use their toolchain. Manually setting CC/LD from the command line works, but the external/ tools should respect CROSS_COMPILE for consistency with skiboot itself and linux. > >> ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)") >> >> ifeq ($(ARCH),ARCH_ARM) >> -- >> 2.5.5 >> > > -- > Patrick Williams > > _______________________________________________ > Skiboot mailing list > Skiboot@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/skiboot > diff --git a/external/common/rules.mk b/external/common/rules.mk index 5558cd3..4dd7942 100644 --- a/external/common/rules.mk +++ b/external/common/rules.mk @@ -1,5 +1,8 @@ -CC ?= $(CROSS_COMPILE)gcc -LD ?= $(CROSS_COMPILE)ld +ifdef CROSS_COMPILE +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +endif + ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)") ifeq ($(ARCH),ARCH_ARM)