mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: [PATCH 2/3] Have different definitions of __pthread_tsd_main agree in size
Date: Mon, 11 Feb 2013 14:38:08 +0100	[thread overview]
Message-ID: <1360589888.9132.104.camel@eris.loria.fr> (raw)
In-Reply-To: <20130211130906.GE6181@port70.net>

[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]

Am Montag, den 11.02.2013, 14:09 +0100 schrieb Szabolcs Nagy:
> i've just tried it and the .a just got bigger
> and size reports minimal difference probably
> due to alignment differences, which does not matter
> 
> $ size libc.a.sections |awk '{s+=$4}END{print s}'
> 410638
> $ size libc.a |awk '{s+=$4}END{print s}'
> 410698

yes, for musl it probably isn't a big deal, because musl is basically
already divided in one compilation unit per function. As I said, the
only unused sections that drop out are those for the weak aliases that
finally have their real symbol linked in.

For other libraries that define weak symbols that are not needed later
this is more relevant. With P99 I have the opposite position to musl
(sort of). Everything are inline functions if possible (so they don't
even define a symbol) only some functions have to be weak because they
access to some static data or use setjmp. (P99 doesn't even have a
libp99.a or libp99.so file).

With the gc-section trick I can suck out the unused symbols from the
executable at the end.

> > The only real problem I have for libmusl.so is "environ", as of my
> > other patch. There is probably a good reason that this is made
> > weak. But why must it be realized as an alias? Wouldn't it be
> > sufficient to just have it as a weak symbol? something like
> > 
> > // implementation header file
> > extern char **__environ __attribute__((__weak ));
> > 
> > //__environ.c
> > char **environ __attribute__((__weak )) = 0;
> > weak_alias(environ, ___environ);
> > weak_alias(environ, __environ);
> > weak_alias(environ, _environ);
> > 
> 
> there are posix requirements for environ so it must be weak
> i'm not sure about the alias though

Anyhow the use of environ versus __environ was just not consistent
through the rest of musl. I have send another patch that should heal
that.

But thinking of it, I am not sure that the way that is done makes any
sense. If the reason to have environ weak is that the user code could
supply its own environ object, then the use of __environ all over musl
will certainly break things. Then environ and __environ could be two
different objects and the application code and musl would not be
consistent in their access to the environment.

Jens

-- 
:: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/   ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090   ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536   ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183   ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-02-11 13:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 22:32 Jens Gustedt
2013-02-11  0:31 ` Rich Felker
2013-02-11  7:40   ` Jens Gustedt
2013-02-11 11:22     ` Szabolcs Nagy
2013-02-11 12:08       ` Szabolcs Nagy
2013-02-11 12:51         ` Jens Gustedt
2013-02-11 13:09           ` Szabolcs Nagy
2013-02-11 13:38             ` Jens Gustedt [this message]
2013-02-11 13:44               ` Rich Felker
2013-02-11 14:07                 ` Jens Gustedt
2013-02-11 14:39                   ` Szabolcs Nagy
2013-02-11 16:30                     ` Jens Gustedt
2013-02-11 17:08                       ` Szabolcs Nagy
2013-02-11 17:21                         ` Jens Gustedt
2013-02-11 21:49                           ` Rich Felker
2013-02-11 21:47                   ` Rich Felker
2013-02-11 21:50                     ` 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=1360589888.9132.104.camel@eris.loria.fr \
    --to=jens.gustedt@inria.fr \
    --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).