On Mon, 2017-01-16 at 09:07 -0700, clin...@elemtech.com wrote: > > Yes, thanks for that info. My situation is that I need to force ALL > > symbols to be private, even those from external static shared libraries > > that I'm linking in (whose symbols have global visibility by default). > > Have you tried the "--exclude-libs ALL" linker option? Using that > should hide symbols from static libraries.
Yes, I looked at this. I can't quite figure out what algorithm it uses though. It gives me _almost_ the same results as my linker script with "local: *;", but not quite: With the linker script if I use: nm libfoo.so | grep ' [A-TV-Z] ' I see only and exactly the symbols I marked as global in my code, and nothing else as global. If I use --exclude-libs=ALL then I see the symbols I marked as global and _almost_ all the other symbols are local, but there some exceptions; for example: 0000000001f925a0 A __bss_start 0000000001f925a0 A _edata 0000000001fc0f4f A _end 000000000098c648 T _fini 000000000015b1b8 T _init In addition, some C++ templated symbols (very complex) are public as "W" (global weak symbols). I don't know why. I wonder whether _fini and _init need to be exported in order to properly handle global ctor/dtor when the library is loaded/unloaded? Hm. I may need to do some experimentation here. I don't see any point in the static data symbols being public. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake