This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix stupid hppa .block implementation


Ever size Zack fixed the hppa block1 test, my machine has crawled to
virtually a halt when running the gas testsuite for hppa-linux.  At
least, until I disabled the test..  By the way my machine was behaving,
the testcase was chewing up enormous amounts of memory.  I decided to
see why, and discovered that pa_block was allocating a chunk of
0x3fffffff bytes, then clearing it, not once, but twice!

	* config/tc-hppa.c (pa_block): Allocate just one byte for the
	fill pattern.

Index: gas/config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.120
diff -u -p -r1.120 tc-hppa.c
--- gas/config/tc-hppa.c	7 Jun 2005 17:54:16 -0000	1.120
+++ gas/config/tc-hppa.c	10 Jun 2005 05:35:04 -0000
@@ -5937,10 +5937,7 @@ static void
 pa_block (z)
      int z ATTRIBUTE_UNUSED;
 {
-  char *p;
-  long int temp_fill;
   unsigned int temp_size;
-  unsigned int i;
 
 #ifdef OBJ_SOM
   /* We must have a valid space and subspace.  */
@@ -5954,21 +5951,11 @@ pa_block (z)
       as_bad (_("Argument to .BLOCK/.BLOCKZ must be between 0 and 0x3fffffff"));
       temp_size = 0;
     }
-
-  /* Always fill with zeros, that's what the HP assembler does.  */
-  temp_fill = 0;
-
-  p = frag_var (rs_fill, (int) temp_size, (int) temp_size,
-		(relax_substateT) 0, (symbolS *) 0, (offsetT) 1, NULL);
-  memset (p, 0, temp_size);
-
-  /* Convert 2 bytes at a time.  */
-
-  for (i = 0; i < temp_size; i += 2)
+  else
     {
-      md_number_to_chars (p + i,
-			  (valueT) temp_fill,
-			  (int) ((temp_size - i) > 2 ? 2 : (temp_size - i)));
+      /* Always fill with zeros, that's what the HP assembler does.  */
+      char *p = frag_var (rs_fill, 1, 1, 0, NULL, temp_size, NULL);
+      *p = 0;
     }
 
   pa_undefine_label ();

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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