Created attachment 135614 [details] [review] Don't export private symbols Hi, The attached patch, based on an old patch from Pino Toscano, does two things: Define -Dpoppler_qt5_EXPORTS so that POPPLER_QT5_EXPORT is set to something useful. Build with -fvisibility=hidden -fvisibility-inlines-hidden, so that symbols don't get exported by default. All those marked as POPPLER_QT5_EXPORT get exported though. This has the nice benefit of reducing the number of exported symbols by about 600. E.g. these ones are exported without this patch: _ZTVN7Poppler15LinkGotoPrivateE _ZNK8QMapDataI7QStringPN7Poppler14OptContentItemEE8findNodeERKS0_ _ZNK8QMapNodeI7QStringPN7Poppler14OptContentItemEE4copyEP8QMapDataIS0_S3_E _ZN9OutputDev18updateHorizScalingEP8GfxState _ZN7Poppler26HighlightAnnotationPrivateD1Ev Some things to consider: Do we want -fvisibility-inlines-hidden as well? Should this be applied to GCC only? Not sure what's the support in other compilers. One small issue with this: there are some symbols that are not public but are used by some tests. With this patch, those symbols don't get exported, so the tests fail to link as they try to test those private methods. E.g. qt4/src/poppler-private.h's Poppler::unicodeToQString is not marked as POPPLER_QT4_EXPORT so doesn't get exported in the shared library, so qt4/tests/check_strings.cpp fails to build. Some possible solutions would be: - Disable those tests - Export those symbols - If those methods are self-contained, move them to their own .cpp and include that .cpp directly from the test case, so it gets built into the test case without linking against libpoppler... kind of a hack but I think it'd work :P This patch has been in Debian for a long time and I'm not aware of any weird crashes or anything, fwiw. Thoughts?
> - Disable those tests We don't shoot ourselves on the foot Also, this is not how you do visibility stuff in cmake set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) is what you want.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/293.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.