public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: libc-alpha@sourceware.org, GCC Development <gcc@gcc.gnu.org>,
		LKML <linux-kernel@vger.kernel.org>,
	x32-abi@googlegroups.com
Subject: Re: X32 psABI status update
Date: Mon, 21 Mar 2011 05:35:00 -0000	[thread overview]
Message-ID: <AANLkTikSJDGEWCqazvAKHUC8_MoOP-+vyFOjyCmrA9dL@mail.gmail.com> (raw)
In-Reply-To: <201103210108.49780.vapier@gentoo.org>

On Sun, Mar 20, 2011 at 10:08 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Thursday, March 17, 2011 01:21:16 H.J. Lu wrote:
>> On Wed, Mar 16, 2011 at 7:57 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> > in looking at the gcc files, it doesnt seem like there's any defines
>> > setup to declare x32 directly.  instead, you'd have to do something
>> > like: #ifdef __x86_64__
>> > # if __SIZEOF_LONG__ == 8
>> > /* x86_64 */
>> > # else
>> > /* x32 */
>> > # endif
>> > #endif
>> >
>> > any plans on adding an __x32__ (or whatever) cpp symbol to keep people
>> > from coming up with their own special/broken crap ?  or are there some
>> > already that i'm not seeing ?
>>
>> The idea is in most cases, you only need to check __x86_64__ since x32 and
>> x86-64 are very close.  In some cases, x32 is very different from x86_64,
>> like assembly codes on long and pointer, you can check __x86_64__ and
>> __LP64__. In glibc, I used a different approach by using macros REG_RAX,
>> .., MOV_LP, ADD_LP, SUB_LP and CMP_LP in assembly codes.
>
> while i agree with you in general that this is how people should be doing
> things, in practice i often see people fishing around.  education only goes so
> far, so if there was an __x32__ define, i feel like people are more likely to
> get it right than wrong.
>
> i dont have any use cases off the top of my head, but i wouldnt be surprised
> if the heavy inline assembly people (like the multimedia peeps e.g. libav)
> approached it this way.  rather than google for documentation, look at the cpp
> output between -m64 and -mx32 and see what sticks out.  "__x32__" would
> certainly do that.

My point is __x86_64__ version should work for both 64bit and x32. There should
no need for a separate x32 version.


-- 
H.J.

  reply	other threads:[~2011-03-21  5:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05 19:08 H.J. Lu
2011-03-06 17:29 ` H.J. Lu
2011-03-07 21:33 ` Mike Frysinger
2011-03-16  4:17   ` H.J. Lu
2011-03-16  4:30     ` Mike Frysinger
2011-03-16  4:51       ` H.J. Lu
2011-03-16  5:24         ` Mike Frysinger
2011-03-16 12:40           ` H.J. Lu
2011-03-17  2:57             ` Mike Frysinger
2011-03-17  5:21               ` H.J. Lu
2011-03-17  5:45                 ` Mike Frysinger
2011-03-17 14:43                   ` H.J. Lu
2011-03-17 17:38                 ` Richard Henderson
2011-03-21  5:09                 ` Mike Frysinger
2011-03-21  5:35                   ` H.J. Lu [this message]
2011-03-21  5:53                     ` Mike Frysinger
2011-03-21  6:55                       ` H.J. Lu
2011-03-21  8:20                         ` Michael Matz
2011-03-21 10:52                           ` H.J. Lu
     [not found]         ` <201103160124.42939.vapier__14164.6524928094$1300277836$gmane$org@gentoo.org>
2011-03-16 12:40           ` Andreas Schwab
2011-03-16  4:19 ` H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
2011-02-17 11:04 x32 " H.J. Lu
2011-02-19 20:57 ` H.J. Lu
2011-02-19 22:01   ` H.J. Lu
     [not found]     ` <AANLkTikkpK9ouXckHaVzwXe+p_Cz2hVH5T7xOoQL7OSE@mail.gmail.com>
2011-02-19 22:52       ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikSJDGEWCqazvAKHUC8_MoOP-+vyFOjyCmrA9dL@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vapier@gentoo.org \
    --cc=x32-abi@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).