What does it mean when Boost.Exception symbols show up in 'nm' output? Will they cause ODR violations?

116 views Asked by At

I'm running this on a 3rd party statically linked library. I thought that since it's a header only library (except on some MSVC versions), it wouldn't show up. Maybe I'm misunderstanding what nm is supposed to show. What I really want to know is if they will cause ODR violations if I'm linking to a library that was compiled with a different version of Boost.

See output at: http://codepad.org/kJ86hiQg

A short sampling:

    W boost::exception_detail::clone_base::~clone_base()
    W boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::~clone_impl()
    W boost::exception_detail::cloning_base::~cloning_base()
    W boost::exception_detail::counted_base::~counted_base()
    W boost::exception::~exception()
1

There are 1 answers

4
sehe On BEST ANSWER

These appear to be weak symbols.

http://en.wikipedia.org/wiki/Weak_symbol


Update ODR violations are not caused by duplicate linker records in the first place. They are caused when the compiler uses different definitions of symbols by the same name.

So, the short answer is: no nm showing these weak symbols does not cause or indicate ODR violations. However, the fact that these symbols are weak doesn't imply that there cannot be a ODR violation either.

In fact I think it is perfectly possible to have ODR violations without such symbols (e.g. when the layout of a struct with the same mangled name is different due to different alignment or packing options) across translation units.