Hi,
I figured out gcc-slo doesn't work with C++. As I saw no mention of that, I thought it might be a bug, but even if it is not, it would probably be helpful to document it.
This is how compiling a C++ hello world fails on my amd64 box:
sliedes@lh:~/slo-test$ cat hello.cpp
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
sliedes@lh:~/slo-test$ ~/gcc-slo/bin/g++-slo hello.cpp -o hello.o -c -O3 -fno-inline -fslo-instrument
sliedes@lh:~/slo-test$ ~/gcc-slo/bin/g++-slo hello.o -o hello -static -lrd
hello.o: In function `main':
hello.cpp:(.text+0x3b6): undefined reference to `main::ref_nrs1'
hello.o: In function `std::ios_base::_M_getloc() const':
hello.cpp:(.gnu.linkonce.t._ZNKSt8ios_base9_M_getlocEv+0x98): undefined reference to `std::ios_base::_M_getloc() const::ref_nrs38'
hello.o: In function `std::ios_base::width() const':
hello.cpp:(.gnu.linkonce.t._ZNKSt8ios_base5widthEv+0x99): undefined reference to `std::ios_base::width() const::ref_nrs18'
hello.o: In function `std::ios_base::flags() const':
hello.cpp:(.gnu.linkonce.t._ZNKSt8ios_base5flagsEv+0x97): undefined reference to `std::ios_base::flags() const::ref_nrs37'
hello.o: In function `std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)':
hello.cpp:(.gnu.linkonce.t._ZStoRRSt12_Ios_IostateS_+0x14b): undefined reference to `std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)::ref_nrs14'
hello.cpp:(.gnu.linkonce.t._ZStoRRSt12_Ios_IostateS_+0x166): undefined reference to `std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)::ref_nrs15'
hello.o: In function `std::char_traits<char>::to_int_type(char const&)':
hello.cpp:(.gnu.linkonce.t._ZNSt11char_traitsIcE11to_int_typeERKc+0x96): undefined reference to `std::char_traits<char>::to_int_type(char const&)::ref_nrs59'
hello.o: In function `std::ios_base::width(long)':
hello.cpp:(.gnu.linkonce.t._ZNSt8ios_base5widthEl+0xcb): undefined reference to `std::ios_base::width(long)::ref_nrs42'
hello.o: In function `std::char_traits<char>::eq_int_type(int const&, int const&)':
hello.cpp:(.gnu.linkonce.t._ZNSt11char_traitsIcE11eq_int_typeERKiS2_+0xc6): undefined reference to `std::char_traits<char>::eq_int_type(int const&, int const&)::ref_nrs60'
hello.o: In function `std::ctype<char>::_M_widen_init() const':
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE13_M_widen_initEv+0x103): undefined reference to `std::ctype<char>::_M_widen_init() const::ref_nrs26'
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE13_M_widen_initEv+0x3a5): undefined reference to `std::ctype<char>::_M_widen_init() const::ref_nrs28'
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE13_M_widen_initEv+0x3c3): undefined reference to `std::ctype<char>::_M_widen_init() const::ref_nrs27'
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE13_M_widen_initEv+0x3e1): undefined reference to `std::ctype<char>::_M_widen_init() const::ref_nrs29'
hello.o: In function `std::ctype<char>::widen(char) const':
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE5widenEc+0x246): undefined reference to `std::ctype<char>::widen(char) const::ref_nrs23'
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE5widenEc+0x266): undefined reference to `std::ctype<char>::widen(char) const::ref_nrs24'
hello.cpp:(.gnu.linkonce.t._ZNKSt5ctypeIcE5widenEc+0x286): undefined reference to `std::ctype<char>::widen(char) const::ref_nrs25'
hello.o: In function `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)':
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x66e): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs30'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x687): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs32'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x932): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs31'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x94b): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs36'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x969): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs33'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x982): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs34'
hello.cpp:(.gnu.linkonce.t._ZNSt5__padIcSt11char_traitsIcEE6_S_padERSt8ios_basecPcPKcllb+0x99b): undefined reference to `std::__pad<char, std::char_traits<char> >::_S_pad(std::ios_base&, char, char*, char const*, long, long, bool)::ref_nrs35'
collect2: ld returned 1 exit status
sliedes@lh:~/slo-test$
On more complex C++ programs I also get warnings of unused variables during the compilation pass.
Nice software you have written, thanks!
Hi,
C++ is indeed not supported.
The work needed to support C++ is:
* extend the C++ parser with indication of the column-offsets of start and ends of tokens. Maybe also code needs to be adapted to translate this info during C++ to internal representation translation.
* maybe the run-time library (librd) might also interfere and needs to be adapted.
There are currently no plans to support C++