----Original Message----
>From: Dave Murphy
>Sent: 20 July 2005 11:21

> I've been having some trouble building gcc 4.0.1 for mips target on a
> mingw host

  No you aren't.  You're using a modified version of the gcc-4.0.1 sources
and you're targetting PSP.  That may be a MIPS backend, but it's a different
_target_.

> Reading specs from c:/projects/devkitPro/sources/psp/gcc/gcc/specs
> Target: psp
> Configured with: ../../gcc-4.0.1-new/configure --enable-languages=c,c++
> --disable-multilib --with-gcc --with-gnu-ld --with-gnu-as --with-stabs
> --disable-shared --disable-win32-registry --disable-nls
> --enable-cxx-flags=-G0 --target=psp --with-newlib

  There's no such thing in FSF gcc (unless it was sneaked in just after
RC2...):

[EMAIL PROTECTED] /gnu/testing/psp> /gnu/testing/gcc-4.0.1-20050702/configure
--enable-la
nguages=c --target=psp
creating cache ./config.cache
checking host system type... i686-pc-cygwin
checking target system type... Invalid configuration `psp': machine `psp'
not recognized

> The same build process works fine on linux and I've compared output. The
> preprocessed source is identical barring paths. The assembly output
> differs only in the function prologue
> 
> on mingw built compiler
> 
> __muldi3:
>     .frame    $sp,0,(null)        # vars= 7640055, regs= 0/0, args= 0,
                      ^^^^^^                 ^^^^^^
                   This is very bad.        This is even worse.

  Stack frame generation / layout is going wrong if it thinks __muldi3 needs
seven and a bit megs of stack.  However, perhaps that's not the correct
number for how much it actually does think it wants.

> can anyone point me in the right direction? I'm not quite sure what I
> should be looking for.

  You're looking for gcc to be calling *printf and passing a NULL argument
to a %s format character, basically.  Whatever patches you have applied must
be faulty.  The bad call is in gcc/config/mips/mips.c
(mips_output_function_prologue):

  if (!flag_inhibit_size_directive)
    {
      /* .frame FRAMEREG, FRAMESIZE, RETREG */
      fprintf (file,
               "\t.frame\t%s," HOST_WIDE_INT_PRINT_DEC ",%s\t\t"
               "# vars= " HOST_WIDE_INT_PRINT_DEC ", regs= %d/%d"
               ", args= " HOST_WIDE_INT_PRINT_DEC
               ", gp= " HOST_WIDE_INT_PRINT_DEC "\n",
               (reg_names[(frame_pointer_needed)
                          ? HARD_FRAME_POINTER_REGNUM :
STACK_POINTER_REGNUM]),
               ((frame_pointer_needed && TARGET_MIPS16)
                ? tsize - cfun->machine->frame.args_size
                : tsize),
               reg_names[GP_REG_FIRST + 31],
               cfun->machine->frame.var_size,
               cfun->machine->frame.num_gp,
               cfun->machine->frame.num_fp,
               cfun->machine->frame.args_size,
               cfun->machine->frame.cprestore_size);

  Hmm.  Perhaps we have HOST_WIDE_INT problems for mingw host here?  If
cfun->machine->frame.var_size was a long long, and HOST_WIDE_INT_PRINT_DEC
for mingw is just "%d" or "%ld" rather than "%lld", that would push an extra
NULL word onto the stack that would be taken as the parameter for %s because
the "%d" wouldn't be advancing the varargs pointer past the whole of the
second format arg...

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

Reply via email to