From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] split __libc_start_main.c into two files (Wasm)
Date: Mon, 18 Dec 2017 20:08:30 -0500 [thread overview]
Message-ID: <20171219010830.GQ1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <VI1PR0502MB3885B06479F77BAC57CD9213E7080@VI1PR0502MB3885.eurprd05.prod.outlook.com>
On Sat, Dec 16, 2017 at 01:21:39PM +0000, Nicholas Wilson wrote:
> On 15 December 2017 17:56, Rich Felker wrote:
> > Adding a new interface boundary/contract for a particular arch _is_ a
> > big request, one of the biggest types. It's a permanent added
> > constraint that has to be considered in future modifications to the
> > code. Probably the only bigger type is adding a new public (to
> > application) interface boundary/contract.
>
> Thanks for clarifying, I understand now. In our fork/branch, we will
> have to call *something* on Wasm, since initialisation is different
> to ELF and the default crt1.c doesn't really work for non-ELF archs.
>
> For your information, what we'll do is call __init_libc directly
> from crt/wasm/crt1.c, since for the time being we need to do that to
> keep the prototype working. It would be nice if that were to become
> an accepted internal Musl interface, so that becomes "legal".
>
> (I have though reverted the split into two files of __libc_start_main.c.)
I still don't see any good reason to call __init_libc instead of
__libc_start_main. While the crt1 entry point (_start) itself is a not
a normal C function but something specific to the ELF entry
conventions, __libc_start_main is a perfectly good C function that is
not "ELF specific". It does require a pointer to the args/environment
formatted as an array of:
{ argc, argv[0], ..., argv[argc-1], 0, environ[0], ..., 0,
auxv[0], ... 0 }
but __init_libc and other code in musl also requires such an array to
be present. I really don't think you're gaining anything by bypassing
__libc_start_main, but you are losing the property of interfacing with
a stable interface that will never change out from under you.
Rich
next prev parent reply other threads:[~2017-12-19 1:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 14:51 Nicholas Wilson
2017-12-07 17:03 ` Rich Felker
2017-12-15 4:19 ` Rich Felker
2017-12-15 11:34 ` Nicholas Wilson
2017-12-15 12:33 ` Szabolcs Nagy
2017-12-15 13:04 ` Nicholas Wilson
2017-12-15 17:23 ` Rich Felker
2017-12-15 17:43 ` Nicholas Wilson
2017-12-15 17:56 ` Rich Felker
2017-12-16 13:21 ` Nicholas Wilson
2017-12-19 1:08 ` Rich Felker [this message]
2017-12-19 11:04 ` Nicholas Wilson
2017-12-19 15:27 ` Szabolcs Nagy
2017-12-19 15:56 ` Rich Felker
2017-12-19 17:46 ` Nicholas Wilson
2017-12-19 17:54 ` Alexander Monakov
2017-12-19 18:03 ` Nicholas Wilson
2017-12-19 21:03 ` 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=20171219010830.GQ1627@brightrain.aerifal.cx \
--to=dalias@libc.org \
--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).