Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2536574ybb; Sun, 5 Apr 2020 09:58:14 -0700 (PDT) X-Google-Smtp-Source: APiQypIn+Ip21yXQ9sYVSn2DyEtLUC2MjDLNDaarA8XgPnJ+j4hkM/CFum9D8ARvkJr82QCmDkF7 X-Received: by 2002:a9d:171a:: with SMTP id i26mr14850422ota.170.1586105893847; Sun, 05 Apr 2020 09:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586105893; cv=none; d=google.com; s=arc-20160816; b=RECR2INWp/Di11l4Cf24bFVUc4nJ1wWV1ivzZvUXqtQ3qApEaqguB1+8w2Fp2OEuCc Y5DPxenYB99HnuVygLjJX9u9LE/cEtckYhNi+5WHDKedxAidkPO16KjSAstAjtDN/cdQ C+IxgnVoxC7u6KIJAqhmHjccehT5unbPOZbnxXMOr9aKsepmvEbOidnDO43ebqqPP04i NJE4qosIp9tOg521rEPodoTaq/KEESyVQxKCW2UUcOYCUimzKj3jyc6KZIIyJ3Yn+hQu //b8jToe9lGDLyjW2pcmZj4GRLyC12TstbTpCWlQnO7K/a2jp+XlBnT0qqAlylRooiDi 6Jfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature; bh=zHEN/jVViDwhN/xS47rLkq7lWrl+CjuvEXt5Z0Hb3w8=; b=NiO3HwNds6dHNTbz/n581fAcBiR44o82zfbj1WZptfY6zvpF8/wfG1iQYhNEaE4LHl kGFxL2WdlA57uMY4F1hrQH5RugRYIm4ippJh5phLuHBf1LX7MPx3XIUVJLXUJTN27i36 mzcwxf6d8fM/5OeUa+xZQS3akXtKUr2iwyzK9GV2M9awgpDAdUT6KRioucx6Kpwx2+xQ 1hhbxfk57L3CedpGpcdom5SuVBCpicj95WUhBrcKSIP6vSDqv7iKp7TpfmH/87dqx90L tGUPO+fffx2g94AToO8u21dPglX+BcXT9lti19u8WgdkcJ4Dkiqyoig6tFJbkg9Rqfbd NmeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=mail header.b=SlSKdlzV; 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=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o203si6209968oig.1.2020.04.05.09.58.01; Sun, 05 Apr 2020 09:58:13 -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=fail header.i=@flygoat.com header.s=mail header.b=SlSKdlzV; 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=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727699AbgDEQyH (ORCPT + 99 others); Sun, 5 Apr 2020 12:54:07 -0400 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17894 "EHLO sender3-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbgDEQyH (ORCPT ); Sun, 5 Apr 2020 12:54:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1586105613; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Subject:To:CC:From:Message-ID; bh=zHEN/jVViDwhN/xS47rLkq7lWrl+CjuvEXt5Z0Hb3w8=; b=SlSKdlzVn+A57bLZRDrxzpQE/KOoZZzDMxxLmcE4zDiO+TRF2EFjFaSPVJg4ZXDO rlRX+wk4JybOWYybG3bBg+nm7WG9zjlgtU4Dlr2k04D+Bsb64gR3PyQnhmSsGqditxi l02eMTvoqYYF1CDJ2LOUjE9GlXgRfSNsx37LBvd4= Received: from [10.233.233.252] (115.193.87.168 [115.193.87.168]) by mx.zoho.com.cn with SMTPS id 1586105610504458.5867584432443; Mon, 6 Apr 2020 00:53:30 +0800 (CST) Date: Mon, 06 Apr 2020 00:53:26 +0800 User-Agent: K-9 Mail for Android In-Reply-To: References: <20200405082451.694910-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] MIPS: malta: Set load address for 32bit kernel correctly To: "Maciej W. Rozycki" CC: linux-mips@vger.kernel.org, Fangrui Song , Nathan Chancellor , Thomas Bogendoerfer , linux-kernel@vger.kernel.org From: Jiaxun Yang Message-ID: <96C9B1A0-2F89-4650-B0A4-6A6242A2AA0A@flygoat.com> X-ZohoCNMailClient: External Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =E4=BA=8E 2020=E5=B9=B44=E6=9C=886=E6=97=A5 GMT+08:00 =E4=B8=8A=E5=8D=8812= :47:29, "Maciej W=2E Rozycki" =E5=86=99=E5=88=B0: >On Sun, 5 Apr 2020, Jiaxun Yang wrote: > >> LLD failed to link vmlinux with 64bit load address for 32bit ELF >> while bfd will strip 64bit address into 32bit silently=2E >> To fix LLD build, we should supply a 32bit load address for 32bit >> kernel=2E >[=2E=2E=2E] >> diff --git a/arch/mips/mti-malta/Platform >b/arch/mips/mti-malta/Platform >> index 2cc72c9b38e3=2E=2Ef9b49cba1764 100644 >> --- a/arch/mips/mti-malta/Platform >> +++ b/arch/mips/mti-malta/Platform >> @@ -6,6 +6,10 @@ cflags-$(CONFIG_MIPS_MALTA) +=3D >-I$(srctree)/arch/mips/include/asm/mach-malta >> ifdef CONFIG_KVM_GUEST >> load-$(CONFIG_MIPS_MALTA) +=3D 0x0000000040100000 >> else >> +ifdef CONFIG_64BIT >> load-$(CONFIG_MIPS_MALTA) +=3D 0xffffffff80100000 >> +else >> + load-$(CONFIG_MIPS_MALTA) +=3D 0x80100000 > > Given the description above I think it should be done uniformly and=20 >automatically across all platforms by trimming the address supplied >with=20 >$(load-y) to low 8 digits in a single place, that is at the place where > >the variable is consumed=2E This will reduce clutter across Makefile=20 >fragments, avoid inconsistencies and extra work to handle individual=20 >platforms as the problem is triggered over and over again, and limit >the=20 >risk of mistakes=2E I was intended to do like this but failed to find a proper way=2E Makefile isn't designed for any kind of calculation=2E And shell variables are 64-bit signed so it can't hold such a huge variabl= e=2E Just wish somebody can give me a way to do like: ifndef CONFIG_64BIT load-y =3D $(load-y) & 0xffffffff endif In makefiles=2E Thanks=2E > >Some error checking might be doable for verifying that the 64-bit >address=20 >truncated is a sign-extended 32-bit value, but that perhaps would be an > >overkill as certainly any 64-bit system that sets the load address to >be=20 >outside the sign-extended 32-bit address range does not support a >!64BIT=20 >configuration anyway=2E > > Maciej --=20 Jiaxun Yang