LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: nickc@redhat.com, binutils@sourceware.org,
	linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] arm: detect buggy binutils when in thumb2 mode
Date: Thu, 23 Nov 2017 14:01:44 +0200 (EET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711231358420.12424@cone.martin.st> (raw)
In-Reply-To: <20171123115021.25213-1-Jason@zx2c4.com>

On Thu, 23 Nov 2017, Jason A. Donenfeld wrote:

> On older versions of binutils, \sym points to an aligned address. On
> newer versions of binutils, \sym sometimes points to the unaligned thumb
> address in certain circumstances. In order to homogenize this behavior,
> rather than adding 1, we could simply OR in 1, so that already unaligned
> instructions don't change. While that works, the downside is that we have
> to add an `orr` instruction to a fast path. The assembler can't do this at
> assemble time via "|1" because "invalid operands (.text and *ABS* sections)
> for `|'". A better solution would be to have consistent binutils behavior,
> but that ship has sailed.
>
> So, this commit adds a detection mechanism, which began as a small thing
> from Russell King that I then rewrote to use pure bash instead of
> shelling out, so that it doesn't slow down the build process. The detection
> mechanism _could_ be used to modify the assembly we generate, but for now
> it's just being used to catch buggy binutils and abort the build process in
> that case.
>
> The rest of this commit message contains all of the relevant information
> about the boot bug when compiled in thumb2 mode.
>
> My tests concerned these versions:
> broken: GNU ld (Gentoo 2.29.1 p3) 2.29.1
> working: GNU ld (GNU Binutils for Ubuntu) 2.26.1

FWIW, this issue stems from this change: 
https://sourceware.org/bugzilla/show_bug.cgi?id=21458

The same issue caused problems in libavcodec as well, where we chose to 
work around the issue in this fashion:
https://git.libav.org/?p=libav.git;a=commitdiff;h=9dde6ab06c48f9447cd16f39bee33569cddb7be4;hp=547db1eaecd597031165a2bf637acaaacde52788

Related debian bug report, with a different workaround: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=870622

(In libav, we chose the workaround since the .eqv one suggested in the 
debian bug report didn't really work well with assemblers for other 
platforms.)

// Martin

  reply	other threads:[~2017-11-23 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171121172751.29545-1-Jason@zx2c4.com>
     [not found] ` <20171121173857.GJ31757@n2100.armlinux.org.uk>
     [not found]   ` <CAHmME9quDFbdOR9hKRz-Px=Mh3FvYEyhVrs4V_+JT+GjDajMrA@mail.gmail.com>
     [not found]     ` <20171121174942.GK31757@n2100.armlinux.org.uk>
     [not found]       ` <CAHmME9oMTNJFnOwfhu26QSRSP92Axbc-+v9cCPsTKxekZvGvxg@mail.gmail.com>
     [not found]         ` <20171123103518.GL31757@n2100.armlinux.org.uk>
2017-11-23 10:47           ` Fwd: [PATCH] arm: ensure symbol is a thumb symbol in new binutils Jason A. Donenfeld
2017-11-23 11:48             ` [PATCH] arm: detect buggy binutils when in thumb2 mode Jason A. Donenfeld
2017-11-23 11:50               ` [PATCH v2] " Jason A. Donenfeld
2017-11-23 12:01                 ` Martin Storsjö [this message]
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:26               ` Ard Biesheuvel

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=alpine.DEB.2.20.1711231358420.12424@cone.martin.st \
    --to=martin@martin.st \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).