Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3481382ybb; Mon, 6 Apr 2020 09:44:58 -0700 (PDT) X-Google-Smtp-Source: APiQypJmtqRClMSB3xqKsehtHyDWKFgpbqE1Su/clWKAw+DOzW9lhzc7xEP//JpSFgrBqUouKOoy X-Received: by 2002:a05:6830:96:: with SMTP id a22mr17865405oto.212.1586191498135; Mon, 06 Apr 2020 09:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586191498; cv=none; d=google.com; s=arc-20160816; b=UTyldc0WcxiIS52nMM0wss2PNuctvLSqlVyqMIUabAB5hnIcNq0kQyjgyWXu2YraVo LP1yeDcfRCSegtPN4kXMC3YnyUXE8Fv+AiMUL135VAxxUFkcPV8y7fLTpM8VDfwv/Bjv fGfrZtVAtQ27GQHSbHO+72tBUdkO1AgJqrVDgh1i7IpdplNKtCXWa/jmsLze5e3BRvYO 44aZV+/Dbi/l8yg6XpfG+eIPPPN+RUTt7tktCdxNJYpul7la5tMOxf7pB5LdH449F8Rh yfkoI5nhXB9aXR2RxqfRJ7O+7k4ZnCbR/w3sNu51TN3OvVEkX2uBTbLP3fAzsof8VBLH YvSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eP345ArGYnfGAJ4jzoK1LoRsxz9bzdzVl4xTuSWk8YU=; b=G7wVmQgN0Ktgn5MB3he0VM8FYaBtuZoQ3sTr5NPpRPhRebTFFvXs2ChAQDopXp4WNv 4d0cfFkhGBegjj9e+JImqtSoQmAZjGCKftYO6BEDEUx9+JTBycGutrx7syv1B2mG3uE1 pytCb++Oc/Af0uWsl+zl/+i8DMVAOASUb/cYx5fdVrDZybSXWtD6NPP+CUK7VF55gK3V xPjP9IjWEKAOmv+XjU4+JEosS+LFtmlR4rShvkVNcELssFsV2TLDvQZK2zsoBIQP2QcY Va5ox3e1vD2ldM6jxlBf/4qZjgua/SzpGMw7w91TuxS5RvE6mmBVCtIC0sVkD/xuOfad Z0pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="MW8/mQve"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f186si7304593oia.64.2020.04.06.09.44.45; Mon, 06 Apr 2020 09:44:58 -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; dkim=pass header.i=@google.com header.s=20161025 header.b="MW8/mQve"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729557AbgDFQn1 (ORCPT + 99 others); Mon, 6 Apr 2020 12:43:27 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:56175 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729609AbgDFQn0 (ORCPT ); Mon, 6 Apr 2020 12:43:26 -0400 Received: by mail-pj1-f68.google.com with SMTP id fh8so26052pjb.5 for ; Mon, 06 Apr 2020 09:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=eP345ArGYnfGAJ4jzoK1LoRsxz9bzdzVl4xTuSWk8YU=; b=MW8/mQveOroeY0x1xpt8gPhQROWiBKBbi6WYW1EvrM+99HqbdYjegbaYgTLHtdhq1J l4QPfHXLUAHwah6DKPElpdCoNk/mzsNS50F//u2UWG7wU5c4a4/GkJczthkimZUpn+qf DQIOFUaCcWiA0jzlGY8FZKr4Mnx0zlemtrO+SWFM+jmsaSw3jNiXjYEgvKJ/Gnr0NwUK MnClJVV3jSNRRkmUx3oKbc74LCCOJEYOHSeGdVPLODh175Xr4qGV0zFy7UPhLe/1NkmS WYcQaq3Ph8aIWWt+Ip0jt0z+671w0Sbq04XPtO1QlMeNjZ7c784pcgA2r2rnYpZcgi/o VlZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=eP345ArGYnfGAJ4jzoK1LoRsxz9bzdzVl4xTuSWk8YU=; b=RGuabHGg8anSowr0Vkg7hwqTzXjTWY2WWplPwbg9+npM02SWa55An5S+Ag50+HVXXW kKt5wWpt7pcqLpWz3ekLjonxC0X1s8o0oq39vcJ/hSkWtB/eB9pcQbwvP6rTYTEAJI62 p1b10WstY+VN+8jid9TnIQXS78lClgh7zgSj94Hxe3q9VKBcIWWdGs7rJql72LmbxMYN 5dKY0AYhGKhp+ZIeYot0Q+yLDUMlov+GM+c/o5t0+Z9oSXZD7/AgwbkfIbjYs26zh3g3 xed8aGFrLvhFZ4U/0H5QLiE4/LoCDa6ocp+On7rp5pXvPI1yh9OsXPmGxtuqAHDn0tNQ 2nHw== X-Gm-Message-State: AGi0PubSAE7+fAbTLWXhpLZBCZeh3FMo6fhf9Lx/ERL48rlqwBVhZUxK /sISzoDMPfcJOZH9cluPa2rGelJbRHQWog== X-Received: by 2002:a17:90a:fa17:: with SMTP id cm23mr19190pjb.121.1586191404980; Mon, 06 Apr 2020 09:43:24 -0700 (PDT) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id z7sm12001669pfz.24.2020.04.06.09.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 09:43:24 -0700 (PDT) Date: Mon, 6 Apr 2020 09:43:21 -0700 From: Fangrui Song To: Jiaxun Yang Cc: YunQiang Su , "Maciej W. Rozycki" , linux-mips , Nathan Chancellor , Thomas Bogendoerfer , LKML Subject: Re: [PATCH] MIPS: malta: Set load address for 32bit kernel correctly Message-ID: <20200406164321.c3377heoqprzwbjc@google.com> References: <20200405082451.694910-1-jiaxun.yang@flygoat.com> <96C9B1A0-2F89-4650-B0A4-6A6242A2AA0A@flygoat.com> <079F408B-9C44-4317-8DD3-7A1896564960@flygoat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <079F408B-9C44-4317-8DD3-7A1896564960@flygoat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-06, Jiaxun Yang wrote: > > >于 2020年4月6日 GMT+08:00 下午6:57:18, YunQiang Su 写到: >>Maciej W. Rozycki 于2020年4月6日周一 上午1:23写道: >>> >>> 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 >> >>perl may be the easiest to use tool here. >> >>ifndef CONFIG_64BIT >> load-y := $(shell $(PERL) -e 'print $(load-y) & 0xffffffff') >>endif >> >>Note that it is `:=' instead of '='. > >It seems like perl is not one of kernel's build dependencies.[1] >I'm comsidering a alternative solution, >write a small hostprog in C to deal with that. > >Thanks. > >[1]: https://www.kernel.org/doc/html/v5.6/process/changes.html load-y := 0xffffffff80100000 load-y := 0x$(shell echo "$(load-y)" | rev | head -c 8 | rev) >> >>> 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 > >-- >Jiaxun Yang