View previous topic :: View next topic |
Author |
Message |
unknown2 n00b
Joined: 14 Aug 2012 Posts: 29
|
Posted: Tue Feb 05, 2013 12:05 pm Post subject: cflags for gcc and glibc |
|
|
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 |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Tue Feb 05, 2013 12:12 pm Post subject: |
|
|
Hello,
Don't try to over-optimize the toolchain, your system could become unstable or unusable. _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Tue Feb 05, 2013 12:33 pm Post subject: Re: cflags for gcc and glibc |
|
|
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 |
|
|
unknown2 n00b
Joined: 14 Aug 2012 Posts: 29
|
Posted: Tue Feb 05, 2013 8:59 pm Post subject: Re: cflags for gcc and glibc |
|
|
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 |
|
|
unknown2 n00b
Joined: 14 Aug 2012 Posts: 29
|
Posted: Tue Feb 05, 2013 9:01 pm Post subject: |
|
|
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 |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Wed Feb 06, 2013 6:16 am Post subject: Re: cflags for gcc and glibc |
|
|
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 |
|
|
Veldrin Veteran
Joined: 27 Jul 2004 Posts: 1945 Location: Zurich, Switzerland
|
Posted: Wed Feb 06, 2013 9:35 am Post subject: Re: cflags for gcc and glibc |
|
|
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 |
|
|
|