diff options
-rw-r--r-- | arch/arm/Kconfig | 31 | ||||
-rw-r--r-- | arch/arm/Makefile | 4 |
2 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 2fec7073f687..f871f2e1dd7c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1379,6 +1379,37 @@ config THUMB2_KERNEL | |||
1379 | 1379 | ||
1380 | If unsure, say N. | 1380 | If unsure, say N. |
1381 | 1381 | ||
1382 | config THUMB2_AVOID_R_ARM_THM_JUMP11 | ||
1383 | bool "Work around buggy Thumb-2 short branch relocations in gas" | ||
1384 | depends on THUMB2_KERNEL && MODULES | ||
1385 | default y | ||
1386 | help | ||
1387 | Various binutils versions can resolve Thumb-2 branches to | ||
1388 | locally-defined, preemptible global symbols as short-range "b.n" | ||
1389 | branch instructions. | ||
1390 | |||
1391 | This is a problem, because there's no guarantee the final | ||
1392 | destination of the symbol, or any candidate locations for a | ||
1393 | trampoline, are within range of the branch. For this reason, the | ||
1394 | kernel does not support fixing up the R_ARM_THM_JUMP11 (102) | ||
1395 | relocation in modules at all, and it makes little sense to add | ||
1396 | support. | ||
1397 | |||
1398 | The symptom is that the kernel fails with an "unsupported | ||
1399 | relocation" error when loading some modules. | ||
1400 | |||
1401 | Until fixed tools are available, passing | ||
1402 | -fno-optimize-sibling-calls to gcc should prevent gcc generating | ||
1403 | code which hits this problem, at the cost of a bit of extra runtime | ||
1404 | stack usage in some cases. | ||
1405 | |||
1406 | The problem is described in more detail at: | ||
1407 | https://bugs.launchpad.net/binutils-linaro/+bug/725126 | ||
1408 | |||
1409 | Only Thumb-2 kernels are affected. | ||
1410 | |||
1411 | Unless you are sure your tools don't have this problem, say Y. | ||
1412 | |||
1382 | config ARM_ASM_UNIFIED | 1413 | config ARM_ASM_UNIFIED |
1383 | bool | 1414 | bool |
1384 | 1415 | ||
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index da525bc96145..6d611f407ce6 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -105,6 +105,10 @@ AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mau | |||
105 | AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) | 105 | AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) |
106 | CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) | 106 | CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) |
107 | AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb | 107 | AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb |
108 | # Work around buggy relocation from gas if requested: | ||
109 | ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y) | ||
110 | CFLAGS_MODULE +=-fno-optimize-sibling-calls | ||
111 | endif | ||
108 | endif | 112 | endif |
109 | 113 | ||
110 | # Need -Uarm for gcc < 3.x | 114 | # Need -Uarm for gcc < 3.x |