Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97816

Prevent linker from discarding unused shared libraries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.1
    • Build System: CMake

    Description

      There are scenarios where we want to link to a shared library, but we don't actually use any symbols from it (e.g. with QML modules where the consumer may want to link only to the backing library and not need the associated plugin at all). Some linkers will discard that library as an optimization, since they think it is unused. We want some way of conveniently telling the linker not to discard a library in this situation, but currently there is no easy way to do that. Different linkers use different linker flags, some don't allow you to specify it at per-library level and only at a whole-of-link level (e.g. the MSVC linker).

      Reported as a specific use case in the broader upstream CMake issue for linker decorations: https://gitlab.kitware.com/cmake/cmake/-/issues/22812#note_1074118

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              crscott Craig Scott
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes