mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Timo Teras <timo.teras@iki.fi>
To: musl@lists.openwall.com
Cc: dalias@libc.org, scjthm@live.com
Subject: Re: Linking musl with ld.gold
Date: Thu, 8 May 2014 08:11:26 +0300	[thread overview]
Message-ID: <20140508081126.140b0064@vostro> (raw)
In-Reply-To: <20140508010605.GE26358@brightrain.aerifal.cx>

On Wed, 7 May 2014 21:06:05 -0400
Rich Felker <dalias@libc.org> wrote:

> On Wed, May 07, 2014 at 01:04:43PM +0300, Timo Teras wrote:
> > Is perhaps -ffunction-sections and/or -fdata-sections added
> > automatically? Those would break musl like experienced.
> 
> They should not break musl; if they do, it's a compiler bug. The
> strong symbol that overrides the weak symbol elsewhere is not unused
> and available for garbage collection because it's referenced.
> 
> I suspect your claim is just wrong, since IIRC people have
> successfully used these options with musl.

-fdata-sections breaks things to my understanding.

stdin.c (and others), have:

FILE *const stdin = &f;
FILE *const __stdin_used = &f;

And __stdin_used is only ever referenced via weak alias. -fdata-section
makes each symbol go to different section, and if linker has
gc-sections, it'll remove any unreferenced section. This means
__stdin_used will never get pulled in causing problems like described
in the original mail.

With -ffunction-sections/-fdata-sections/-Wl,--gc-sections it is no
longer valid assumption that if compilation unit gets pulled in, all of
the symbols defined in it will get pulled in.

Of course this does not affect .so as visible exported symbols are
reachable and not GCd. But static build would be effected.

- Timo


  parent reply	other threads:[~2014-05-08  5:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  9:07 Stephen Thomas
2014-05-06 10:14 ` Szabolcs Nagy
2014-05-06 21:11   ` Stephen Thomas
2014-05-06 23:18     ` Szabolcs Nagy
2014-05-07  9:04       ` Stephen Thomas
2014-05-07 10:04         ` Timo Teras
2014-05-08  0:03           ` Stephen Thomas
2014-05-08  1:06           ` Rich Felker
2014-05-08  2:08             ` Stephen Thomas
2014-05-08  3:01               ` Rich Felker
2014-05-08  5:11             ` Timo Teras [this message]
2014-05-08  5:18               ` 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=20140508081126.140b0064@vostro \
    --to=timo.teras@iki.fi \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=scjthm@live.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).