[U-Boot] [PATCH 2/4] arm: make __image_copy_{start, end} compiler-generated

Albert ARIBAUD
2013-05-11T20:13:51Z

Hi Beno?t,

On Sat, 11 May 2013 19:52:17 +0200 (CEST), Beno?t Th?baudeau
<benoit.thebaudeau@advansee.com> wrote:

> Hi Albert,
>
> On Saturday, May 11, 2013 10:02:48 AM, Albert ARIBAUD wrote:
> > Hi Beno?t,
> >
> > On Sat, 11 May 2013 02:25:02 +0200 (CEST), Beno?t Th?baudeau
> > <benoit.thebaudeau@advansee.com> wrote:
> >
> > > Hi Albert,
>
> [...]
>
> > > > diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds
> > > > b/arch/arm/cpu/arm1136/u-boot-spl.lds
> > > > index 8296e5d..04fc881 100644
> > > > --- a/arch/arm/cpu/arm1136/u-boot-spl.lds
> > > > +++ b/arch/arm/cpu/arm1136/u-boot-spl.lds
> > > > @@ -37,7 +37,6 @@ SECTIONS
> > > > {
> > > > .text :
> > > > {
> > > > - __start = .;
> > > > arch/arm/cpu/arm1136/start.o (.text*)
> > > > *(.text*)
> > > > } >.sram
> > > > @@ -48,7 +47,9 @@ SECTIONS
> > > > . = ALIGN(4);
> > > > .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
> > > > . = ALIGN(4);
> > > > +
> > > > __image_copy_end = .;
> > >
> > > Why aren't all linker scripts treated equally?
> > >
> > > Here, start.S is still used, so '*(.__image_copy_end)' and the related
> > > stuff
> > > should be like what you did for arch/arm/cpu/u-boot.lds below. Or am I
> > > missing
> > > something?
> > >
> > > Same question for several other linker scripts below.
> >
> > Not all SPLs use relocation -- actually, most SPLs do not use
> > relocation, and thus do not need image and relocaton section symbols.
>
> Then, why do you keep the old definition of __image_copy_end in such linker
> scripts? Probably because start.S can't be linked in otherwise, but this is no
> longer true at the end of this series with the new relocate.S that is garbage-
> collected for those SPLs. And in all cases, shouldn't all linker scripts
> requiring __image_copy_end be converted to the new definition?

You are right on both accounts: all linker scripts that need
__image_copy_* should be converted to the new definition, and some
linker scripts probably don't need __image_copy_end even though they
define it. I intend to achieve this, not by editing various linker
scripts, but by factoring them into a single linker script (or two at
most, one for U-boot and one for SPL). So I prefer to do as little work
on the scripts as possible right now; here, only what's needed for
relocation factoring to work.

Hence, if an SPL script sort-of-hardcodes image start and end (or
relocation symbols as some do), then I prefer to leave it alone for now
and handle in the linker script factoring series later.

(on an unrelated note, V2 will have an additional patch removing
absolute relocation record type support in relocate_code, as it should
be useless now too. But I'll pair this removal with a build step that
makes sure the ELF u-boot and SPL binaries only have R_ARM_RELATIVE
relocation records.)

> Best regards,
> Beno?t

Amicalement,
--
Albert.