Skip to contentSkip to conversation

arm64: errata: Add -mpc-relative-literal-loads to build flags

PATCH Superseded dann frazier 2 participants 2 messages Jan 25, 2016 – Jan 26, 2016 arm64

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: errata: Add -mpc-relative-literal-loads to build flags

GCC6 (and Linaro's 2015.12 snapshot of GCC5) has a new default that uses adrp/ldr or adrp/add to address literal pools. When CONFIG_ARM64_ERRATUM_843419 is enabled, modules built with this toolchain fail to load:

  [ 2.156817] module libahci: unsupported RELA relocation: 275

Longterm, this will likely be superseded by -mfix-cortex-a53-843419, which should disable this optimization in the future.

v2: Unconditionally use flag for both kernel and modules, as Ard notes we have no requirement for supporting literals >1 MB away.

Cc stable at vger.kernel.org
Fixes df057cc7b4fa ("arm64: errata: add module build workaround for erratum #843419")
---
 arch/arm64/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/Makefile +1 -0
index cd822d8..b6c90e5 100644
@@ -27,6 +27,7 @@ $(warning LSE atomics not supported by binutils)
 endif
 
 KBUILD_CFLAGS	+= -mgeneral-regs-only $(lseinstr)
+KBUILD_CFLAGS	+= $(call cc-option, -mpc-relative-literal-loads)
 KBUILD_AFLAGS	+= $(lseinstr)
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
Signature · 1 line
2.7.0
#1 lore raw

PATCH v2 1/1 arm64: errata: Add -mpc-relative-literal-loads to build flags

Quoted 9 lines · dann frazier

GCC6 (and Linaro's 2015.12 snapshot of GCC5) has a new default that uses adrp/ldr or adrp/add to address literal pools. When CONFIG_ARM64_ERRATUM_843419 is enabled, modules built with this toolchain fail to load:

  [ 2.156817] module libahci: unsupported RELA relocation: 275

Longterm, this will likely be superseded by -mfix-cortex-a53-843419, which should disable this optimization in the future.

Better drop this line, it does not apply to partially linked object files (aka modules), only to fully linked binaries [afaik]

Quoted 3 lines

v2: Unconditionally use flag for both kernel and modules, as Ard notes we have no requirement for supporting literals >1 MB away.

Quoted 24 lines
Cc stable at vger.kernel.org
Fixes df057cc7b4fa ("arm64: errata: add module build workaround for erratum #843419")
---
 arch/arm64/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/Makefile +1 -1
index cd822d8..b6c90e5 100644
@@ -27,6 +27,7 @@ $(warning LSE atomics not supported by binutils)
 endif
 
 KBUILD_CFLAGS  += -mgeneral-regs-only $(lseinstr)
+KBUILD_CFLAGS  += $(call cc-option, -mpc-relative-literal-loads)
 KBUILD_AFLAGS  += $(lseinstr)
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
--

2.7.0