This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

String pools versus ENCODE_SECTION_INFO


If ENCODE_SECTION_INFO modifies the label in a string constant, the
hash table won't find a match.  Here's a patch that corrects this, by
arranging that we always use the string of the symbol_ref, which is
the only thing available when marking the constants.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* varasm.c (output_constant_def): Use the label with
	section-encoded info in the string pool hash table.

Index: gcc/varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.148
diff -u -p -r1.148 varasm.c
--- gcc/varasm.c 2000/12/22 12:27:36 1.148
+++ gcc/varasm.c 2000/12/25 20:35:03
@@ -3218,8 +3218,10 @@ output_constant_def (exp, defer)
       && (!defer || defer_addressed_constants_flag || after_function))
     {
       defstr = (struct deferred_string **)
-	htab_find_slot_with_hash (const_str_htab, desc->label,
-				  STRHASH (desc->label), NO_INSERT);
+	htab_find_slot_with_hash (const_str_htab,
+				  XSTR (XEXP (desc->rtl, 0), 0),
+				  STRHASH (XSTR (XEXP (desc->rtl, 0), 0)),
+				  NO_INSERT);
       if (defstr)
 	{
 	  /* If the string is currently deferred but we need to output it now,
@@ -3263,10 +3265,11 @@ output_constant_def (exp, defer)
 		  || !defer
 		  || flag_writable_strings
 		  || (defstr = (struct deferred_string **)
-			       htab_find_slot_with_hash (const_str_htab,
-							 desc->label,
-							 STRHASH (desc->label),
-							 INSERT)) == NULL)
+			       (htab_find_slot_with_hash
+				(const_str_htab,
+				 XSTR (XEXP (desc->rtl, 0), 0),
+				 STRHASH (XSTR (XEXP (desc->rtl, 0), 0)),
+				 INSERT))) == NULL)
 		output_constant_def_contents (exp, reloc, labelno);
 	      else
 		{
@@ -3276,7 +3279,7 @@ output_constant_def (exp, defer)
 		      xmalloc (sizeof (struct deferred_string));
 
 		  p->exp = copy_constant (exp);
-		  p->label = desc->label;
+		  p->label = XSTR (XEXP (desc->rtl, 0), 0);
 		  p->labelno = labelno;
 		  *defstr = p;
 		  STRING_POOL_ADDRESS_P (XEXP (desc->rtl, 0)) = 1;

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]