diff mbox

[6/7] arm64: explicitly pass --no-fix-cortex-a53-843419 to GNU gold

Message ID 20171129234442.655-7-samitolvanen@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sami Tolvanen Nov. 29, 2017, 11:44 p.m. UTC
Some versions of GNU gold are known to produce broken code with
--fix-cortex-a53-843419 as explained in this bug:

  https://sourceware.org/bugzilla/show_bug.cgi?id=21491

If ARM64_ERRATUM_843419 is disabled and we're using GNU gold, pass
--no-fix-cortex-a53-843419 to the linker to ensure the erratum
fix is not used even if the linker is configured to enable it by
default.

This change also adds a warning if the erratum fix is enabled and
gold version <1.14 is used.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
 arch/arm64/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Nick Desaulniers Nov. 30, 2017, 12:30 a.m. UTC | #1
On Wed, Nov 29, 2017 at 3:44 PM, Sami Tolvanen <samitolvanen@google.com> wrote:
> @@ -26,10 +26,19 @@ ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
>    ifeq ($(call ld-option, --fix-cortex-a53-843419),)
>  $(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
>    else
> +    ifeq ($(call gold-ifversion, -lt, 114000000, y), y)
> +$(warning This version of GNU gold may generate incorrect code with --fix-cortex-a53-843419;\
> +       see https://sourceware.org/bugzilla/show_bug.cgi?id=21491)
> +    endif
>  LDFLAGS_vmlinux        += --fix-cortex-a53-843419
>    endif
>  endif
>
> +ifeq ($(CONFIG_ARM64_ERRATUM_843419),)
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=21491
> +LDFLAGS_GOLD   += --no-fix-cortex-a53-843419
> +endif
> +

Rather than:

if CONFIG_ARM64_ERRATUM_843419 == y:
  ...
if CONFIG_ARM64_ERRATUM_843419 == '':
  ...

could this be:

if CONFIG_ARM64_ERRATUM_843419 == y:
  ...
else
  ...

?
Sami Tolvanen Nov. 30, 2017, 5:50 p.m. UTC | #2
On Wed, Nov 29, 2017 at 04:30:33PM -0800, Nick Desaulniers wrote:
> Rather than:
> 
> if CONFIG_ARM64_ERRATUM_843419 == y:
>   ...
> if CONFIG_ARM64_ERRATUM_843419 == '':
>   ...
> 
> could this be:
> 
> if CONFIG_ARM64_ERRATUM_843419 == y:
>   ...
> else
>   ...
> 
> ?

Sure. I'll clean this up in v2.

Sami
diff mbox

Patch

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 82a0df6e865e..81a12713f7af 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -26,10 +26,19 @@  ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
   ifeq ($(call ld-option, --fix-cortex-a53-843419),)
 $(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
   else
+    ifeq ($(call gold-ifversion, -lt, 114000000, y), y)
+$(warning This version of GNU gold may generate incorrect code with --fix-cortex-a53-843419;\
+	see https://sourceware.org/bugzilla/show_bug.cgi?id=21491)
+    endif
 LDFLAGS_vmlinux	+= --fix-cortex-a53-843419
   endif
 endif
 
+ifeq ($(CONFIG_ARM64_ERRATUM_843419),)
+# https://sourceware.org/bugzilla/show_bug.cgi?id=21491
+LDFLAGS_GOLD	+= --no-fix-cortex-a53-843419
+endif
+
 KBUILD_DEFCONFIG := defconfig
 
 # Check for binutils support for specific extensions