Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2554551ybb; Sun, 5 Apr 2020 10:23:45 -0700 (PDT) X-Google-Smtp-Source: APiQypLm9QomuKX4pbAVYRs/c1cQeMZvdsoCLRyU0W+H0YcyU8i4DAmILCMM7W3qK2SHyK4Ki4PP X-Received: by 2002:a05:6830:1d91:: with SMTP id y17mr14323822oti.184.1586107424956; Sun, 05 Apr 2020 10:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586107424; cv=none; d=google.com; s=arc-20160816; b=dGkMuxieOY3sraAR1fzQSMOrtSXxS9FBbF9WTTrvYTe/71BUMUSgAACmFiJeEFTXME yCDJuDcaVs0iTE39MMvejXPjhLFY1Gw6jaaFOi09iQYTr3qWDmEpeQYVGEJ1LVUGkMTY 3uBqI58Gkndy92QbUZQGDCWKOxLJQcw5QTWrRxsYc3J6bNan8cPCAg0lCpi0/H6ELEJP Th49UEJh7pTRu/4qHBqU/hCKwfEOmlFLVVaZQnvpEfvpGxHgVqC3j+9j9jf2+hcXoRTy kfq9KzTtNklJIDnYJfPc7IiGocMUTJ5VPBncZ3omrysZYWNKe9rskYwHY7GIhZf9Shom xq7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=eJkIBqPKWzMON0D2Azc5Yywd8N50R1OomDXrzmqXjOo=; b=spwVtUx8S82q1W6aQPuiMmctDN3BDuDu3eQIvq1OHAB51vxQZ4VEIa0xVR6cLnQ2d7 J7Zsvobn/F54dqMk+36HuF3w+DbRMJEFg6x8OjUJktazl91kWYyjW8GE2w4SBiQ80ySg KRK5tWK1yJw++fQSgIkA4/jWCpbyGiCAN68IUqleLaaVtMnoEwRp4QQ2Au2VrUyJZvcz WuzpiKsUox7bklgQIQSGrGw1CWKlDcT4z1MK8Sm8I33X00XELv+abIPUxVyv/VT4xBS+ 0WqK1QdoxTVZwf7MNLztFCxe58+0qMFFzJwwmuZ/+wreaH0BrKwwvqhSI7An3jnk0HR8 O6YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si6508976otp.138.2020.04.05.10.23.32; Sun, 05 Apr 2020 10:23:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbgDERXG (ORCPT + 99 others); Sun, 5 Apr 2020 13:23:06 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:47900 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbgDERXG (ORCPT ); Sun, 5 Apr 2020 13:23:06 -0400 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23991372AbgDERXDyMN9m (ORCPT + 1 other); Sun, 5 Apr 2020 19:23:03 +0200 Date: Sun, 5 Apr 2020 18:23:03 +0100 (BST) From: "Maciej W. Rozycki" To: Jiaxun Yang cc: linux-mips@vger.kernel.org, Fangrui Song , Nathan Chancellor , Thomas Bogendoerfer , linux-kernel@vger.kernel.org Subject: Re: [PATCH] MIPS: malta: Set load address for 32bit kernel correctly In-Reply-To: <96C9B1A0-2F89-4650-B0A4-6A6242A2AA0A@flygoat.com> Message-ID: References: <20200405082451.694910-1-jiaxun.yang@flygoat.com> <96C9B1A0-2F89-4650-B0A4-6A6242A2AA0A@flygoat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 6 Apr 2020, Jiaxun Yang wrote: > > Given the description above I think it should be done uniformly and > >automatically across all platforms by trimming the address supplied > >with > >$(load-y) to low 8 digits in a single place, that is at the place where > > > >the variable is consumed. This will reduce clutter across Makefile > >fragments, avoid inconsistencies and extra work to handle individual > >platforms as the problem is triggered over and over again, and limit > >the > >risk of mistakes. > > I was intended to do like this but failed to find a proper way. > > Makefile isn't designed for any kind of calculation. > And shell variables are 64-bit signed so it can't hold such a huge variable. > > Just wish somebody can give me a way to do like: > > ifndef CONFIG_64BIT > load-y = $(load-y) & 0xffffffff > endif Use the usual shell tools like `sed', `cut', `awk', or whatever we use in the kernel build already for other purposes. There's no need to do any actual calculation here to extract the last 8 characters (and the leading `0x' prefix). At worst you can write a small C program, compile it with the build system compiler and run, as we already do for some stuff. Maciej