[Poppler-bugs] [Bug 103827] New: Only export public symbols on the qt libs

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Nov 20 18:41:32 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103827

            Bug ID: 103827
           Summary: Only export public symbols on the qt libs
           Product: poppler
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: pochu27 at gmail.com

Created attachment 135614
  --> https://bugs.freedesktop.org/attachment.cgi?id=135614&action=edit
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?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20171120/1a05ba05/attachment.html>


More information about the Poppler-bugs mailing list