[lkml]   [2020]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] MIPS: malta: Set load address for 32bit kernel correctly

于 2020年4月6日 GMT+08:00 上午12:47:29, "Maciej W. Rozycki" <> 写到:
>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.
>> To fix LLD build, we should supply a 32bit load address for 32bit
>> kernel.
>> diff --git a/arch/mips/mti-malta/Platform
>> index 2cc72c9b38e3..f9b49cba1764 100644
>> --- a/arch/mips/mti-malta/Platform
>> +++ b/arch/mips/mti-malta/Platform
>> @@ -6,6 +6,10 @@ cflags-$(CONFIG_MIPS_MALTA) +=
>> load-$(CONFIG_MIPS_MALTA) += 0x0000000040100000
>> else
>> +ifdef CONFIG_64BIT
>> load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
>> +else
>> + load-$(CONFIG_MIPS_MALTA) += 0x80100000
> Given the description above I think it should be done uniformly and
>automatically across all platforms by trimming the address supplied
>$(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
>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

In makefiles.

>Some error checking might be doable for verifying that the 64-bit
>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
>outside the sign-extended 32-bit address range does not support a
>configuration anyway.
> Maciej

Jiaxun Yang

 \ /
  Last update: 2020-04-05 18:54    [W:0.093 / U:6.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site