public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Size of long in x64 Windows based binutils?
@ 2007-09-05 14:47 Jerker Bäck
  2007-09-07 14:47 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Jerker Bäck @ 2007-09-05 14:47 UTC (permalink / raw)
  To: binutils

Greetings all,
I wonder how you treat the long type in 64bit binutils and keep
compatibility between Windows-based and unix-based environments. Size of
long is 4 in Windows (LLP64 model) and 8 for systems with LP64. Interix is
Windows-based but use the LP64 model. Since longs in official structures
regarding PE are 32bit, fatal mistakes can easily happen if you are on a
LP64 system. Is this taken care of?

Thanks
Jerker Bäck

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

* Re: Size of long in x64 Windows based binutils?
  2007-09-05 14:47 Size of long in x64 Windows based binutils? Jerker Bäck
@ 2007-09-07 14:47 ` Nick Clifton
  2007-09-07 15:43   ` Mayank Kumar
  2007-09-07 15:51   ` Jerker Bäck
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Clifton @ 2007-09-07 14:47 UTC (permalink / raw)
  To: Jerker Bäck; +Cc: binutils

Hi Jerker,

> I wonder how you treat the long type in 64bit binutils and keep
> compatibility between Windows-based and unix-based environments. Size of
> long is 4 in Windows (LLP64 model) and 8 for systems with LP64. Interix is
> Windows-based but use the LP64 model. Since longs in official structures
> regarding PE are 32bit, fatal mistakes can easily happen if you are on a
> LP64 system. Is this taken care of?

It should be.

The configure file in the bfd/ directory should take of detecting if long long 
can be used and the PE data structures are all defined in terms of a fixed 
number of bytes.  (See include/coff/external.h).

Cheers
   Nick

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

* RE: Size of long in x64 Windows based binutils?
  2007-09-07 14:47 ` Nick Clifton
@ 2007-09-07 15:43   ` Mayank Kumar
  2007-09-07 16:19     ` Jerker Bäck
  2007-09-07 15:51   ` Jerker Bäck
  1 sibling, 1 reply; 5+ messages in thread
From: Mayank Kumar @ 2007-09-07 15:43 UTC (permalink / raw)
  To: Nick Clifton, Jerker Bäck; +Cc: binutils

On similar lines, I want to know if there is a 64 bit working implementation of binutils for interix. I mean has anybody tried to port or ported successfully a 64 bit implementation of binutils on Interix.

Thanks
Mayank


-----Original Message-----
From: binutils-owner@sourceware.org [mailto:binutils-owner@sourceware.org] On Behalf Of Nick Clifton
Sent: Friday, September 07, 2007 8:17 PM
To: Jerker Bäck
Cc: binutils@sourceware.org
Subject: Re: Size of long in x64 Windows based binutils?

Hi Jerker,

> I wonder how you treat the long type in 64bit binutils and keep
> compatibility between Windows-based and unix-based environments. Size of
> long is 4 in Windows (LLP64 model) and 8 for systems with LP64. Interix is
> Windows-based but use the LP64 model. Since longs in official structures
> regarding PE are 32bit, fatal mistakes can easily happen if you are on a
> LP64 system. Is this taken care of?

It should be.

The configure file in the bfd/ directory should take of detecting if long long
can be used and the PE data structures are all defined in terms of a fixed
number of bytes.  (See include/coff/external.h).

Cheers
   Nick

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

* RE: Size of long in x64 Windows based binutils?
  2007-09-07 14:47 ` Nick Clifton
  2007-09-07 15:43   ` Mayank Kumar
@ 2007-09-07 15:51   ` Jerker Bäck
  1 sibling, 0 replies; 5+ messages in thread
From: Jerker Bäck @ 2007-09-07 15:51 UTC (permalink / raw)
  To: 'Nick Clifton'; +Cc: binutils

Thanks Nick for answering,
The problem is while it's easy to compile binutils for Interix, the
utilities cannot do anything useful. So there is a configuration problem
somewhere. I basically used the mingw x64 port and thought maybe some
structures that use DWORD were promoted to LP64 longs (long long in 64bit),
which is wrong - they must be 32bit. I don't know if the mingw x64 port use
LP64 but I doubt it since Windows use the LLP64 data model. I found at least
one structure that is conflicting:
include/coff/internal.h(101)
typedef struct _IMAGE_DATA_DIRECTORY 
{
  bfd_vma VirtualAddress;
  long    Size;
}  IMAGE_DATA_DIRECTORY;
Both members are DWORD in the NT headers. Since my bfd_vma and long have a
size of 8, the structure is twice as big as it should be! Can't tell the
impact of this though. It's also tedious to compare the structures because
some seems to be renamed in binutils. I guess it means one need to
completely understand the binutils implementation to actually be able to
correct this (aargh). 

> PE data structures are all defined in terms of a fixed number of bytes.
> (See include/coff/external.h).
OK, they use char- fine!

cheers
Jerker



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

* RE: Size of long in x64 Windows based binutils?
  2007-09-07 15:43   ` Mayank Kumar
@ 2007-09-07 16:19     ` Jerker Bäck
  0 siblings, 0 replies; 5+ messages in thread
From: Jerker Bäck @ 2007-09-07 16:19 UTC (permalink / raw)
  To: 'Mayank Kumar'; +Cc: binutils

> On similar lines, I want to know if there is a 64 bit working
implementation
> of binutils for interix. I mean has anybody tried to port or ported
> successfully a 64 bit implementation of binutils on Interix.
There seems to be very little interest:
http://www.interopcommunity.com/tm.aspx?m=12306


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

end of thread, other threads:[~2007-09-07 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-05 14:47 Size of long in x64 Windows based binutils? Jerker Bäck
2007-09-07 14:47 ` Nick Clifton
2007-09-07 15:43   ` Mayank Kumar
2007-09-07 16:19     ` Jerker Bäck
2007-09-07 15:51   ` Jerker Bäck

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).