This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ppc gc fix
- To: dje at watson dot ibm dot com
- Subject: ppc gc fix
- From: Richard Henderson <rth at cygnus dot com>
- Date: Tue, 28 Sep 1999 00:34:12 -0700
- Cc: gcc-patches at gcc dot gnu dot org
Strings hung off rtxes must be allocated from the collector.
Ok?
r~
* rs6000.c (rs6000_encode_section_info): If ggc_p, use
ggc_alloc_string.
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.98
diff -c -p -d -r1.98 rs6000.c
*** rs6000.c 1999/09/22 22:27:58 1.98
--- rs6000.c 1999/09/28 07:30:20
*************** rs6000_encode_section_info (decl)
*** 5986,5996 ****
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
{
! const char *prefix = (DEFAULT_ABI == ABI_AIX) ? "." : "..";
! char *str = permalloc (strlen (prefix) + 1
! + strlen (XSTR (sym_ref, 0)));
! strcpy (str, prefix);
! strcat (str, XSTR (sym_ref, 0));
XSTR (sym_ref, 0) = str;
}
}
--- 5986,6004 ----
if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
{
! size_t len1 = (DEFAULT_ABI == ABI_AIX) ? 1 : 2;
! size_t len2 = strlen (XSTR (sym_ref, 0));
! char *str;
!
! if (ggc_p)
! str = ggc_alloc_string (NULL, len1 + len2);
! else
! str = permalloc (len1 + len2 + 1);
!
! str[0] = '.';
! str[1] = '.';
! memcpy (str + len1, XSTR (sym_ref, 0), len2 + 1);
!
XSTR (sym_ref, 0) = str;
}
}
*************** rs6000_encode_section_info (decl)
*** 6030,6038 ****
&& strcmp (name, ".PPC.EMB.sbss0") == 0))))
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
! char *str = permalloc (2 + strlen (XSTR (sym_ref, 0)));
! strcpy (str, "@");
! strcat (str, XSTR (sym_ref, 0));
XSTR (sym_ref, 0) = str;
}
}
--- 6038,6053 ----
&& strcmp (name, ".PPC.EMB.sbss0") == 0))))
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
! size_t len = strlen (XSTR (sym_ref, 0));
! char *str;
!
! if (ggc_p)
! str = ggc_alloc_string (NULL, len + 1);
! else
! str = permalloc (len + 2);
! str[0] = '@';
! memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
!
XSTR (sym_ref, 0) = str;
}
}