All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: nickc@redhat.com,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	binutils@sourceware.org,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Fwd: [PATCH] arm: ensure symbol is a thumb symbol in new binutils
Date: Thu, 23 Nov 2017 14:26:09 +0000	[thread overview]
Message-ID: <CAKv+Gu8TJi8qSWAkL231WhQkWxK+vSQm2tnQn_qN-2wdFaNaEA@mail.gmail.com> (raw)
In-Reply-To: <20171123140228.GP31757@n2100.armlinux.org.uk>

On 23 November 2017 at 14:02, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Thu, Nov 23, 2017 at 11:47:56AM +0100, Jason A. Donenfeld wrote:
>> Hello Nick & Binutils developers,
>>
>> It would appear that recent changes in the binutils assembler (perhaps
>> 52a86f843b6dee1de9977293da9786649b146b05? perhaps not?) have broken
>> the kernel when compiled in thumb2 mode. We currently do not have a
>> way of working around your breaking changes without adding additional
>> runtime instructions, which isn't acceptable for us. Details are
>> included in the thread below.
>
> Hi Nick,
>
> I have to ask why it was thought a good idea to change the behaviour
> of the assembler's "adr" pseudo-instruction after it's had the existing
> behaviour for such a long time.
>

I think part of the confusion comes from the fact that ADR is no
longer a pseudo-instruction on Thumb2, and can be used to create
cross-section symbol references that are fixed up by the linker (using
a dedicated relocation type)

So before the change, we were in the situation where ADR behaved
differently when used on symbols, depending on whether they were
defined in the same section or not:
- cross section symbol references are fixed up by the linker, and do
take the Thumb bit into account for function symbols,
- local symbol references and label references are not fixed up at
all, regardless of their type annotation.

Note that external symbol references are hardly ever used, given that
they don't work in ARM mode (since it is a pseudo op there), so in the
kernel, we only care about local symbol references and label
references.

After the change, internal symbol references behave differently, but
label references behave the same. So the uniform behavior we care
about and rely on is no longer there, and even worse, we cannot deal
with this in the code because we cannot detect which binutils version
we are using without intrusive workarounds)

-- 
Ard.

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: Fwd: [PATCH] arm: ensure symbol is a thumb symbol in new binutils
Date: Thu, 23 Nov 2017 14:26:09 +0000	[thread overview]
Message-ID: <CAKv+Gu8TJi8qSWAkL231WhQkWxK+vSQm2tnQn_qN-2wdFaNaEA@mail.gmail.com> (raw)
In-Reply-To: <20171123140228.GP31757@n2100.armlinux.org.uk>

On 23 November 2017 at 14:02, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Thu, Nov 23, 2017 at 11:47:56AM +0100, Jason A. Donenfeld wrote:
>> Hello Nick & Binutils developers,
>>
>> It would appear that recent changes in the binutils assembler (perhaps
>> 52a86f843b6dee1de9977293da9786649b146b05? perhaps not?) have broken
>> the kernel when compiled in thumb2 mode. We currently do not have a
>> way of working around your breaking changes without adding additional
>> runtime instructions, which isn't acceptable for us. Details are
>> included in the thread below.
>
> Hi Nick,
>
> I have to ask why it was thought a good idea to change the behaviour
> of the assembler's "adr" pseudo-instruction after it's had the existing
> behaviour for such a long time.
>

I think part of the confusion comes from the fact that ADR is no
longer a pseudo-instruction on Thumb2, and can be used to create
cross-section symbol references that are fixed up by the linker (using
a dedicated relocation type)

So before the change, we were in the situation where ADR behaved
differently when used on symbols, depending on whether they were
defined in the same section or not:
- cross section symbol references are fixed up by the linker, and do
take the Thumb bit into account for function symbols,
- local symbol references and label references are not fixed up at
all, regardless of their type annotation.

Note that external symbol references are hardly ever used, given that
they don't work in ARM mode (since it is a pseudo op there), so in the
kernel, we only care about local symbol references and label
references.

