Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140508081126.140b0064@vostro>
Date: Thu, 8 May 2014 08:11:26 +0300
From: Timo Teras <timo.teras@....fi>
To: musl@...ts.openwall.com
Cc: dalias@...c.org, scjthm@...e.com
Subject: Re: Linking musl with ld.gold

On Wed, 7 May 2014 21:06:05 -0400
Rich Felker <dalias@...c.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.