mailing list of musl libc
 help / color / mirror / code / Atom feed
From: u-igbb@aetey.se
To: musl@lists.openwall.com
Subject: Re: va_list (was: [musl] compiling musl on x86_64 linux with pcc)
Date: Fri, 15 Aug 2014 19:12:31 +0200	[thread overview]
Message-ID: <20140815171231.GE5170@example.net> (raw)
In-Reply-To: <20140815155656.GQ12888@brightrain.aerifal.cx>

On Fri, Aug 15, 2014 at 11:56:56AM -0400, Rich Felker wrote:
> > Testing... I can compile with tcc a file calling printf, link
> > with musl and successfully run it. Nice!
> > 
> > (Hmm, bits/alltypes defines ...va_list "instead of including stdarg.h",
> > I guess it could be made to include, guarded by some #if defined() ?
> 
> No, this is the nasty gcc way which precludes the compiler from
> optimizing out multiple inclusions of the same header file, and which
> requires the libc headers and headers provided by the compiler to be
> aware of each other's implementation details, which is not really
> appropriate.

Fine with me, it is just a matter to teach tcc to implicitly include its
stdarg.h.

> > Besides this detail, it was apparently just a matter of wrapping tcc
> > with "-I<where-the-tcc-stdarg.h-alone-lives> \
> >       -D__DEFINED_va_list \
> >       -D__isoc_va_list=va_list \
> >       -D__DEFINED___isoc_va_list"
> > (this part is of course not of concern for musl, besides preserving the
> > possibility to externally define the types, in a compiler-specific stdarg.h)
> 
> This is not supported usage with musl.

Surely, I am using the internal details which is bad - it would be
nice if musl would allow a cleaner way of doing a corresponding
hook.

> > I think this is a correct approach which makes musl usable with
> > more compilers than otherwise.
> 
> Only tcc, and tcc really just needs to be fixed in this regard. All

This of course would be the best solution - but tcc is as it is, with
the limitations and the nice properties. I'd like to be able to use it,
or if anybody hacks a differently nice / differently bad compiler,
to be able to use it too.

This does not look like putting any constraints on musl efficienly or
correctness - the only thing which is necessary is a (possibly even
musl-version-dependent) way to skip/replace the va-definitions. I think
it is no practical problem, good enough, unless you decide to radically
change the implementation.

> the other compilers do it right already. It would not be hard to add
> the builtins and have them do the right thing, and this is essentially
> needed for x86_64 anyway -- the current approach of calling external
> functions is totally inappropriate since the generated .o files are
> not compatible with the ABI (which does not define such external
> functions) and cannot be successfully linked by non-tcc toolchains.

Hmm. Yes that's right (non-tcc-"aware" toolchains that is - no problem
to arrange non-tcc linking to work, but you can not give such object files
to others to link...). To be compatible, a compiler-specific implementation
must be effectively inlined in every .o file, which tcc does not do
(and which builtins of course do, but they are nevertheless not the only
valid solution - even though they seem to be a good one :)

Thanks for clearing the matter!

Rune



  reply	other threads:[~2014-08-15 17:12 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 [this message]
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                     ` variadic args (was: [musl] compiling musl on x86_64 linux with pcc) u-igbb
2014-08-27 16:34                       ` 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=20140815171231.GE5170@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).