This is the mail archive of the
mailing list for the binutils project.
Re: Quick --gc-sections question
On Tue, Nov 8, 2011 at 6:35 AM, Alan Modra <email@example.com> wrote:
> On Mon, Nov 07, 2011 at 09:50:26PM +0100, Octoploid wrote:
>> On Mon, Nov 7, 2011 at 9:13 PM, Ian Lance Taylor <firstname.lastname@example.org> wrote:
>> > I'll note that this was recently fixed in gold. ?If --export-dynamic is
>> > passed to the linker, I think we should not garbage collect globally
>> > visible functions.
> Try this.
> - ? ? ? ? || (!info->executable
> + ? ? ? ? || ((!info->executable || info->export_dynamic)
Great and easy enough ;-)
% ld -v
GNU ld (GNU Binutils) 188.8.131.5211108
% gcc -ffunction-sections -rdynamic
-Wl,--gc-sections,--print-gc-sections check.c 2>&1 | grep .text.fun
% nm -D a.out|grep fun
0000000000400622 T fun
controlled by gamma light