gcc/
authorChristophe Lyon <christophe.lyon@linaro.org>
Tue, 30 Aug 2016 15:51:21 +0000 (17:51 +0200)
committerYvan Roux <yvan.roux@linaro.org>
Wed, 7 Sep 2016 20:08:17 +0000 (22:08 +0200)
Backport from trunk r239561.
2016-08-18  Tamar Christina  <tamar.christina@arm.com>
    Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

* varasm.c (default_use_anchors_for_symbol_p): Reject too large decls.

Change-Id: I1ed30d6a68c07c214f81cc6c75eef7d03023a1f3

gcc/varasm.c

index b0f2af0..580f5f5 100644 (file)
@@ -6772,6 +6772,15 @@ default_use_anchors_for_symbol_p (const_rtx symbol)
         sections that should be marked as small in the section directive.  */
       if (targetm.in_small_data_p (decl))
        return false;
+
+      /* Don't use section anchors for decls that won't fit inside a single
+        anchor range to reduce the amount of instructions require to refer
+        to the entire declaration.  */
+      if (decl && DECL_SIZE (decl)
+        && tree_to_shwi (DECL_SIZE (decl))
+           >= (targetm.max_anchor_offset * BITS_PER_UNIT))
+       return false;
+
     }
   return true;
 }