
Hi,
I would like to add symbol visibility support to my library. Using
-fvisibility=hidden option I compared the changed symbols,
boost::bad_function_call typeinfo was visible previously but with
hidden default visibility it is hidden. It compiles just fine, but
according to gcc wiki (http://gcc.gnu.org/wiki/Visibility) exceptions
must be visible as runtime error might happen because of missing
typeinfo.
I found bug report (https://svn.boost.org/trac/boost/ticket/2309) that
exception class not exported in Boost.Thread, the problem was fixed by
adding pragmas. In boost/function/function_base.hpp pragmas or other
ways to change visibility isn't used, so the boost::bad_function_call
typeinfo became hidden using -fvisibility=hidden. In the former boost
bug report (https://svn.boost.org/trac/boost/ticket/2309) runtime
error does not even mentioned, I couldn't reproduce the runtime error
in my small experiments.
In what situations can hidden symbol cause problems? Is it normal that
boost::bad_function_call typeinfo is hidden or it is a boost bug that
can cause problems and should be fixed?
A made a small test library and application. The library has hidden
boost::bad_function_call typeinfo, but the application seems catching
the exception properly. Can this cause an error, why is it working?
Makefile:
CXX=g++
test_exception: test_exception.cpp libmydso.so
$(CXX) -L. -lmydso $< -o $@
libmydso.so: mydso.cpp
$(CXX) -fvisibility=hidden -fPIC -shared -Wl,-soname,$@ $< -o $@
mydso.h:
void __attribute__ ((visibility ("default"))) test_exception();
mydso.cpp:
#include
participants (1)
-
Dániel Varga