<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Only export public symbols on the qt libs"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=103827">103827</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Only export public symbols on the qt libs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pochu27@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=135614" name="attach_135614" title="Don't export private symbols">attachment 135614</a> <a href="attachment.cgi?id=135614&action=edit" title="Don't export private symbols">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=103827&attachment=135614'>[review]</a>
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?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>