Profiling driven optimization with gcc-2.7.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

How can I turn profile driven optimizations with gcc-4.7.0 development version?
It used to work with gcc-4.6.x and before. I am trying to use the latest GCC
trunk:
$ /opt/gcc47-20111207/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc47-20111207/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc47-20111207/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-source/configure --prefix=/opt/gcc47-20111207
--enable-languages='c++ c'
Thread model: posix
gcc version 4.7.0 20111206 (experimental) (GCC)


I have got two files:
// t.cpp
#include<iostream>
void f() { std::cout<<  "hello\n"; }

// t.cpp
void f();
int main() { f(); return 0; }

I compile them with:
$ rm -rf prof
$ /opt/gcc47-20111207/bin/g++ -c t.cpp -g -O2 -m32 -fprofile-generate=prof

$ /opt/gcc47-20111207/bin/g++ -c t2.cpp -g -O2 -m32 -fprofile-generate=prof

$ /opt/gcc47-20111207/bin/g++ -O2 t2.o t.o -g -m32 -fprofile-generate=prof

and I get:
========= begin ====
/home/me/t2.cpp:3: undefined reference to
`__gcov0__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
/home/me/t2.cpp:3: undefined reference to
`__gcov0__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
t2.o: In function `operator<<  <std::char_traits<char>  >':
/opt/gcc47-20111207/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ostream:515:
undefined reference to
`__gcov0__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
/opt/gcc47-20111207/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ostream:515:
undefined reference to
`__gcov0__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
collect2: error: ld returned 1 exit status
========== end ====

Neither adding -lgcov at the end nor adding
/opt/gcc47-20111207/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/32/libgcov.a
helps.

Is it a bug needing a PR or is it something I did wrong?
--
Michael



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux