Subject: Re: nbgroff chokes on -current sparc64
To: James Chacon <jchacon@genuity.net>
From: David Brownlee <abs@netbsd.org>
List: tech-toolchain
Date: 12/07/2001 13:00:17
	Wonderful! :) Looks like this makes everything happy on my sparc64
	(its built itself over a couple of times with the patch).

	I don't know if its related to this, but now perl fails to
	compile quoting an issue in libgcc:

/usr/lib/libgcc.a(_fixtfdi.o): In function `__fixtfdi':
_fixtfdi.o(.text+0x18): undefined reference to `_Qp_flt'
/usr/lib/libgcc.a(_fixunstfdi.o): In function `__fixunstfdi':
_fixunstfdi.o(.text+0x18): undefined reference to `_Qp_flt'
_fixunstfdi.o(.text+0x3c): undefined reference to `_Qp_mul'
_fixunstfdi.o(.text+0x44): undefined reference to `_Qp_qtoui'
_fixunstfdi.o(.text+0x70): undefined reference to `_Qp_add'
_fixunstfdi.o(.text+0x84): undefined reference to `_Qp_sub'
_fixunstfdi.o(.text+0xa0): undefined reference to `_Qp_flt'
_fixunstfdi.o(.text+0xb4): undefined reference to `_Qp_qtoui'
_fixunstfdi.o(.text+0xc8): undefined reference to `_Qp_qtoui'
/usr/lib/libgcc.a(_floatditf.o): In function `__floatditf':
_floatditf.o(.text+0x4): undefined reference to `_Qp_itoq'
_floatditf.o(.text+0x1c): undefined reference to `_Qp_mul'
_floatditf.o(.text+0x28): undefined reference to `_Qp_mul'
_floatditf.o(.text+0x38): undefined reference to `_Qp_itoq'
_floatditf.o(.text+0x5c): undefined reference to `_Qp_add'
_floatditf.o(.text+0x70): undefined reference to `_Qp_add'

-- 
		David/absolute		-- www.netbsd.org: No hype required --


On Mon, 3 Dec 2001, James Chacon wrote:

> >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 *);
>      }
>
>