Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 28 Jan 2014 01:52:46 +0000
From: Chris Anderson <cjanderson@...dex.com>
To: musl@...ts.openwall.com
Subject: Statically linking musl with lto optimizations

Hi

I just wanted to know if anyone has tried this and if so with what success? 

I have tried adding the -flto and -fuse-linker-plugin to my CFLAGS but when I go and link against the static lib/libc.a archive I get a lot of unresolved symbols. I fixed this by changing the makefile thus:

 38 AR      = $(CROSS_COMPILE)gcc-ar
 39 RANLIB  = $(CROSS_COMPILE)gcc-ranlib

which is described in this thread http://permalink.gmane.org/gmane.comp.gcc.patches/221033

This meant that the archive was being created correctly.

The problem that I now have is that if I use
If I use ./bin/musl-gcc  -flto=5 -fuse-linker-plugin -o test test.c I get a whole lot of unresolved symbols being spewed out by the linker.

If I try and link using gcc without gcc libs and but without the musl spec file, ie gcc   -flto=5 -fuse-linker-plugin -static -nostdlib all is good apart from an undefined reference to __dynlink.

If I add a dummy __dynlink then the whole program links of course it wont execute because the .bss and other segments are not configured.

What is the correct way to do this?

Cheers

Chris


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.