OSDN Git Service

2000-05-02 Andrew Haley <aph@cygnus.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 May 2000 13:50:25 +0000 (13:50 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 May 2000 13:50:25 +0000 (13:50 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33609 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h

index b56fa62..369e058 100644 (file)
@@ -1,3 +1,11 @@
+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
index dbc89d7..f5af654 100644 (file)
@@ -2786,6 +2786,7 @@ ia64_encode_section_info (decl)
   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)
@@ -2813,7 +2814,8 @@ ia64_encode_section_info (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);
@@ -2822,6 +2824,21 @@ ia64_encode_section_info (decl)
          *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
index be921f9..163f983 100644 (file)
@@ -1978,6 +1978,15 @@ do {                                                                     \
 
 #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