mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Aidan Hobson Sayers <aidanphs@gmail.com>
Subject: Re: Regarding whole-archive linking libc.a into a shared lib
Date: Thu, 14 Jul 2016 13:43:52 +0200	[thread overview]
Message-ID: <20160714114352.GN19691@port70.net> (raw)
In-Reply-To: <CA+Sb0Hd2KfaYnpqASvwxzXNJ5wVR9bXufrpvmRLtrNpMy5=eMg@mail.gmail.com>

* Jason Ramapuram <jason.ramapuram@gmail.com> [2016-07-14 12:49:31 +0200]:
> Thanks for the link. Just went through the entire thread. I think we can
> solve the problems as such though:
> 
>    1. Have some form of linker that mangles all the symbols internally in
>    the newly linked shared library, eg: FILE* --> FILE_mangled* so that
>    internally it has it's own libc calls that are independent from anything
>    that a binary might require.
>    2. Block allocate a chunk of memory internally in the library so that
>    allocations are now using that internal block and not malloc-ing.
> 
> However, I'm not quite sure how 1) could be solved at this time.
> 

1) libc maintains global state which will be duplicated in your
shared lib (e.g. envvars, stdio buffers, timezone, locales)
name mangling does not fix their behaviour (they will behave
inconsistently with other parts of the application).

2) brk is not the only global state that can only have one owner,
the thread pointer is another example: if your shared lib does
any tls access (e.g. errno, stack canary) then it has to match
the internals of the libc in the main application (won't work
across libc versions).

static linking libc into a shared lib simply does not make sense.


  reply	other threads:[~2016-07-14 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14  9:52 Jason Ramapuram
2016-07-14 10:17 ` Aidan Hobson Sayers
2016-07-14 10:49   ` Jason Ramapuram
2016-07-14 11:43     ` Szabolcs Nagy [this message]
2016-07-14 15:07     ` 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=20160714114352.GN19691@port70.net \
    --to=nsz@port70.net \
    --cc=aidanphs@gmail.com \
    --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).