Subject: Re: nbgroff chokes on -current sparc64
To: David Brownlee <abs@netbsd.org>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 12/17/2001 21:49:15
Well I looked into this some more.

I have proper _Qp* wrappers (thanks to Andrey Petrov for the code)
around softfloat 128bit code that seems to work except for 2 problems:

1. -msoft-quad-float by itself produces incorrect calls to _Qp* functions
   (_Qp_add for instance gets setup with 2 sets of quad float args in float
    regs and then gets called...That's nothing close to it's prototype).

2. -msoft-quad-float with -msoft-float produces code that isn't right either.
   It doesn't use any float at least but the setup for _Qp_add in the code
   I'm testing with reuses incorrectly one of the call regs.

So I could check in the code (it pulls in just enough softfloat for 128 bit
support without setting SOFTFLOAT_FOR_GCC) and that would make perl go but it's
gonna core if any of these routines actually get called.

gcc 3.0 fixes most of this so I'm looking into it to see what I can pull back.

James


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