[U-Boot] [PATCH 3/5] arm: make relocation symbols compiler-generated

Albert ARIBAUD albert.u.boot at aribaud.net
Wed May 15 08:39:54 CEST 2013


Hi Benoît,

On Wed, 15 May 2013 00:09:08 +0200 (CEST), Benoît Thébaudeau
<benoit.thebaudeau at advansee.com> wrote:

> Hi Albert,
> 
> On Tuesday, May 14, 2013 10:02:58 PM, Albert ARIBAUD wrote:
> > This change is only done where needed: some linker
> > scripts may contain relocation symbols yet remain
> > unchanged.
> > 
> > __rel_dyn_start, __rel_dyn_end and __dynsym_start
> > each requires its own output section; putting them
> > in relocation sections changes the sections' nature
> > which breaks relocation.
> > 
> > Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
> 
> [...]
> 
> > diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
> > index 2f22c8c..818735c 100644
> > --- a/arch/arm/lib/relocate.S
> > +++ b/arch/arm/lib/relocate.S
> > @@ -54,12 +54,9 @@ copy_loop:
> >  	/*
> >  	 * fix .rel.dyn relocations
> >  	 */
> > -	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
> > -	add	r10, r10, r9		/* r10 <- sym table in FLASH */
> > -	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
> > -	add	r2, r2, r9		/* r2 <- rel dyn start in FLASH */
> > -	ldr	r3, _rel_dyn_end_ofs	/* r3 <- rel dyn end ofs */
> > -	add	r3, r3, r9		/* r3 <- rel dyn end in FLASH */
> > +	ldr	r10, =__dynsym_start	/* r10 <- sym table ofs */
> > +	ldr	r2, =__rel_dyn_start	/* r2 <- rel dyn start ofs */
> > +	ldr	r3, =__rel_dyn_end	/* r3 <- rel dyn end ofs */
> 
> 'ofs' -> 'in FLASH' in the comments of the 3 lines above.

You are right that 'ofs' should have disappeared from the comments; but
'in FLASH' is right only for some U-Boots and wrong for others, as some
U-Boots indeed run their board_init_f phase in FLASH, but others run in
DDR and thus, copy themselves to DDR from DDR, not FLASH, notably those
with an SPL.

So the most correct commenting is using 'SRC' and 'DST'; will fix in V3
with 'sym table SRC addr' etc.

> Best regards,
> Benoît

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list