From: Dan Gohman <sunfish@mozilla.com>
To: musl@lists.openwall.com
Subject: Re: size_t and int64_t on a new platform
Date: Thu, 31 Mar 2016 17:35:11 -0700 [thread overview]
Message-ID: <CACcSVPGh0pL2b1LZAuB-u+87yCrKTLcsVDYvS5z1bSN+ga=TCw@mail.gmail.com> (raw)
In-Reply-To: <20160331192518.GW21636@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
On Thu, Mar 31, 2016 at 12:25 PM, Rich Felker <dalias@libc.org> wrote:
> On Thu, Mar 31, 2016 at 11:20:22AM -0700, Dan Gohman wrote:
> > I'm working on a new architecture (WebAssembly, aka wasm) and am hoping
> to
> > have a compatible ABI at the level of a "freestanding implementation"
> > between all libc ports.
> >
> > The current design would translate into the following in a musl port (in
> > ..../bits/alltypes.h.in):
> >
> > #define _Addr long
> > #define _Int64 long long
> >
> > Both the ILP32 and LP64 platform variants would use the same definitions.
> > This helps minimize differences between the two variants, which aligns
> with
> > an overall goal of the platform.
> >
> > However, this differs from musl's convention of using "int" for _Addr on
> > ILP32 systems and using "long" for _Int64 on LP64 systems. But, as far
> as I
> > can tell, no musl code actually depends on this convention. Almost all
> code
> > in musl is either fully portable and can't, or is architecture-specific
> and
> > can just do the right thing for its own architecture.
> >
> > Legacy code may have assumptions, though I'm aware of the issues and
> don't
> > believe it's a significant practical problem for WebAssembly.
> >
> > If we decide to contribute wasm support upstream to the musl project in
> the
> > future, would the musl maintainers expect to be ok with the above
> > definitions?
>
> At some point we'll probably have to make this relaxation anyway. I've
> heard there's at least one arch we're planning to add (maybe
> powerpc64? I forget) that's using long instead of int for _Addr types.
> What would be most helpful to us (to keep things simple) is just
> ensuring that all the relevant types (size_t, ssize_t, ptrdiff_t,
> [u]intptr_t, etc.) are defined consistently as int or as long;
> otherwise we have to pop a hole in the abstraction they're modeled
> with now. That wouldn't be a huge problem either but it just adds more
> redundancy to arch/*/bits/alltypes.h.in files.
>
Sounds good. And I agree; size_t, ssize_t, ptrdiff_t, [u]intptr_t, etc.
would all remain consistent with each other.
And to answer the concerns about compilers, I'm also a developer on the
first C/C++ compiler being ported to this platform, so I'll make sure that
the compiler's types agree with those defined in the library headers.
Thanks,
Dan
[-- Attachment #2: Type: text/html, Size: 3166 bytes --]
prev parent reply other threads:[~2016-04-01 0:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 18:20 Dan Gohman
2016-03-31 19:25 ` Rich Felker
2016-03-31 20:10 ` Szabolcs Nagy
2016-03-31 20:23 ` Alexander Monakov
2016-03-31 20:30 ` Rich Felker
2016-04-01 9:16 ` recvmsg/sendmsg broken on mips64 Sebastian Gottschall
2016-04-01 9:49 ` Szabolcs Nagy
2016-04-01 10:29 ` Sebastian Gottschall
2016-04-01 11:31 ` Szabolcs Nagy
2016-04-01 11:37 ` Sebastian Gottschall
2016-04-01 12:21 ` Masanori Ogino
2016-04-01 12:42 ` Sebastian Gottschall
2016-04-01 13:17 ` Szabolcs Nagy
2016-04-02 9:52 ` Sebastian Gottschall
2016-04-07 9:48 ` Szabolcs Nagy
2016-04-07 11:42 ` Sebastian Gottschall
2016-04-07 18:46 ` Szabolcs Nagy
2016-04-07 23:33 ` Sebastian Gottschall
2016-04-10 22:18 ` Rich Felker
2016-04-10 22:24 ` Sebastian Gottschall
2016-04-10 22:29 ` Rich Felker
2016-04-10 22:33 ` Sebastian Gottschall
2016-04-11 2:35 ` Rich Felker
2016-04-11 6:35 ` Sebastian Gottschall
2016-04-11 18:32 ` Rich Felker
2016-04-11 19:01 ` Sebastian Gottschall
2016-04-14 14:10 ` Sebastian Gottschall
2016-04-15 16:19 ` Rich Felker
2016-04-21 1:37 ` Rich Felker
2016-04-21 7:22 ` Sebastian Gottschall
2016-04-21 15:36 ` Rich Felker
2016-04-21 17:16 ` Rich Felker
2016-04-21 19:30 ` Sebastian Gottschall
2016-04-21 19:29 ` Sebastian Gottschall
2016-04-01 0:35 ` Dan Gohman [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='CACcSVPGh0pL2b1LZAuB-u+87yCrKTLcsVDYvS5z1bSN+ga=TCw@mail.gmail.com' \
--to=sunfish@mozilla.com \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).