[yocto] binutils 2.29.1 ARM Thumb kernel problem

Andre McCurdy armccurdy at gmail.com
Mon Apr 2 16:14:10 PDT 2018


On Mon, Apr 2, 2018 at 1:15 PM, Chris Elledge
<celledge at digitallumens.com> wrote:
> I recently upgraded my Yocto based project to Yocto 2.4.2, and I encountered
> a problem when building my custom kernel for an AT91 SAMA5D3X platform. I've
> been using an ARM Thumb2 kernel for a while successfully until this release.
> It appears that the issue stems from the change to binutils version 2.29.1.
>
> Here's a good description of the problem:
> https://patchwork.kernel.org/patch/10072695/
>
> I tried out their test script, and it flagged the arm-poky-linux-gnueabi-
> toolchain built by Yocto 2.4.2 as being buggy. Has anyone else encountered
> this problem and figured out a way around it without disabling Thumb
> compilation of the kernel?

Thanks for bringing up this issue. Reading through the various bug
reports etc it not clear what the fix should be. Upstream binutils has
not reverted the change and the upstream kernel still appears to rely
on the pre-2.29.1 binutils behaviour.

The simplest solution for OE 2.4 would seem to be to revert the change
in binutils (rev e645cf4, which was added very close to the 2.29.1
release).

Longer term, it looks like the kernel will have to be updated to work
with the most recent versions of binutils. A possible approach for
that is hinted at in the kernel patch you provided a link for, ie
update the "badr" macro in arch/arm/include/asm/assembler.h to OR the
sym address with 1 instead of adding 1. e.g. something like changing:

  #ifdef CONFIG_THUMB2_KERNEL
  adr\c \rd, \sym + 1
  #else

to

  #ifdef CONFIG_THUMB2_KERNEL
  adr\c \rd, \sym
  orr\c \rd, \rd, #1
  #else

The fact that it doesn't seem to have been fixed that way in the
upstream kernel suggests that the kernel developers may be hoping to
find a better solution though (ie one which avoids adding an extra
instruction in the syscall fast path).

So, without some more guidance from either upstream project, the best
solution isn't clear. Perhaps you could try reverting the binutils
change to get you up and running again in the short term and then ask
on the ARM kernel mailing lists what the solution for Thumb2 with
binutils >= 2.29.1 is expected to be?



More information about the yocto mailing list