mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] ARM: aarch64: Avoid relocations in runtime-offset.S
Date: Tue, 29 Jan 2019 10:44:39 +0100	[thread overview]
Message-ID: <20190129094439.bighzaslxca4lcnp@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqG8RS7VXCV5yYe_bWJ_79W4L4mHXYue+Kpz1s=s0DQ7SQ@mail.gmail.com>

On Mon, Jan 28, 2019 at 11:12:29AM -0800, Andrey Smirnov wrote:
> > > _However_, older toolchains (tested on 5.5.0), will only issue a
> > > R_AARCH64_RELATIVE, so memory location will contain only zeroes:
> > >
> > > 00000000000000a0 <get_runtime_offset>:
> > >       a0:     10000000        adr     x0, a0 <get_runtime_offset>
> > >       a4:     58000061        ldr     x1, b0 <linkadr>
> > >       a8:     eb010000        subs    x0, x0, x1
> > >       ac:     d65f03c0        ret
> > >
> > > 00000000000000b0 <linkadr>:
> > >       ...
> > >
> > > This leads to an very early crash and complete boot failure in the
> > > latter case.
> >
> > I can reproduce this issue here. As you can imagine I do not really like
> > this "fix". I have no idea what the proper solution is (other than
> > deprecating gcc5), so I am fine removing the "a" flag as you suggested.
> > I think though that we should add a big comment above this function
> 
> Sure, will add the comment in v2.
> 
> > *why* this lacks the "a" flag and that we can add it back once gcc5
> > is retired.
> >
> 
> AFAICT, we don't want a relocation there even if GCC5 is deprecated
> and it will always be conveniently initialized for us. To turn the
> tables a bit, why do we need that "a" there? What's its purpose?

The "a" is for "allocatable" meaning that space should be allocated in
the output binary. If you put get_runtime_offset into its own section
(outside .text) without the "a" flag then the linker linker bails out
moaning about overlapping sections. I think the .text segment is
inherently allocatable somehow, but then I wonder why the "a" flag makes
a difference at all. It may just be a bug in the early aarc64
toolchains, who knows...

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

  reply	other threads:[~2019-01-29  9:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  3:15 Andrey Smirnov
2019-01-28  8:56 ` Sascha Hauer
2019-01-28 19:12   ` Andrey Smirnov
2019-01-29  9:44     ` Sascha Hauer [this message]
2019-01-30  1:18       ` Andrey Smirnov

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=20190129094439.bighzaslxca4lcnp@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