[U-Boot] [PATCH] avr32: fix relocation address calculation

Albert ARIBAUD albert.u.boot at aribaud.net
Fri May 10 11:24:44 CEST 2013


Hi Andreas,

On Wed,  8 May 2013 11:25:17 +0200, Andreas Bießmann
<andreas.devel at googlemail.com> wrote:

> Commit 1865286466a5d0c7f2e3c37632da56556c838e9e (Introduce generic link
> section.h symbol files) changed the __bss_end symbol type from char[] to
> ulong. This led to wrong relocation parameters which ended up in a not working
> u-boot. Unfortunately this is not clear to see cause due to RAM aliasing we
> may get a 'half-working' u-boot then.
> 
> Fix this by dereferencing the __bss_end symbol where needed.

(cc:ing Simon and Tom)

The dereferencing is correct, so this patch seems good per se (it could
actually have applied when __bss_end was still a char[]).

But the definition of __bss_end to being an ulong, as introduced by
18652864, is plain wrong. Just because it is a linker defined symbol
does not mean the object it represents is a 32-bit quantity -- it is
not. It still is a non-object, a pure address.

Ditto for __data_end, __rel_dyn_start, __rel_dyn_end and pretty much any
symbol in sections.h which is not an offset.

Sorry for not spotting this before it was merged in; but now this must
be fixed. I'm ok with the wrongly-ulong symbols being changed back to
char[], though I would prefer their type to be char[0] if possible, as
this is (admittedly marginally) more likely to help the compiler catch
accidental dereferencings.

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list