]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas
authorDave Martin <dave.martin@linaro.org>
Thu, 3 Mar 2011 10:41:12 +0000 (11:41 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 10 Mar 2011 16:49:06 +0000 (16:49 +0000)
commita3bf8f65f8996cefeda43e44660dee5dcb1f855d
tree892575c8f378609771752e12e88d4f2699084c70
parentd466b6d0e6af74eaef61a0186f5ca392e21d3511
ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas

Various binutils versions can resolve Thumb-2 branches to
locally-defined, preemptible global symbols as short-range "b.n"
branch instructions.

This is a problem, because there's no guarantee the final
destination of the symbol, or any candidate locations for a
trampoline, are within range of the branch.  For this reason, the
kernel does not support fixing up the R_ARM_THM_JUMP11 (102)
relocation in modules at all, and it makes little sense to add
support.

The symptom is that the kernel fails with an "unsupported
relocation" error when loading some modules.

Until fixed tools are available, passing
-fno-optimize-sibling-calls to gcc should prevent gcc generating
code which hits this problem, at the cost of a bit of extra runtime
stack usage in some cases.

The problem is described in more detail at:
    https://bugs.launchpad.net/binutils-linaro/+bug/725126

Only Thumb-2 kernels are affected.

This patch adds a new CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11 config
option which adds -fno-optimize-sibling-calls to CFLAGS_MODULE
when building a Thumb-2 kernel.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/Kconfig
arch/arm/Makefile