public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Magnus Fromreide <magfr@lysator.liu.se>
Cc: x32-abi@googlegroups.com, discuss@x86-64.org,
		GCC Development <gcc@gcc.gnu.org>,
	Binutils <binutils@sourceware.org>,
		GNU C Library <libc-alpha@sourceware.org>,
	GDB <gdb@sourceware.org>
Subject: Re: [x86-64 psABI] RFC: Extend x86-64 psABI to support x32
Date: Wed, 27 Jun 2012 18:29:00 -0000	[thread overview]
Message-ID: <CAMe9rOqGhJBOOqtX3CzyOFdeii=5809jiK=5pkwt7SBYSE2VsA@mail.gmail.com> (raw)
In-Reply-To: <1340821451.5127.11.camel@sara>

On Wed, Jun 27, 2012 at 11:24 AM, Magnus Fromreide <magfr@lysator.liu.se> wrote:
> On Wed, 2012-06-27 at 05:01 -0700, H.J. Lu wrote:
>> On Tue, Jun 26, 2012 at 10:56 PM, Mark Butler <butlerm@middle.net> wrote:
>> >
>> >
>> > On Tuesday, June 26, 2012 3:22:45 PM UTC-6, H.J. wrote:
>> >>
>> >> On Tue, Jun 26, 2012 at 2:11 PM, Mark Butler wrote:
>> >> >
>> >> >> x32 is designed to replace ia32 where long is 32-bit, not x86-64.
>> >> >>
>> >> > I understand, but wouldn't L64P32 be much better in the long run? In
>> >> > terms
>> >> > of compatibility with LP64, and an LP64 kernel in particular?  The
>> >> > structure
>> >> > layouts of any structure that did not contain pointers would be
>> >> > identical,
>> >> > for example.  struct timeval, struct timespec, struct stat, and on and
>> >> > on...
>> >>
>> >> Linux/x32 uses the same layout for struct timeval, struct timespec, struct
>> >> stat,
>> >> as Linux/x86-64. It is orthogonal to L64 vs L32.
>> >>
>> > If POSIX requires struct timespec to look like this:
>> >
>> > struct timespec {
>> >   time_t tv_sec;
>> >   long   tv_nsec;
>> > }
>> >
>> > then how can an ABI with 32 bit longs have the same struct timespec layout
>> > as an ABI with 64 bit longs?
>> >
>>
>> We changed it to
>>
>> struct timespec
>>   {
>>     __time_t tv_sec;          /* Seconds.  */
>>     __syscall_slong_t tv_nsec;        /* Nanoseconds.  */
>>   };
>>
>
> I think that means you fails to conform to posix unless
> __syscall_slong_t is an alias for long.

That is true.

> If I understand the posix spec correctly then, in a conforming
> implementation,
>
> struct timespec ts;
> if (sizeof(long) != sizeof(ts.tv_nsec))
>  abort();
>
> never calls abort.

It will abort on x32.

> For your purpose it would have been much better if tv_nsec had been
> specified with a type with allowed values, similarly to how suseconds_t
> that is used for timeval.tv_usec is specified.
>
> I suppose this is something to bring up for posix-next.
>

Yes, that is the intention.


-- 
H.J.

      reply	other threads:[~2012-06-27 18:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 17:31 H.J. Lu
2012-05-14 17:34 ` H. Peter Anvin
2012-05-14 17:44   ` H.J. Lu
2012-05-15 16:08     ` [discuss] " Michael Matz
2012-05-15 16:18       ` H.J. Lu
2012-05-17 19:50       ` H.J. Lu
     [not found] ` <ccd4a6ab-f279-477f-b48b-94b8f4afd37d@googlegroups.com>
2012-06-26 19:48   ` H.J. Lu
2012-06-26 19:53     ` H. Peter Anvin
     [not found]       ` <af4adaed-508a-439f-92db-21d4385d316e@googlegroups.com>
2012-06-28 21:06         ` H. Peter Anvin
     [not found]     ` <69b1606d-6150-46eb-a426-93bfad19e7a2@googlegroups.com>
2012-06-26 21:23       ` H.J. Lu
     [not found]         ` <bde2af16-b04e-4e17-a22e-3fe0941e2496@googlegroups.com>
2012-06-27 12:02           ` H.J. Lu
2012-06-27 18:24             ` Magnus Fromreide
2012-06-27 18:29               ` H.J. Lu [this message]

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='CAMe9rOqGhJBOOqtX3CzyOFdeii=5809jiK=5pkwt7SBYSE2VsA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=discuss@x86-64.org \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    --cc=libc-alpha@sourceware.org \
    --cc=magfr@lysator.liu.se \
    --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).