public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Compiling ctypes (libffi) for Windows Itanium
@ 2010-01-26 19:41 Guy Rozendorn
  2010-01-26 20:27 ` Anthony Green
  0 siblings, 1 reply; 3+ messages in thread
From: Guy Rozendorn @ 2010-01-26 19:41 UTC (permalink / raw)
  To: libffi-discuss


Hi all,

I am trying to build Python 2.6 for Windows Itanium.
I have the IA64 MSVC compiler set up, and so far I managed to build the
entire Python PCBuild project, except for ctypes.

The project of course does not build on its own for IA64 on Windows, since
its missing the appropriate assembly for the libffi part.
Since we’re not familiar at all with itanium assembly, we tried to
workaround it:
• We looked at the existing windows linux assemblies in the project, and
tried to understand what they do
• We wrote some in C that should do pretty much the same, and compiled
ctypes with that
• It compiled without a too much hassle, but it didn’t work out (python
crashes when using ctypes on itanium)

So, my questions are:
• Does someone successfully compiled ctypes for Windows IA64? Or have
another lead for us?
• It looks like that a compiler wrote the linux-ia64 assembly, and not a
human being. But we didn’t find the original C code of that in the project.
We hope that if we find the original C code, we can hack it a bit to also
compile and work on windows-ia64.
o  Does someone know who the linux-ia64 assembly code was generated? From
which source? And who wrote it?


Any help would be greatly appreciated!

Thanks,

- Guy



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Compiling ctypes (libffi) for Windows Itanium
  2010-01-26 19:41 Compiling ctypes (libffi) for Windows Itanium Guy Rozendorn
@ 2010-01-26 20:27 ` Anthony Green
  2010-01-29  1:09   ` Boehm, Hans
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Green @ 2010-01-26 20:27 UTC (permalink / raw)
  To: libffi-discuss, GUYROZ; +Cc: Hans_Boehm

On 01/26/2010 02:41 PM, Guy Rozendorn wrote:
> Hi all,
>
> I am trying to build Python 2.6 for Windows Itanium.
> I have the IA64 MSVC compiler set up, and so far I managed to build the
> entire Python PCBuild project, except for ctypes.
>
> The project of course does not build on its own for IA64 on Windows, since
> its missing the appropriate assembly for the libffi part.
> Since weÂ’re not familiar at all with itanium assembly, we tried to
> workaround it:
> • We looked at the existing windows linux assemblies in the project, and
> tried to understand what they do
> • We wrote some in C that should do pretty much the same, and compiled
> ctypes with that
> • It compiled without a too much hassle, but it didn’t work out (python
> crashes when using ctypes on itanium)
>
> So, my questions are:
> • Does someone successfully compiled ctypes for Windows IA64? Or have
> another lead for us?
> • It looks like that a compiler wrote the linux-ia64 assembly, and not a
> human being.

I'm pretty sure it was human-generated.

>   But we didnÂ’t find the original C code of that in the project.
>    

The reason that libffi contains so much assembly code, is that it's 
impossible to implement the libffi magic in C.


> We hope that if we find the original C code, we can hack it a bit to also
> compile and work on windows-ia64.
> o  Does someone know who the linux-ia64 assembly code was generated? From
> which source? And who wrote it?
>    

Unless you're looking at a different source code than me, you'll notice 
that it lists Hans Boehm from HP as the author of the IA-64 Linux port.


>
> Any help would be greatly appreciated!
>
> Thanks,
>
> - Guy
>
>
>    


Good luck!


Anthony Green

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Compiling ctypes (libffi) for Windows Itanium
  2010-01-26 20:27 ` Anthony Green
@ 2010-01-29  1:09   ` Boehm, Hans
  0 siblings, 0 replies; 3+ messages in thread
From: Boehm, Hans @ 2010-01-29  1:09 UTC (permalink / raw)
  To: Anthony Green, libffi-discuss, GUYROZ

 

> -----Original Message-----
> From: Anthony Green [mailto:green@redhat.com] 
> Sent: Tuesday, January 26, 2010 12:27 PM
> To: libffi-discuss@sourceware.org; GUYROZ@il.ibm.com
> Cc: Boehm, Hans
> Subject: Re: Compiling ctypes (libffi) for Windows Itanium
> 
> On 01/26/2010 02:41 PM, Guy Rozendorn wrote:
> > Hi all,
> >
> > I am trying to build Python 2.6 for Windows Itanium.
> > I have the IA64 MSVC compiler set up, and so far I managed to build 
> > the entire Python PCBuild project, except for ctypes.
> >
> > The project of course does not build on its own for IA64 on 
> Windows, 
> > since its missing the appropriate assembly for the libffi part.
> > Since we're not familiar at all with itanium assembly, we tried to 
> > workaround it:
> > * We looked at the existing windows linux assemblies in the 
> project, 
> > and tried to understand what they do * We wrote some in C 
> that should 
> > do pretty much the same, and compiled ctypes with that * It 
> compiled 
> > without a too much hassle, but it didn't work out (python 
> crashes when 
> > using ctypes on itanium)
> >
> > So, my questions are:
> > * Does someone successfully compiled ctypes for Windows 
> IA64? Or have 
> > another lead for us?
> > * It looks like that a compiler wrote the linux-ia64 
> assembly, and not 
> > a human being.
> 
> I'm pretty sure it was human-generated.
As Anthony said, I originally wrote much of this, a very long time ago.  But I think it has been substantially improved by others since then.

Since this code has to copy things in and out of registers defined by the calling convention, I also agree with Anthony that there is unlikely to be any robust way to do this in C, even if you can explicitly specify registers for variables.

I don't know how different the Windows calling conventions are from the *nix ones.  If they are basically the same, it seems to me that the correct path would be to transalate the assembler code to the Windows syntax, assuming that's different.  I can't immediately think of a reason that they would be very different, especially since there doesn't seem to be much of a dependency on sizeof(long) the way this is written.

Hans

> 
> >   But we didn't find the original C code of that in the project.
> >    
> 
> The reason that libffi contains so much assembly code, is 
> that it's impossible to implement the libffi magic in C.
> 
> 
> > We hope that if we find the original C code, we can hack it 
> a bit to also
> > compile and work on windows-ia64.
> > o  Does someone know who the linux-ia64 assembly code was 
> generated? From
> > which source? And who wrote it?
> >    
> 
> Unless you're looking at a different source code than me, 
> you'll notice 
> that it lists Hans Boehm from HP as the author of the IA-64 
> Linux port.
> 
> 
> >
> > Any help would be greatly appreciated!
> >
> > Thanks,
> >
> > - Guy
> >
> >
> >    
> 
> 
> Good luck!
> 
> 
> Anthony Green
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-29  1:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-26 19:41 Compiling ctypes (libffi) for Windows Itanium Guy Rozendorn
2010-01-26 20:27 ` Anthony Green
2010-01-29  1:09   ` Boehm, Hans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).