+2000-05-02 Andrew Haley <aph@cygnus.com>
+
+ * config/ia64/ia64.c (ia64_encode_section_info): Handle the case
+ where this function is called for the second time on a decl that
+ has had its section info changed in such a way as to move it out
+ of small data/bss.
+ * config/ia64/ia64.h (REDO_SECTION_INFO_P): New definition.
+
2000-05-01 Richard Henderson <rth@cygnus.com>
* ifcvt.c (dead_or_predicable): Set merge_bb->end to the insn before
else if (! TARGET_NO_SDATA
&& TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl)
+ && ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
&& ! (TREE_PUBLIC (decl)
&& (flag_pic
|| (DECL_COMMON (decl)
/* If this is an incomplete type with size 0, then we can't put it in
sdata because it might be too big when completed. */
- else if (size > 0 && size <= ia64_section_threshold)
+ else if (size > 0 && size <= ia64_section_threshold
+ && str[0] != SDATA_NAME_FLAG_CHAR)
{
int len = strlen (str);
char *newstr = obstack_alloc (saveable_obstack, len + 2);
*newstr = SDATA_NAME_FLAG_CHAR;
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
}
+ }
+ /* This decl is marked as being in small data/bss but it shouldn't
+ be; one likely explanation for this is that the decl has been
+ moved into a different section from the one it was in when
+ ENCODE_SECTION_INFO was first called. Remove the '@'.*/
+ else if (TREE_CODE (decl) == VAR_DECL
+ && (XSTR (XEXP (DECL_RTL (decl), 0), 0)[0]
+ == SDATA_NAME_FLAG_CHAR))
+ {
+ char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ int len = strlen (str);
+ char *newstr = obstack_alloc (saveable_obstack, len);
+
+ strcpy (newstr, str + 1);
+ XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
}
}
\f
#define ENCODE_SECTION_INFO(DECL) ia64_encode_section_info (DECL)
+/* If a variable is weakened, made one only or moved into a different
+ section, it may be necessary to redo the section info to move the
+ variable out of sdata. */
+
+#define REDO_SECTION_INFO_P(DECL) \
+ ((TREE_CODE (DECL) == VAR_DECL) \
+ && (DECL_ONE_ONLY (decl) || DECL_WEAK (decl) || DECL_COMMON (decl) \
+ || DECL_SECTION_NAME (decl) != 0))
+
#define SDATA_NAME_FLAG_CHAR '@'
#define IA64_DEFAULT_GVALUE 8