From: u-igbb@aetey.se
To: musl@lists.openwall.com
Subject: variadic args (was: [musl] compiling musl on x86_64 linux with pcc)
Date: Wed, 27 Aug 2014 10:52:54 +0200 [thread overview]
Message-ID: <20140827085254.GJ12376@example.net> (raw)
In-Reply-To: <20140827075407.GL12888@brightrain.aerifal.cx>
On Wed, Aug 27, 2014 at 03:54:07AM -0400, Rich Felker wrote:
> > I am possibly not realizing some crucial bit but I do not see why the
> > implementation of stdarg.h must be the business of the library. If the
>
> Because other headers need to know how to get va_list defined for use
> in function prototypes, and they can't include stdarg.h because it
> would expose more than they want. glibc handles this by making use of
I guess this is the matter which everything revolves around.
What is it that stdarg.h would expose too much?
> a special inclusion protocol between the glibc headers and the gcc
> headers: it defines a special macro before including stdarg.h telling
> gcc that it just wants the definition of va_list and nothing else.
Wonder whether it would be reasonable to say that musl expects from
every compiler to be used with the library either
a stdarg.h with following properties: ...
<which ones?>
otherwise expecting the compiler to implement the following builtins:
<the current contents of musl's stdarg.h>
I do not see how this would hurt in any way.
By the way, this - in any case - *is* an interface against the compiler.
As a matter of fact, the bultins naming differs between compilers.
So the current musl approach is to just boldly assume a *certain*
relatively arbitrary interface, not "the only possible" nor "the only
reasonable one".
> > A compiler used *together* with the library may lack the builtins but it
> > still can be fully compatible even if in some situations less efficient.
>
> No, it can't. There is simply no way to express, in C, the concept of
> "get the next variadic argument" without __builtin_va_arg or something
> 100% equivalent to it. If you have a compiler than chooses to be
Wait, this is not a library busyness, this is something which happens
_inside_ a function. Passing variadic arguments between internal functions
can also be left to the compiler and this should not have to be reflected
in the library's public headers.
I will when I can make an extra round of reading the musl source to
try to see the implications - for the moment the point is evading me.
> Again, this has nothing to do with ABI between external variadic
> functions. It's a matter of the inability to express to the compiler
> what you want it to do (get the next variadic argument) in plain C.
It is of course only the compiler who knows how to do va_arg, but its
internal knowledge can be expressed *either* by __builtin_va_arg *or*
by an include file defining va_arg in a compiler-specific fashion
*or even* by implementing va_arg as a function like tcc does.
I do not argue that not-builtins are "good" but frankly I do not see
how these non-builtins-ways to express the compiler specific details
are contradicting standards or compatibility.
The difference from a builtin is that a definition in a header is "less
opaque", but the preprocessor macros are a natural abstraction layer in
C and are not supposed to be looked behind.
Rune
next prev parent reply other threads:[~2014-08-27 8:52 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 9:18 compiling musl on x86_64 linux with ppc u-igbb
2014-08-13 9:29 ` "pcc" of course ([musl] compiling musl on x86_64 linux with ppc) u-igbb
2014-08-13 9:49 ` compiling musl on x86_64 linux with ppc Szabolcs Nagy
2014-08-13 10:25 ` compiling musl on x86_64 linux with pcc u-igbb
2014-08-13 11:22 ` u-igbb
2014-08-13 11:53 ` summary: [musl] " u-igbb
2014-08-13 12:38 ` compiling musl on x86_64 linux with ppc Rich Felker
2014-08-13 12:56 ` u-igbb
2014-08-13 14:23 ` Rich Felker
2014-08-13 14:43 ` compiling musl on x86_64 linux with pcc u-igbb
2014-08-13 14:43 ` compiling musl on x86_64 linux with ppc Szabolcs Nagy
2014-08-14 7:10 ` compiling musl on x86_64 linux with pcc u-igbb
2014-08-14 14:20 ` Rich Felker
2014-08-14 14:38 ` u-igbb
2014-08-14 14:47 ` Rich Felker
2014-08-14 15:00 ` u-igbb
2014-08-15 10:49 ` va_list (was: [musl] compiling musl on x86_64 linux with pcc) u-igbb
2014-08-15 13:44 ` Rich Felker
2014-08-15 15:07 ` u-igbb
2014-08-15 15:56 ` Rich Felker
2014-08-15 17:12 ` u-igbb
2014-08-15 8:05 ` compiling musl on x86_64 linux with ppc u-igbb
2014-08-25 8:28 ` compiling musl on x86_64 linux with pcc u-igbb
2014-08-25 8:34 ` u-igbb
2014-08-25 15:46 ` Rich Felker
2014-08-26 19:34 ` u-igbb
2014-08-26 19:54 ` Rich Felker
2014-08-27 7:40 ` u-igbb
2014-08-27 7:54 ` Rich Felker
2014-08-27 8:52 ` u-igbb [this message]
2014-08-27 16:34 ` variadic args (was: [musl] compiling musl on x86_64 linux with pcc) Rich Felker
2014-08-28 8:13 ` u-igbb
2014-08-28 14:40 ` Rich Felker
2014-08-28 16:55 ` u-igbb
2014-08-27 14:38 ` compiling musl with pcc (i486-pc-linux-gnu) " u-igbb
2014-08-27 16:36 ` Rich Felker
2014-09-23 19:05 ` compiling musl on x86_64 linux with pcc u-igbb
2014-09-23 19:31 ` Rich Felker
2014-09-24 8:26 ` u-igbb
2014-08-13 23:39 ` compiling musl on x86_64 linux with ppc Isaac Dunham
2014-08-13 23:41 ` 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=20140827085254.GJ12376@example.net \
--to=u-igbb@aetey.se \
--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).