Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-701

Add option to link to a whole archive

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: some future version
    • Fix Version/s: 1.9.0
    • Component/s: General
    • Labels:
      None

      Description

      By default gnu-ld only links to used symbols of an archive file. But sometimes one would want to include the whole library as is. This can be achieved by enclosing the archive into two linker flags:

      g++ ... lib1.a lib2.a -Wl--whole-archive lib3.a -Wl,--no-whole-archive ...

      The no-whole-archive flag is important as whole-archive affects all subsequent libraries. For llvm the flag -force_load has a similar effect but applies only to the following archive.

      This feature could be controlled by a property in the cpp module:

      Product {
          // ...
      
          Depends { name : "staticlib" }
      
          cpp.staticLibraries : [ "extlib1", "extlib2" ]
          cpp.wholeArchive : [ "staticlib", "extlib1" ]
        }
      }
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              kandeler Christian Kandeler
              Reporter:
              rweickelt Richard Weickelt
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes