mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Bits deduplication: current situation
Date: Mon, 25 Jan 2016 22:32:55 +0100	[thread overview]
Message-ID: <20160125213255.GK9621@port70.net> (raw)
In-Reply-To: <20160125210005.GC238@brightrain.aerifal.cx>

* Rich Felker <dalias@libc.org> [2016-01-25 16:00:05 -0500]:
> On Mon, Jan 25, 2016 at 11:22:13AM -0800, Dan Gohman wrote:
> > Concerning stdint.h, there are a few details beyond just 32-bit vs 64-bit.
> > For example, int64_t can be either "long" or "long long" on an LP64 target.
> > The difference usually doesn't matter, but there are things which end up
> > noticing, like C++ name mangling and C format-string checking.
> 
> I'm pretty sure int64_t is long on all LP64 targets we support. Are
> there others that differ?
> 

the convention is to use the smallest rank integer type with the
right range.

there may be other issues, but in general a c compiler does not
need to know these typedefs.

> > GCC >= 4.5 and clang predefine macros providing almost everything stdint.h
> > (and inttypes.h) needs. For example, see the attached file. Would you be
> > interested in a patch which refactors stdint.h to use this approach by
> > default, with a mechanism to support older compilers if needed?
> 
> No, the intent is that the public headers be compatible with basically
> all compilers honoring the ABI, not just gcc and compatible ones.
> There are a very small number of things (documented in the outdated
> manual) that need extensions in the public headers, mainly _Complex_I,
> tgmath.h, and stdarg.h, and in those cases we use the conventions that
> gcc and other existing compilers have created.
> 
> Also it's musl's intent to be explicit with definitions, and this is
> actually helpful with the C++ types issue. IMO it's much better to get
> an error that a new compiler you're trying has the ABI wrong than to
> silently use different types.

note that the patch is wrong for all released versions of gcc (<=5)
because the *fast types are different on musl vs glibc on 64bit arches.
(fwiw newlib defines these types in yet another way)

this is not visible in the libc abi but matters for third-party
code compiled against musl headers and those should be abi
compat no matter what compiler you used.

(with gcc the difference matters if you use the gcc provided stdatomic.h
or use the gfortran c ffi, but then you probably built a gcc
with musl support anyway and then the types are consistent.)


  reply	other threads:[~2016-01-25 21:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  3:59 Rich Felker
2016-01-25  8:08 ` Natanael Copa
2016-01-25 17:17   ` Rich Felker
2016-01-25 10:46 ` Laurent Bercot
2016-01-25 14:56 ` Ward Willats
2016-01-25 15:37   ` Szabolcs Nagy
2016-01-25 19:22 ` Dan Gohman
2016-01-25 21:00   ` Rich Felker
2016-01-25 21:32     ` Szabolcs Nagy [this message]
2016-01-26  5:03       ` Dan Gohman
2016-01-26 10:18         ` Szabolcs Nagy
2016-01-26 15:16           ` Dan Gohman
2016-01-26 20:26             ` Szabolcs Nagy
2016-01-26 20:17         ` Rich Felker

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=20160125213255.GK9621@port70.net \
    --to=nsz@port70.net \
    --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).