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

Add option to link to a whole archive

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 1.9.0
    • None
    • General
    • None
    • 7ac55bda5519ad2ef3f220f4f0f778dd9592abc5

      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" ]
        }
      }
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes