Subject: Re: nbgroff chokes on -current sparc64
To: James Chacon <jchacon@genuity.net>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 12/03/2001 01:16:34
>I did some more testing and here's what I was able to determine.
>
>Apply Michael's patch and the reloc errors will go away (as expected since
>the UA64 reloc's don't appear in the final output anymore). What you need
>to do is 
>
>1. Build a new compiler with the patch
>2. Rebuild libstdc++ with the patch and reinstall it
>3. Then try to run nbgroff again
>

Ok, take #2.

I cleaned this up some more (and learned more details of what was actually
going on). After fixing libgcc to actually compile all the bits correctly
the attached patches should resolve the reloc problems as well as allow
exceptions to work correctly on sparc64 again. 

To test do the following:

1. Build a new compiler

The do the following using that compiler:

2. Build and install gnu/lib/libgcc
3. Build and install lib/csu 
4. Build and install gnu/lib/libstdc++

I'm currently running through the tests from the old deja testsuite included
with gcc 3.0.2 and the basic ones are working correctly for both sparc64
and i386 (figured that would double check endian and bit size issues)

I'd really like it if people could look these over/test. Also, the bfd
patch previously posted really should be applied as well but it won't
matter here since this gets rid of the UA64 relocs from even falling through.

James


Index: dwarf2out.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gcc/dwarf2out.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 dwarf2out.c
--- dwarf2out.c 2001/04/23 11:58:11     1.1.1.2
+++ dwarf2out.c 2001/12/03 06:07:11
@@ -1801,6 +1801,7 @@
        }
       fputc ('\n', asm_out_file);
 
+      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
       ASM_OUTPUT_DWARF_ADDR (asm_out_file, "__EXCEPTION_TABLE__");
       if (flag_debug_asm)
        fprintf (asm_out_file, "\t%s pointer to exception region info",
Index: frame.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/gcc/frame.c,v
retrieving revision 1.2
diff -u -r1.2 frame.c
--- frame.c     2001/10/05 07:35:04     1.2
+++ frame.c     2001/12/03 06:07:11
@@ -560,8 +560,10 @@
 extract_cie_info (fde *f, struct cie_info *c)
 {
   void *p;
-  int i;
+  int i, adjust;
 
+  adjust = 0;
+
   c->augmentation = get_cie (f)->augmentation;
 
   if (strcmp (c->augmentation, "") != 0
@@ -569,10 +571,15 @@
       && c->augmentation[0] != 'z')
     return 0;
 
+  /* Handle the blank space > 4 byte alignment may have forced. */ 
+  if (sizeof(void *) > 4)
+        adjust = (sizeof(void *) - 4);
+  
   p = c->augmentation + strlen (c->augmentation) + 1;
-
+  
   if (strcmp (c->augmentation, "eh") == 0)
     {
+      p += adjust;
       c->eh_ptr = read_pointer (p);
       p += sizeof (void *);
     }