This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] PR target/65064: Return false for COMMON symbols
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>
- Date: Wed, 18 Feb 2015 05:18:25 -0800
- Subject: Re: [PATCH] PR target/65064: Return false for COMMON symbols
- Authentication-results: sourceware.org; auth=none
- References: <20150215141921 dot GA15368 at gmail dot com>
On Sun, Feb 15, 2015 at 06:19:21AM -0800, H.J. Lu wrote:
> r220674 exposed a bug in ia64_in_small_data_p. After r220674, COMMON
> symbols binds locally for executables. But ia64_in_small_data_p returns
> true for COMMON symbols which are never in small data section. This patch
> fixes it. OK for trunk?
> Since COMMON symbols are never in small data section, ia64_in_small_data_p
> should return false for COMMON symbols.
> PR target/65064
> * config/ia64/ia64.c (ia64_in_small_data_p): Return false for
> COMMON symbols.
Although common symbols are defined in executables, they aren't in small
data section. But a definition in small data section overrides a common
symbol, which still binds lcoally, and turns a reference to common symbol
to reference to small data section. Even if ia64_in_small_data_p returns
true on common symbols, sdata_symbolic_operand must return false on common
symbols. Common symbols are assumed to be placed in small data section,
but are accessed as if they are in normal data section so that they won't
cause any relocation overflow.
Tested by Andreas Schwab <email@example.com>. OK for trunk?
* config/ia64/predicates.md (sdata_symbolic_operand): Return false
for common symbols.
diff --git a/gcc/config/ia64/predicates.md b/gcc/config/ia64/predicates.md
index cba0efe..b550882 100644
@@ -69,7 +69,12 @@
of constants here. */
t = SYMBOL_REF_DECL (op);
if (DECL_P (t))
- t = DECL_SIZE_UNIT (t);
+ /* Common symbol isn't placed in small data section. */
+ if (DECL_COMMON (t))
+ return false;
+ t = DECL_SIZE_UNIT (t);
t = TYPE_SIZE_UNIT (TREE_TYPE (t));
if (t && tree_fits_shwi_p (t))