public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jeroen Hofstee <dasuboot@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] armv8 relocation questions
Date: Mon, 19 May 2014 09:37:27 +0200	[thread overview]
Message-ID: <1400485047.1998.17.camel@yellow> (raw)
In-Reply-To: <20140518195128.ACDA238554D@gemini.denx.de>

Hello Wolfgang.

On zo, 2014-05-18 at 21:51 +0200, Wolfgang Denk wrote:

> In message <1400416665.2394.20.camel@yellow> you wrote:
> > 
> > > > So, I think the 4kb alignment would be a requirement or restriction.
> > > > Gcc did not declare it explicitly
> > > > due to in normal world memory are allocated with page aligned.
> > > > If u-boot for aarch64 want to be compiled at address not 4kb aligned
> > > > the relocated address
> > > > should also be shifted with the same offset.
> > > 
> > > Sorry, I don't understand anything here.  At which exact place is
> > > there any such 4 k alignment restriction?  When we relocate U-Boot, we
> > > just process a list of addresses.  Even if the start of the image is
> > > aligned to a 4 k boundary, there are a zillion of other addresses that
> > > are not, and these can be relocated just fine.
> > > 
> > 
> > The following document [1] mentions:
> > 
> > "ADRP Xd, label
> ...
> > And apparently gcc choose to use it as such. Since the instructions in
> 
> Where exactly does it chose to do so?

In the code emitter which decide to use the following instructions to
look up a label, as mentioned by David [1]. Since it only uses _part of_
the pc, it introduces the need to have the relocation offset be a
multiple of 4k.  

     adrp  x0,  ...
     add   x0, x0, 0x30

>  I cannot understand why that
> should be a problem for _start, but not for any of the other symbols
> we're relocating?
> 

It is not a problem of _start. Any label / symbol which is looked up
with only the adrp + compile time offset will be incorrect if the
relocation offset is not n * 4k. It just that moving _start around makes
the relocation offset not obey this requirement.

> > question are relative to the most significant bits of the pc it does not
> > need fixups, so it is not included in the "list of addresses" you
> > mention. The compiler does create the 4k requirement though by using the
> > instruction the way it does.
> 
> Sorry, I cannot follow.  where exactly does this happen, and why
> there, and not anywhere else?
> 

In any code emitted which uses above pattern. And above code works fine
if text is 4k natural aligned before and after relocation. It also works
fine when the same offset is used before and after relocation.

Regards,
Jeroen

[1] http://lists.denx.de/pipermail/u-boot/2014-May/179713.html

  reply	other threads:[~2014-05-19  7:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 21:38 [U-Boot] armv8 relocation questions Darwin Rambo
2014-05-16 13:47 ` fenghua at phytium.com.cn
2014-05-16 16:23   ` Darwin Rambo
2014-05-16 20:28     ` Wolfgang Denk
2014-05-16 21:15       ` Tom Rini
2014-05-16 22:26         ` Jeroen Hofstee
2014-05-17  2:13           ` fenghua at phytium.com.cn
2014-05-17 16:53             ` Wolfgang Denk
2014-05-18 12:37               ` Jeroen Hofstee
2014-05-18 19:51                 ` Wolfgang Denk
2014-05-19  7:37                   ` Jeroen Hofstee [this message]
2014-05-19 12:33                     ` Wolfgang Denk
2014-05-19 18:10                       ` Jeroen Hofstee
2014-05-19 18:30                         ` Wolfgang Denk
2014-05-19 20:42                           ` Jeroen Hofstee
2014-05-19 21:05                             ` Wolfgang Denk
2014-05-20 17:42                               ` Jeroen Hofstee
2014-05-16 21:24       ` Darwin Rambo
2014-05-16 21:52         ` Tom Rini
2014-05-22 14:19     ` fenghua at phytium.com.cn
2014-05-23  6:51       ` Wolfgang Denk
2014-05-26 13:11         ` fenghua at phytium.com.cn
2014-05-26 14:38           ` Wolfgang Denk
2014-05-17  3:53   ` fenghua at phytium.com.cn

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=1400485047.1998.17.camel@yellow \
    --to=dasuboot@myspectrum.nl \
    --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