Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 519042 - toolchain.eclass - gcc_do_filter_flags() should not replace -Os with -O2 and disable shared libraries.
Summary: toolchain.eclass - gcc_do_filter_flags() should not replace -Os with -O2 and ...
Status: VERIFIED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: MIPS Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-04 15:31 UTC by ytrezq
Modified: 2014-08-08 07:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ytrezq 2014-08-04 15:31:20 UTC
I'm using a bcm6358 where only 6MB of RAM is left when the kernel started. The current vendor distribution (Openwrt) use -Os by default and maximise the use of shared libraries over static ones.

I use crossdev to generate the toolchain and using µClibc

Of course, this include shared libraries from gcc (libgcc libfortran libstdc++...).

However, it seems the generation of shared libraries is disable in toolchain.eclass for some reason.

While -Os seems to be a safe alternative as -O2, toolchain.eclass and patches make sure user libraries are compiled with -O2.

So, after running crossdev I saw gcc's libraries where only available as static only, but shared memory is really important on the real hardware (since those part of code are expected to be loaded in every piece of software).
Comment 1 ytrezq 2014-08-05 09:30:28 UTC
That's not a problem if the compiler itself is build with -O2 since it would make it faster. I'm more concerned by shared libraries for programs compiled by gcc (libgcc libfortan...).

So the main problem is that they can't be shared. Making them shared would save lot of more memory than compiling them with -Os.
Comment 2 SpanKY gentoo-dev 2014-08-05 22:13:13 UTC
please post the full build logs as attachments to show what you're talking about.  include the full command you actually ran w/crossdev.
Comment 3 ytrezq 2014-08-06 12:49:51 UTC
(In reply to SpanKY from comment #2)
> please post the full build logs as attachments to show what you're talking
> about.  include the full command you actually ran w/crossdev.

Logs won't tell many things since gcc stage compile successfully.

There's no need for logs just look at /usr/portage/eclass/toolchain.eclass at the line 917 :

                *-uclibc*)
	                        if ! echo '#include <features.h>' | \
	                           $(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \
	                           grep -q __HAVE_SHARED__
	                        then #291870
	                                confgcc+=( --disable-shared )
That part disable the shared version of gcc libraries.

The next one disable -Os:

1339	gcc_do_filter_flags() {
1340	        strip-flags
1341	        replace-flags -O? -O2
Comment 4 SpanKY gentoo-dev 2014-08-08 07:55:13 UTC
(In reply to lcellier from comment #3)

your vague reports aren't useful.  please post the logs requested.