From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/8] ARM: aarch64: Fix get_runtime_offset after relocation
Date: Fri, 23 Aug 2019 10:11:05 +0200 [thread overview]
Message-ID: <20190823081105.znj2f4r7jjx3npfn@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqHb2EtQ_CCFW7PYOyR-yZ86Fx0605gSwsx_fxUojYffKw@mail.gmail.com>
On Thu, Aug 22, 2019 at 01:14:23PM -0700, Andrey Smirnov wrote:
> On Thu, Aug 22, 2019 at 5:52 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > get_runtime_offset shall return the offset between the address we are
> > running at and the address we are linked at. This value obviously
> > changes when we relocate the binary. cf3b09737b tried to avoid using
> > R_AARCH64_RELATIVE relocations, but in fact this is exactly what the
> > function needs to work. Consider barebox starting at 0x10000000
> > when we are linked at 0x0 then get_runtime_offset() should return
> > 0x10000000 before relocate_to_current_adr(), but afterwards it should
> > return 0x0.
> >
> > This patch brings back the previously removed "a" flag. Since gcc5
> > doesn't put the values of R_AARCH64_RELATIVE fixup'd relocations
> > into the binary but zeroes instead, we help ourselves by basing
> > get_runtime_offset on an address which actually is zero. With
> > CONFIG_RELOCATABLE=y the binary is always linked to 0x0, so _text
> > is initially zero.
> >
>
> This paragraph might be worth putting in the comment as well to
> document some cleverness that is still required to deal with GCC5.
Makes sence. Added this:
/*
* With older gcc versions (gcc5) function pointers will not be filled
* into the binary during compile time and instead rely on relocation
* during runtime. In the binary we'll always have 0x0 here. We deliberately
* use _text here since that is 0x0 and is correct without relocation.
*/
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-08-23 8:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 12:51 [PATCH 0/8] i.MX8 EVK patches Sascha Hauer
2019-08-22 12:51 ` [PATCH 1/8] ARM: aarch64: Fixup relocation table for the second relocation Sascha Hauer
2019-08-22 13:09 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 2/8] ARM: aarch64: Fix get_runtime_offset after relocation Sascha Hauer
2019-08-22 13:08 ` Rouven Czerwinski
2019-08-22 20:14 ` Andrey Smirnov
2019-08-23 8:11 ` Sascha Hauer [this message]
2019-08-22 12:51 ` [PATCH 3/8] pbl: Move piggy verification into pbl_barebox_uncompress() Sascha Hauer
2019-08-22 13:07 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 4/8] ARM: i.MX: imx8-ddrc: Remove debug code Sascha Hauer
2019-08-22 13:04 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 5/8] ARM: nxp-imx8mq-evk: Remove duplicate call to imx8mq_cpu_lowlevel_init() Sascha Hauer
2019-08-22 13:03 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 6/8] ARM: nxp-imx8mq-evk: Replace trampoline Sascha Hauer
2019-08-22 13:03 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 7/8] ARM: i.MX8: Fix piggydata loading Sascha Hauer
2019-08-22 13:02 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 8/8] ARM: nxp-imx8mq-evk: Update comments Sascha Hauer
2019-08-22 12:59 ` Rouven Czerwinski
2019-08-22 13:19 ` [PATCH 0/8] i.MX8 EVK patches Rouven Czerwinski
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=20190823081105.znj2f4r7jjx3npfn@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/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