[xproto: PATCH] Xmd.h: amd64-x32 ABI defines sizeof(long) == sizeof (void*) == 4

Lu, Hongjiu hongjiu.lu at intel.com
Wed Dec 28 06:34:09 PST 2011


__AMD64__ is defined when 64bit x86 instruction set is used,
which is true for x32. The difference is x32 doesn't define
__LP64__.

H.J.


> -----Original Message-----
> From: Alan Coopersmith [mailto:alan.coopersmith at oracle.com]
> Sent: Wednesday, December 21, 2011 11:33 AM
> To: Sergei Trofimovich
> Cc: Lu, Hongjiu; xorg-devel at lists.x.org
> Subject: Re: [xproto: PATCH] Xmd.h: amd64-x32 ABI defines sizeof(long) ==
> sizeof (void*) == 4
> 
> On 12/21/11 09:24, Sergei Trofimovich wrote:
> > What do you think of changing predefined __amd64__ define in gcc to
> something
> > distinct?
> >
> > If it's not an option, how about adding one more define for those who like
> to check
> > for this exact feature on all compilers (and not only gcc)?
> >
> > So thread start's use case would look like
> >
> >      -#if defined(__amd64__)
> >      -#    define LONG64
> >      -#endif
> >      +#if defined(__amd64__)&&  !defined(__amd64_x32__)
> >      +#    define LONG64
> >      +#endif
> >
> > which would be less fragile for existing compilers.
> 
> The correct thing to do would be to never define __amd64__ if you are not
> building software using the characteristics tons of existing software
> associate
> with __amd64__ - almost all C code using this cares about the pointer sizes
> you're redefining - it doesn't care about the number of registers or other
> attributes not visible at the C source code level.
> 
> That would result in no patch to X or thousands of other programs.
> 
> --
> 	-Alan Coopersmith-        alan.coopersmith at oracle.com
> 	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list