[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with library images on Windows (again)

From: Juanma Barranquero
Subject: Re: Problem with library images on Windows (again)
Date: Thu, 19 May 2005 00:44:46 +0200

> That's quite different from the Unix calling conventions on i386, where
> only EAX, ECX and EDX are call-clobbered.

I was wrong wrt the MSVC calling conventions. MSDN docs say:

   All arguments are widened to 32 bits when they are passed.
   Return values are also widened to 32 bits and returned in the
   EAX register, except for 8-byte structures, which are returned
   in the EDX:EAX register pair. Larger structures are returned
   in the EAX register as pointers to hidden return structures.
   Parameters are pushed onto the stack from right to left.

   The compiler generates prolog and epilog code to save and
   restore the ESI, EDI, EBX, and EBP registers, if they are used
   in the function.

so it seems it's the same calling convention than on i386 Unixes: EAX
and EDX can be clobbered to return the function's result, and ECX
because it is not saved.

> That appears like a blatant bug in the compiler if it cannot properly
> track call-clobbered registers.

There's a bug somewhere, that's pretty clear. Whether that's an error
of the MSVC compiler or the MinGW libraries, I'm not sure yet. I've
been tracing lookup_image, and the fact is, the lookup_image code is
using EBX to cache "spec", and rightly so. But the call to tiff_load
(via img->type->load()) clobbers EBX!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]