public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/4] mx31pdk: copy SPL directly, not using relocate_code.
Date: Tue, 14 May 2013 20:24:40 +0200	[thread overview]
Message-ID: <20130514202440.7a7ebef7@lilith> (raw)
In-Reply-To: <1115395100.819514.1368551410764.JavaMail.root@advansee.com>

Hi Beno?t,

On Tue, 14 May 2013 19:10:10 +0200 (CEST), Beno?t Th?baudeau
<benoit.thebaudeau@advansee.com> wrote:

> Hi Albert,
> 
> On Tuesday, May 14, 2013 6:13:55 PM, Albert ARIBAUD wrote:
> > Hi Beno?t,
> > 
> > On Tue, 14 May 2013 17:14:12 +0200 (CEST), Beno?t Th?baudeau
> > <benoit.thebaudeau@advansee.com> wrote:
> > 
> > > Hi Albert,
> > > 
> > > On Tuesday, May 14, 2013 11:50:27 AM, Albert ARIBAUD wrote:
> > > > Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> > > > ---
> > > > Changes in v2:
> > > > - dropped relocate_code() call from mx31pdk SPL
> > > > 
> > > >  board/freescale/mx31pdk/mx31pdk.c |   16 +++++++++++++++-
> > > >  1 file changed, 15 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/board/freescale/mx31pdk/mx31pdk.c
> > > > b/board/freescale/mx31pdk/mx31pdk.c
> > > > index 49158bd..4f6cfee 100644
> > > > --- a/board/freescale/mx31pdk/mx31pdk.c
> > > > +++ b/board/freescale/mx31pdk/mx31pdk.c
> > > > @@ -39,7 +39,21 @@ DECLARE_GLOBAL_DATA_PTR;
> > > >  #ifdef CONFIG_SPL_BUILD
> > > >  void board_init_f(ulong bootflag)
> > > >  {
> > > > -	relocate_code(CONFIG_SPL_TEXT_BASE);
> > > > +	/*
> > > > +	 * copy ourselves from where we are running to where we were
> > > > +	 * linked at. Use ulong pointers as all addresses involved
> > > > +	 * are 4-byte-aligned.
> > > > +	 */
> > > > +	ulong *start_ptr, *end_ptr, *link_ptr, *run_ptr, *dst;
> > > > +	asm volatile ("ldr %0, =_start" : "=r"(start_ptr));
> > > > +	asm volatile ("ldr %0, =_end" : "=r"(end_ptr));
> > > 
> > > Why not __image_copy_start/end instead? I know that the result will be the
> > > same
> > > here, but the naming would be more appropriate. The existing u-boot-spl.lds
> > > still gives access to __image_copy_*.
> > 
> > Well, yes, the naming seems appropriate, and I thought and said so
> > myself some time ago. But then, I realize that __image_copy_start and
> > __image_copy_end are tightly coupled with relocation, and I want to
> > avoid creating any additional ties between relocation and SPL just when
> > I am severing them. IOW, I want to keep the option of having a reduced
> > SPL linker file, distinct from the u-boot one, and where none of
> > __image_copy_*, __rel_dyn_* or __dynsym_start exist.
> 
> OK, that's fine.
> 
> Since _end is linker-generated contrary to the other symbols that you use in
> those asm lines, have you checked that no R_ARM_ABS32 relocation data is
> generated here? OTOH, -pie is not used with SPL, so there should be no
> relocation data at all generated here, and the true final addresses should be in
> the binary image.

Indeed, SPL is meant to be loaded at its link-time address -- or, in the
case of mx31pdk and tx25, loaded in a read buffer then moved by itself
to its link-time address. In no case is SPL supposed to be relocated.
You can verify with readelf -r that no relocation records are generated
for SPL builds.

> Best regards,
> Beno?t

Amicalement,
-- 
Albert.

  reply	other threads:[~2013-05-14 18:24 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 21:56 [U-Boot] [PATCH 0/4] Factorize ARM relocation code Albert ARIBAUD
2013-05-10 21:56 ` [U-Boot] [PATCH 1/4] Rename arch/arm/lib/bss.c to sections.c Albert ARIBAUD
2013-05-10 21:56   ` [U-Boot] [PATCH 2/4] arm: make __image_copy_{start, end} compiler-generated Albert ARIBAUD
2013-05-10 21:56     ` [U-Boot] [PATCH 3/4] arm: make relocation section symbols compiler-generated Albert ARIBAUD
2013-05-10 21:56       ` [U-Boot] [PATCH 4/4] arm: factorize relocate_code routine Albert ARIBAUD
2013-05-11  2:04         ` Benoît Thébaudeau
2013-05-11  7:40           ` Albert ARIBAUD
2013-05-11 13:40             ` Benoît Thébaudeau
2013-05-11 22:13         ` Simon Glass
2013-05-11  0:25     ` [U-Boot] [PATCH 2/4] arm: make __image_copy_{start, end} compiler-generated Benoît Thébaudeau
2013-05-11  8:02       ` Albert ARIBAUD
2013-05-11 17:52         ` Benoît Thébaudeau
2013-05-11 20:13           ` Albert ARIBAUD
2013-05-12  8:57             ` Albert ARIBAUD
2013-05-14  9:50 ` [U-Boot] [PATCH v2 0/4] Factorize ARM relocate_code instances Albert ARIBAUD
2013-05-14  9:50   ` [U-Boot] [PATCH v2 1/4] mx31pdk: copy SPL directly, not using relocate_code Albert ARIBAUD
2013-05-14  9:50     ` [U-Boot] [PATCH v2 2/4] tx25: " Albert ARIBAUD
2013-05-14  9:50       ` [U-Boot] [PATCH v2 3/4] arm: do not compile relocate_code() for SPL builds Albert ARIBAUD
2013-05-14  9:50         ` [U-Boot] [PATCH v2 4/4] arm: factorize relocate_code routine Albert ARIBAUD
2013-05-14 16:01           ` Benoît Thébaudeau
2013-05-14 16:32             ` Albert ARIBAUD
2013-05-14 17:17               ` Benoît Thébaudeau
2013-05-14 18:51                 ` Albert ARIBAUD
2013-05-14 18:49                   ` Benoît Thébaudeau
2013-05-15  7:31             ` Albert ARIBAUD
2013-05-15  8:30               ` Albert ARIBAUD
2013-05-15 16:36                 ` Benoît Thébaudeau
2013-05-15 17:55                   ` Albert ARIBAUD
2013-05-16 14:29                     ` Albert ARIBAUD
2013-05-16 14:28                       ` Benoît Thébaudeau
2013-05-16 14:52                         ` Albert ARIBAUD
2013-05-16 14:56                           ` Albert ARIBAUD
2013-05-14 15:21         ` [U-Boot] [PATCH v2 3/4] arm: do not compile relocate_code() for SPL builds Benoît Thébaudeau
2013-05-14 16:21           ` Albert ARIBAUD
2013-05-14 17:12             ` Benoît Thébaudeau
2013-05-14 15:15       ` [U-Boot] [PATCH v2 2/4] tx25: copy SPL directly, not using relocate_code Benoît Thébaudeau
2013-05-14 15:14     ` [U-Boot] [PATCH v2 1/4] mx31pdk: " Benoît Thébaudeau
2013-05-14 16:13       ` Albert ARIBAUD
2013-05-14 17:10         ` Benoît Thébaudeau
2013-05-14 18:24           ` Albert ARIBAUD [this message]
2013-05-14  9:55   ` [U-Boot] [PATCH v2 0/4] Factorize ARM relocate_code instances Albert ARIBAUD
2013-05-16 12:02   ` [U-Boot] [PATCH v3 " Albert ARIBAUD
2013-05-16 12:02     ` [U-Boot] [PATCH v3 1/4] mx31pdk: copy SPL directly, not using relocate_code Albert ARIBAUD
2013-05-16 12:02       ` [U-Boot] [PATCH v3 2/4] tx25: " Albert ARIBAUD
2013-05-16 12:02         ` [U-Boot] [PATCH v3 3/4] arm: do not compile relocate_code() for SPL builds Albert ARIBAUD
2013-05-16 12:02           ` [U-Boot] [PATCH v3 4/4] arm: factorize relocate_code routine Albert ARIBAUD
2013-05-16 15:56             ` Benoît Thébaudeau
2013-05-16 16:57               ` Albert ARIBAUD
2013-05-16 14:53     ` [U-Boot] [PATCH v3 0/4] Factorize ARM relocate_code instances Albert ARIBAUD
2013-05-16 14:55       ` Albert ARIBAUD
2013-05-19 11:48     ` [U-Boot] [PATCH v4 " Albert ARIBAUD
2013-05-19 11:48       ` [U-Boot] [PATCH v4 1/4] mx31pdk: copy SPL directly, not using relocate_code Albert ARIBAUD
2013-05-19 11:48         ` [U-Boot] [PATCH v4 2/4] tx25: " Albert ARIBAUD
2013-05-19 11:48           ` [U-Boot] [PATCH v4 3/4] arm: do not compile relocate_code() for SPL builds Albert ARIBAUD
2013-05-19 11:48             ` [U-Boot] [PATCH v4 4/4] arm: factorize relocate_code routine Albert ARIBAUD
2013-05-19 15:57       ` [U-Boot] [PATCH v4 0/4] Factorize ARM relocate_code instances Benoît Thébaudeau
2013-05-20  9:26         ` Albert ARIBAUD
2013-05-20 15:39           ` Benoît Thébaudeau
2013-05-21 13:24             ` Fabio Estevam
2013-05-28 13:28               ` Albert ARIBAUD
2013-05-29 12:57                 ` Fabio Estevam
2013-05-27 14:56           ` Simon Glass
2013-05-27 16:16             ` Albert ARIBAUD
2013-05-27 16:37               ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130514202440.7a7ebef7@lilith \
    --to=albert.u.boot@aribaud.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox