re PR target/70113 ([AArch64] -mpc-relative-literal-loads conflicts with fix-cortex...
authorChristophe Lyon <christophe.lyon@linaro.org>
Thu, 10 Mar 2016 13:29:48 +0000 (13:29 +0000)
committerChristophe Lyon <clyon@gcc.gnu.org>
Thu, 10 Mar 2016 13:29:48 +0000 (14:29 +0100)
2016-03-10  Christophe Lyon  <christophe.lyon@linaro.org>

PR target/70113.
* config/aarch64/aarch64.h (TARGET_FIX_ERR_A53_843419_DEFAULT):
Always define to 0 or 1.
(TARGET_FIX_ERR_A53_843419): New macro.
* config/aarch64/aarch64-elf-raw.h
(TARGET_FIX_ERR_A53_843419_DEFAULT): Update for above changes.
* config/aarch64/aarch64-linux.h: Likewise.
* config/aarch64/aarch64.c
(aarch64_override_options_after_change_1): Do not default
aarch64_nopcrelative_literal_loads to true if Cortex-A53 erratum
843419 is on.
(aarch64_attributes): Handle fix-cortex-a53-843419.
(aarch64_can_inline_p): Likewise.
* config/aarch64/aarch64.opt (aarch64_fix_a53_err843419): Save.

From-SVN: r234108

gcc/ChangeLog
gcc/config/aarch64/aarch64-elf-raw.h
gcc/config/aarch64/aarch64-linux.h
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/aarch64.opt

index b6db5dec92e4c814b47b0230b37c9537407b76d3..cb91e97c223ceb855fd3645d913b92ae77f8fdd7 100644 (file)
@@ -1,3 +1,20 @@
+2016-03-10  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       PR target/70113.
+       * config/aarch64/aarch64.h (TARGET_FIX_ERR_A53_843419_DEFAULT):
+       Always define to 0 or 1.
+       (TARGET_FIX_ERR_A53_843419): New macro.
+       * config/aarch64/aarch64-elf-raw.h
+       (TARGET_FIX_ERR_A53_843419_DEFAULT): Update for above changes.
+       * config/aarch64/aarch64-linux.h: Likewise.
+       * config/aarch64/aarch64.c
+       (aarch64_override_options_after_change_1): Do not default
+       aarch64_nopcrelative_literal_loads to true if Cortex-A53 erratum
+       843419 is on.
+       (aarch64_attributes): Handle fix-cortex-a53-843419.
+       (aarch64_can_inline_p): Likewise.
+       * config/aarch64/aarch64.opt (aarch64_fix_a53_err843419): Save.
+
 2016-03-10  Alan Lawrence  <alan.lawrence@arm.com>
        Jakub Jelinek <jakub@redhat.com>
 
index 2dcb6d400ecaefb240795dce78424d6d8bd83a40..90970178892383bd1bdbdb8a047040b51e2ebd60 100644 (file)
@@ -35,7 +35,7 @@
   " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
 #endif
 
-#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT
+#if TARGET_FIX_ERR_A53_843419_DEFAULT
 #define CA53_ERR_843419_SPEC \
   " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}"
 #else
index 6064b2654cb7cd48b5635ea2c15e69b9e67633b5..5fcaa59a3affa34e8dbceff675b4a9cd7dc39e43 100644 (file)
@@ -53,7 +53,7 @@
   " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}"
 #endif
 
-#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT
+#if TARGET_FIX_ERR_A53_843419_DEFAULT
 #define CA53_ERR_843419_SPEC \
   " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}"
 #else
index 801f95ab7fd6dd88a9ae44e81b980100e3dcbcf0..51dfe7917967a3df7ed59462dfaa6a3b47e07e77 100644 (file)
@@ -8132,9 +8132,18 @@ aarch64_override_options_after_change_1 (struct gcc_options *opts)
   if (opts->x_nopcrelative_literal_loads == 1)
     aarch64_nopcrelative_literal_loads = false;
 
-  /* If it is not set on the command line, we default to no
-     pc relative literal loads.  */
-  if (opts->x_nopcrelative_literal_loads == 2)
+  /* If it is not set on the command line, we default to no pc
+     relative literal loads, unless the workaround for Cortex-A53
+     erratum 843419 is in effect.  */
+  /* This is PR70113. When building the Linux kernel with
+     CONFIG_ARM64_ERRATUM_843419, support for relocations
+     R_AARCH64_ADR_PREL_PG_HI21 and R_AARCH64_ADR_PREL_PG_HI21_NC is
+     removed from the kernel to avoid loading objects with possibly
+     offending sequences. With nopcrelative_literal_loads, we would
+     generate such relocations, preventing the kernel build from
+     succeeding.  */
+  if (opts->x_nopcrelative_literal_loads == 2
+      && !TARGET_FIX_ERR_A53_843419)
     aarch64_nopcrelative_literal_loads = true;
 
   /* In the tiny memory model it makes no sense
@@ -8818,6 +8827,8 @@ static const struct aarch64_attribute_info aarch64_attributes[] =
      OPT_mgeneral_regs_only },
   { "fix-cortex-a53-835769", aarch64_attr_bool, true, NULL,
      OPT_mfix_cortex_a53_835769 },
+  { "fix-cortex-a53-843419", aarch64_attr_bool, true, NULL,
+     OPT_mfix_cortex_a53_843419 },
   { "cmodel", aarch64_attr_enum, false, NULL, OPT_mcmodel_ },
   { "strict-align", aarch64_attr_mask, false, NULL, OPT_mstrict_align },
   { "omit-leaf-frame-pointer", aarch64_attr_bool, true, NULL,
@@ -9232,6 +9243,12 @@ aarch64_can_inline_p (tree caller, tree callee)
          2, TARGET_FIX_ERR_A53_835769_DEFAULT))
     return false;
 
+  if (!aarch64_tribools_ok_for_inlining_p (
+         caller_opts->x_aarch64_fix_a53_err843419,
+         callee_opts->x_aarch64_fix_a53_err843419,
+         2, TARGET_FIX_ERR_A53_843419))
+    return false;
+
   /* If the user explicitly specified -momit-leaf-frame-pointer for the
      caller and calle and they don't match up, reject inlining.  */
   if (!aarch64_tribools_ok_for_inlining_p (
index 8b463c96b2df442d81bfea1efc446d0b4a43353e..ec96ce3468b1def0c884fa6ee35174fd3f4681c7 100644 (file)
@@ -179,6 +179,20 @@ extern unsigned aarch64_architecture_version;
   ((aarch64_fix_a53_err835769 == 2)    \
   ? TARGET_FIX_ERR_A53_835769_DEFAULT : aarch64_fix_a53_err835769)
 
+/* Make sure this is always defined so we don't have to check for ifdefs
+   but rather use normal ifs.  */
+#ifndef TARGET_FIX_ERR_A53_843419_DEFAULT
+#define TARGET_FIX_ERR_A53_843419_DEFAULT 0
+#else
+#undef TARGET_FIX_ERR_A53_843419_DEFAULT
+#define TARGET_FIX_ERR_A53_843419_DEFAULT 1
+#endif
+
+/* Apply the workaround for Cortex-A53 erratum 843419.  */
+#define TARGET_FIX_ERR_A53_843419      \
+  ((aarch64_fix_a53_err843419 == 2)    \
+  ? TARGET_FIX_ERR_A53_843419_DEFAULT : aarch64_fix_a53_err843419)
+
 /* ARMv8.1 Adv.SIMD support.  */
 #define TARGET_SIMD_RDMA (TARGET_SIMD && AARCH64_ISA_RDMA)
 
index 49ef0c64e2b05261534d445fecb1d6a8d5946f4d..c637ff43a504933c701735c9d5afddbc9a1e41f8 100644 (file)
@@ -73,7 +73,7 @@ Target Report Var(aarch64_fix_a53_err835769) Init(2) Save
 Workaround for ARM Cortex-A53 Erratum number 835769.
 
 mfix-cortex-a53-843419
-Target Report
+Target Report Var(aarch64_fix_a53_err843419) Init(2) Save
 Workaround for ARM Cortex-A53 Erratum number 843419.
 
 mlittle-endian