I have a c++ shared library - libA.so. I hide symbols using -fvisibility=hidden flag. The symbols which should be visible have the following attribute: __attribute__ ((visibility ("default"))). That library links to the static library - libB.a. All symbols from that static library (libB.a) should be visible only for the shared library (libA.so). I have compiled the static library also with the flag -fvisibility=hidden. I get desired results - symbols from libB.a are only visible for libA.so but are hidden for the outside world, for example the following command nm -C libA.so doesn't show symbols from libB.a.
Could you explain how the flag -fvisibility=hidden works internally with the static library in the above scenario ?