mailing list of musl libc
 help / color / mirror / code / Atom feed
* Statically linking musl with lto optimizations
@ 2014-01-28  1:52 Chris Anderson
  2014-01-28 12:20 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Anderson @ 2014-01-28  1:52 UTC (permalink / raw)
  To: musl

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-28 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-28  1:52 Statically linking musl with lto optimizations Chris Anderson
2014-01-28 12:20 ` Szabolcs Nagy

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).