Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave P Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: force linker to use PIC veneers
Date: Thu, 26 Mar 2015 13:19:14 +0000	[thread overview]
Message-ID: <20150326131913.GA6140@e103592.cambridge.arm.com> (raw)
In-Reply-To: <CAKv+Gu9CDnFSiRrntzTDZDFhb3Cq1M-Dt_xKxvNUszZJpSrzpg@mail.gmail.com>

On Thu, Mar 26, 2015 at 01:05:09PM +0000, Ard Biesheuvel wrote:
> On 26 March 2015 at 13:53, Dave P Martin <Dave.Martin@arm.com> wrote:
> > On Thu, Mar 26, 2015 at 12:24:01PM +0000, Ard Biesheuvel wrote:
> >> On 26 March 2015 at 13:22, Russell King - ARM Linux
> >> <linux@arm.linux.org.uk> wrote:
> >> > On Thu, Mar 26, 2015 at 01:20:16PM +0100, Ard Biesheuvel wrote:
> >
> > [...]
> >
> >> >> Any specific concerns? The --pic-veneer switch dates back to 2009, so
> >> >> it's been around for a while
> >> >
> >> > BX.  Not every CPU supports BX.
> >> >
> >>
> >> The bx is used for the Thumb -> ARM switch inside the veneer only, so
> >> if you build for ARM these won't appear in the output
> >
> > Agreed that's what's _supposed_ to happen.
> >
> > Note that --use-blx is an override and might introduce BXs into a kernel
> > that otherwise doesn't have them.  But in any case, this option doesn't
> > show a benefit for the scenario under discussion, hence my dropping the
> > request (conditional on THUMB2_KERNEL in any case).
> >
> 
> Actually, i am not quite sure. I hadn't realised that there is no
> branch-without-link counterpart of 'blx <label>' so even if I still
> potted a number of bx pc/nop sequences, I can't really say if there
> were quite as many as before.

Where not out of range, the compiler should just branch to the
destination, with no veneer.  This would apply to optimised tail-
calls, for example -- but with an ordinary branch, not BX.  The
linker would only ever fix it up as B{L}X for one of two reasons:
either the destination is in a different instruction set, or
Thumb code is branching to a veneer (veneers are always ARM).

THUMB2_KERNEL generates a kernel which is very nearly 100% Thumb
code, so BX should be very rare when veneers are not involved.

> > Ard, can you should build a couple of !THUMB2_KERNEL/pre-v5
> > configurations with your change and check, just to be sure?
> >
> 
> Will do.
> 

Cheers
---Dave

  reply	other threads:[~2015-03-26 13:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 10:16 [PATCH] ARM: force linker to use PIC veneers Ard Biesheuvel
2015-03-24 12:22 ` Dave Martin
2015-03-24 12:50   ` Ard Biesheuvel
2015-03-24 13:54     ` Dave Martin
2015-03-24 14:04       ` Ard Biesheuvel
2015-03-24 15:23         ` Nicolas Pitre
2015-03-24 17:35       ` Ard Biesheuvel
2015-03-25 10:46         ` Dave Martin
2015-03-26 11:36           ` Russell King - ARM Linux
2015-03-26 12:20             ` Ard Biesheuvel
2015-03-26 12:22               ` Russell King - ARM Linux
2015-03-26 12:24                 ` Ard Biesheuvel
2015-03-26 12:53                   ` Dave P Martin
2015-03-26 13:05                     ` Ard Biesheuvel
2015-03-26 13:19                       ` Dave P Martin [this message]
2015-03-27  0:01                         ` Ard Biesheuvel
2015-03-30 12:06                           ` Dave P Martin
2015-03-24 15:16     ` Nicolas Pitre
2015-03-24 15:23       ` Ard Biesheuvel
2015-03-24 15:49         ` Nicolas Pitre
2015-03-24 15:51           ` Ard Biesheuvel
2015-03-24 23:25             ` Russell King - ARM Linux
2015-03-24 23:30               ` Ard Biesheuvel
2015-03-24 15:41       ` Ard Biesheuvel
2015-03-24 16:42 ` Nicolas Pitre

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=20150326131913.GA6140@e103592.cambridge.arm.com \
    --to=dave.martin@arm.com \
    --cc=linux-arm-kernel@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