[PATCH] mips: reloc: Change R_MIPS_NONE to catch pre-reloc BSS usage

Stefan Roese sr at denx.de
Sat Jun 6 06:46:36 CEST 2020


On 05.06.20 17:51, Daniel Schwierzeck wrote:
> 
> 
> Am 05.06.20 um 10:29 schrieb Stefan Roese:
>> This patch changes the R_MIPS_NONE define from 0 to a magic value. This
>> makes it possible to better detect any forbidden pre-relocation usage
>> of BSS variables, as they are often zero'ed and then relocation is
>> stopped too early.
>>
>> Additionally the error message is improved to also print the faulting
>> address. This helps finding the root-cause for this breakage by
>> comparing this address with the values in System.map.
>>
>> This patch helps a lot when working on pre-relocation code, like the
>> Octeon DDR init code, where such variables have hit me multiple times
>> now.
>>
>> Signed-off-by: Stefan Roese <sr at denx.de>
>> Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
>> Cc: Aaron Williams <awilliams at marvell.com>
>> Cc: Chandrakala Chavva <cchavva at marvell.com>
>> ---
>>   arch/mips/include/asm/relocs.h | 2 +-
>>   arch/mips/lib/reloc.c          | 7 ++++---
>>   2 files changed, 5 insertions(+), 4 deletions(-)
>>
> 
> applied to u-boot-mips/next, thanks.
> 
> BTW: in case the relocation table is cutted off, you can increase the
> size with CONFIG_MIPS_RELOCATION_TABLE_SIZE.

Yes, I know. But this is not the case here. Its the runtime overwrite
that I'm addressing.

Thanks,
Stefan


More information about the U-Boot mailing list