After the change, internal symbol references behave differently, but
label references behave the same. So the uniform behavior we care
about and rely on is no longer there, and even worse, we cannot deal
with this in the code because we cannot detect which binutils version
we are using without intrusive workarounds)

-- 
Ard.

  reply	other threads:[~2017-11-23 14:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 17:27 [PATCH] arm: ensure symbol is a thumb symbol in new binutils Jason A. Donenfeld
2017-11-21 17:27 ` Jason A. Donenfeld
2017-11-21 17:38 ` Russell King - ARM Linux
2017-11-21 17:38   ` Russell King - ARM Linux
2017-11-21 17:46   ` Jason A. Donenfeld
2017-11-21 17:46     ` Jason A. Donenfeld
2017-11-21 17:49     ` Russell King - ARM Linux
2017-11-21 17:49       ` Russell King - ARM Linux
2017-11-22 23:34       ` Jason A. Donenfeld
2017-11-22 23:34         ` Jason A. Donenfeld
2017-11-23 10:35         ` Russell King - ARM Linux
2017-11-23 10:35           ` Russell King - ARM Linux
2017-11-23 10:47           ` Fwd: " Jason A. Donenfeld
2017-11-23 10:47             ` Jason A. Donenfeld
2017-11-23 11:48             ` [PATCH] arm: detect buggy binutils when in thumb2 mode Jason A. Donenfeld
2017-11-23 11:48               ` Jason A. Donenfeld
2017-11-23 11:50               ` [PATCH v2] " Jason A. Donenfeld
2017-11-23 11:50                 ` Jason A. Donenfeld
2017-11-23 12:01                 ` Martin Storsjö
2017-11-23 12:01                   ` Martin Storsjö
2017-11-23 14:02             ` Fwd: [PATCH] arm: ensure symbol is a thumb symbol in new binutils Russell King - ARM Linux
2017-11-23 14:02               ` Russell King - ARM Linux
2017-11-23 14:26               ` Ard Biesheuvel [this message]
2017-11-23 14:26                 ` Ard Biesheuvel
2017-11-23 14:26                 ` Ard Biesheuvel
     [not found]                 ` <765227b5-981d-0cea-c831-73cfe2f58721@redhat.com>
     [not found]                   ` <aaf57bb5-13e6-852c-0f67-f72aedef0e79@gmail.com>
     [not found]                     ` <254af731-459b-1f1d-2d93-27c5a91e7bfb@redhat.com>
2018-05-31 21:16                       ` [Buildroot] " Romain Naour
2018-06-01  8:28                         ` Christophe PRIOUZEAU
     [not found]                           ` <2a8151c1-644e-a6b0-9a21-2c570ac7000b@redhat.com>
2018-06-05  8:52                             ` Christophe PRIOUZEAU
     [not found]                               ` <ec2b0134-6c4a-53ff-4ae2-69c3f0646ded@redhat.com>
2018-06-05 14:11                                 ` Christophe PRIOUZEAU
     [not found]                                   ` <1d8f302b-5ece-9921-b930-8c4bca61743e@redhat.com>
2018-06-11 14:47                                     ` Christophe PRIOUZEAU
     [not found]                                   ` <1d8f302b-5ece-9921-b930-8c4bca61743e@redhat. com>
     [not found]                                     ` <CAJA7tRbsNa7oTS-1sLs0WpA74RZr0R-v=sCyQxbDam5Gb7fYHA@mail.gmail.com>
     [not found]                                       ` <be2db8d4-7c12-2706-5084-322aa659c3bc@redhat.com>
2018-06-18 15:04                                         ` Christophe PRIOUZEAU
2018-06-18 18:29                                           ` Romain Naour
     [not found]                                             ` <062a421f-a669-fc1c-91e0-88cf73794414@redhat.com>
2018-06-19 12:27                                               ` Christophe PRIOUZEAU
2018-01-16  8:43 ` Chen-Yu Tsai

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=CAKv+Gu8TJi8qSWAkL231WhQkWxK+vSQm2tnQn_qN-2wdFaNaEA@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=Jason@zx2c4.com \
    --cc=binutils@sourceware.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nickc@redhat.com \
    --cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.