Is there a "simple" way to have ld output demangled funtion names?
An answer to this question on Stack Overflow.
Question
I find very frustrating to have to fix C++ errors happening at linkage time (especially undefined reference errors) due to the fact that all the function names are mangled. An example of mangled name:
_ZNK5boost7archive6detail11oserializerINS0_13text_oarchiveEN9galandria8UniverseEE16save_object_dataERNS1_14basic_oarchiveEPKv
It is so hard to read, and finding the actual function is even harder.
Is there a way to convince ld to output demangled names?
Answer
I deal with these problems in two ways:
The
c++filtcommand demangles things.Sometimes compiling with clang rather than gcc, or vice versa, can give insight on compilation issues.
Unfortunately, I'm not sure if it's possible to get demangled output from the linker directly :-(