From 65d21eaf7067d2e41210a74fde9db825274bad2d Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Thu, 18 Aug 2016 08:45:53 +0000 Subject: [PATCH] [PATCH] [GCC] Don't use section anchors for declarations that don't fit in a single anchor range MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On behalf of Tamar Christina  . gcc/ * varasm.c (default_use_anchors_for_symbol_p): Reject too large decls. Co-Authored-By: Ramana Radhakrishnan From-SVN: r239561 --- gcc/ChangeLog | 5 +++++ gcc/varasm.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17dab64..5d89dbb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-08-18  Tamar Christina  + Ramana Radhakrishnan  + + * varasm.c (default_use_anchors_for_symbol_p): Reject too large decls. + 2016-08-18 Richard Biener * ssa-iterators.h (ssa_vuse_operand): New inline. diff --git a/gcc/varasm.c b/gcc/varasm.c index e747d2c..00a9b30 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6793,6 +6793,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; } -- 2.7.4