[U-Boot] [PATCH RFC] armv7: fixloop: don't fixup if location is NULL

Andreas Bießmann andreas.devel at googlemail.com
Tue Jan 11 14:00:50 CET 2011


Dear Minkyu Kang,

Am 11.01.2011 11:57, schrieb Minkyu Kang:

>> Regardless of the patch, if your code writes to panel_info or any other BSS
>> variable before relocation it will trash the relocation tables that exist at
>> BSS location at this point.
>>
>> IOW, accessing BSS before relocation is forbidden, not just out of fancy,
>> but for a serious reason.
> 
> This patch is not for accessing BSS before relocation,
> it's for prevent exceptions.

The real error is writing to BSS before relocation. This leads to a
corrupted .rel.dyn section which is placed at the same address as .bss
at this moment (bss is overloaded to save space).

If you look in your ELF (e.g. readelf -R .rel.dyn u-boot) you may see,
that the .rel.dyn section does _not_ include a pointer to 0x0 with
relative relocation (0x17) as you showed in a previous post.
If you look in your u-boot.map you may find the function in question
(test_func() was it in your example) is placed in .bss section. Setting
the function pointer to 0 (e.g. test_func() = NULL, as described in
previous mail) before relocation will destroy your .rel.dyn section and
then you will see a zero in .rel.dyn section at some place ... please
investigate the ELF and do not step through the code to find those issues.

I may be wrong, please show it to us.

regards

Andreas Bießmann


More information about the U-Boot mailing list