Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cflags for gcc and glibc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Tue Feb 05, 2013 12:05 pm    Post subject: cflags for gcc and glibc Reply with quote

Have anyone built gcc for glibc with custom cflags?

There is discussion in kernel mailing list that "-Os" is better than "-O2" for Sandy bridge (or upper) platform recently.

I want to give it a try and i specified the following in /etc/portage/make.conf

CFLAGS="-Os -pipe -fuse-linker-plugin -march=native -ftree-vectorize"
CXXFLAGS="${CFLAGS}"

but i take a look at the building log of glibc and gcc and my flags are ignored:

gcc:

* CFLAGS="-O2 -pipe -march=native"
* CXXFLAGS="-O2 -pipe -march=native"
* Configuring gcc ...
* configuring for GCC_LANG: c,c++,objc,obj-c++,fortran

* PREFIX: /usr
* BINPATH: /usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
* LIBPATH: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3
* DATAPATH: /usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
* STDCXX_INCDIR: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4

* Configuring GCC with:
* --prefix=/usr
* --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
* --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include
* --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
* --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man
* --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info
* --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4


glibc:

* Building glibc for ABIs:

* ABI: amd64
* CBUILD: x86_64-pc-linux-gnu
* CHOST: x86_64-pc-linux-gnu
* CTARGET: x86_64-pc-linux-gnu
* CBUILD_OPT:
* CTARGET_OPT:
* CC: x86_64-pc-linux-gnu-gcc -m64
* ASFLAGS:
* CFLAGS: -pipe -O2 -fno-strict-aliasing
* CPPFLAGS: -U_FORTIFY_SOURCE -U_FORTIFY_SOURCE
* CXXFLAGS: -pipe -O2 -fno-strict-aliasing
* LDFLAGS: -Wl,-O1 -Wl,--as-needed
* Manual CC: x86_64-pc-linux-gnu-gcc -m64
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8708
Location: ~Brussels - Belgique

PostPosted: Tue Feb 05, 2013 12:12 pm    Post subject: Reply with quote

Hello,

Don't try to over-optimize the toolchain, your system could become unstable or unusable.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Tue Feb 05, 2013 12:33 pm    Post subject: Re: cflags for gcc and glibc Reply with quote

unknown2 wrote:
Have anyone built gcc for glibc with custom cflags?

There is discussion in kernel mailing list that "-Os" is better than "-O2" for Sandy bridge (or upper) platform recently.

I want to give it a try and i specified the following in /etc/portage/make.conf

CFLAGS="-Os -pipe -fuse-linker-plugin -march=native -ftree-vectorize"
CXXFLAGS="${CFLAGS}"

but i take a look at the building log of glibc and gcc and my flags are ignored:

gcc:

* CFLAGS="-O2 -pipe -march=native"
* CXXFLAGS="-O2 -pipe -march=native"
* Configuring gcc ...
* configuring for GCC_LANG: c,c++,objc,obj-c++,fortran

* PREFIX: /usr
* BINPATH: /usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
* LIBPATH: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3
* DATAPATH: /usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
* STDCXX_INCDIR: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4

* Configuring GCC with:
* --prefix=/usr
* --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
* --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include
* --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
* --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man
* --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info
* --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4


glibc:

* Building glibc for ABIs:

* ABI: amd64
* CBUILD: x86_64-pc-linux-gnu
* CHOST: x86_64-pc-linux-gnu
* CTARGET: x86_64-pc-linux-gnu
* CBUILD_OPT:
* CTARGET_OPT:
* CC: x86_64-pc-linux-gnu-gcc -m64
* ASFLAGS:
* CFLAGS: -pipe -O2 -fno-strict-aliasing
* CPPFLAGS: -U_FORTIFY_SOURCE -U_FORTIFY_SOURCE
* CXXFLAGS: -pipe -O2 -fno-strict-aliasing
* LDFLAGS: -Wl,-O1 -Wl,--as-needed
* Manual CC: x86_64-pc-linux-gnu-gcc -m64


-Os better in performance than -O2 for sb? I highly doubt it.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Tue Feb 05, 2013 8:59 pm    Post subject: Re: cflags for gcc and glibc Reply with quote

DaggyStyle wrote:
-Os better in performance than -O2 for sb? I highly doubt it.


me, too, so i would like to give it a try

https://lkml.org/lkml/2012/12/26/8
Back to top
View user's profile Send private message
unknown2
n00b
n00b


Joined: 14 Aug 2012
Posts: 29

PostPosted: Tue Feb 05, 2013 9:01 pm    Post subject: Reply with quote

XavierMiller wrote:
Hello,

Don't try to over-optimize the toolchain, your system could become unstable or unusable.



no one use gentoo for embedded device usage and built with -Os ?
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Feb 06, 2013 6:16 am    Post subject: Re: cflags for gcc and glibc Reply with quote

unknown2 wrote:
DaggyStyle wrote:
-Os better in performance than -O2 for sb? I highly doubt it.


me, too, so i would like to give it a try

https://lkml.org/lkml/2012/12/26/8


that guy doesn't even lists what compiler version it uses.

the company I work of is creating a product which performance is critical for it, we are using gcc 4.6, compiling it with -Os and -O2 returns always the same results, -O2's performance is better than -Os, especially in SB platform.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Wed Feb 06, 2013 9:35 am    Post subject: Re: cflags for gcc and glibc Reply with quote

DaggyStyle wrote:
unknown2 wrote:
DaggyStyle wrote:
-Os better in performance than -O2 for sb? I highly doubt it.


me, too, so i would like to give it a try

https://lkml.org/lkml/2012/12/26/8


that guy doesn't even lists what compiler version it uses.
Second to that, he only mentions x86 (which in my interpretation implies 32-bit).

And he is showing just some numbers - how did he test? how many iterations? were any special run between the runs (flushing caches et all)?
IMO there are too many non-defined parameters.

And the kernel devs are not too convinced either...


just my .02$
V.
_________________
read the portage output!
If my answer is too concise, ask for an explanation.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum