diff options
author | Thomas Epting <thomas.epting@stryker.com> | 2016-10-04 10:49:05 +0200 |
---|---|---|
committer | Thomas Epting <thomas.epting@stryker.com> | 2016-10-10 17:28:33 +0000 |
commit | fb7a6ddcd96004f5e7e56b26a722ca49488448e6 (patch) | |
tree | 3726a6382cd7cd013e5a66fe96928d8d1a727741 | |
parent | 6a5250c89662ff7b289c23b30a7bece9410de130 (diff) |
Introduce property cpp.linkerWrapper
This allows integration with tools like Bullseye Coverage.
Task-number: QBS-1000
Change-Id: I318599a9df0f082a096fb72db7a8878b15e571cc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
-rw-r--r-- | doc/reference/modules/cpp-module.qdoc | 7 | ||||
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 16 | ||||
-rw-r--r-- | share/qbs/modules/cpp/msvc.js | 9 |
4 files changed, 30 insertions, 3 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index a9c2464f3..ce6b1ac53 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -322,6 +322,13 @@ \li determined by qbs-setup-toolchains \li Full path of the linker binary. This is set in the build profile. \row + \li linkerWrapper + \li \c{stringList} + \li 1.6.2 + \li \c{undefined} + \li Wrapper binary and its arguments for wrapping linker calls. + This is useful for linker wrappers as needed by Bullseye Coverage, for example. + \row \li entryPoint \li \c{string} \li 1.3 diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index 6aa0211a3..2459a419b 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -146,6 +146,7 @@ Module { property stringList compilerWrapper property string linkerName property string linkerPath: linkerName + property stringList linkerWrapper property string staticLibraryPrefix property string dynamicLibraryPrefix property string loadableModulePrefix diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 3f5309985..641d8e579 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -749,10 +749,22 @@ function prepareLinker(project, product, inputs, outputs, input, output) { primaryOutput = outputs.loadablemodule[0]; } - cmd = new Command(effectiveLinkerPath(product, inputs), - linkerFlags(project, product, inputs, primaryOutput)); + var linkerPath = effectiveLinkerPath(product, inputs) + + var args = linkerFlags(project, product, inputs, primaryOutput) + var wrapperArgsLength = 0; + var wrapperArgs = ModUtils.moduleProperty(product, "linkerWrapper"); + if (wrapperArgs && wrapperArgs.length > 0) { + wrapperArgsLength = wrapperArgs.length; + args.unshift(linkerPath); + linkerPath = wrapperArgs.shift(); + args = wrapperArgs.concat(args); + } + + cmd = new Command(linkerPath, args); cmd.description = 'linking ' + primaryOutput.fileName; cmd.highlight = 'linker'; + cmd.responseFileArgumentIndex = wrapperArgsLength; cmd.responseFileUsagePrefix = '@'; commands.push(cmd); diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 43a6a990a..03773dd3a 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -319,8 +319,15 @@ function prepareLinker(project, product, inputs, outputs, input, output) { if (ModUtils.moduleProperty(product, "allowUnresolvedSymbols")) args.push("/FORCE:UNRESOLVED"); + var linkerPath = product.moduleProperty("cpp", "linkerPath"); + var wrapperArgs = product.moduleProperty("cpp", "linkerWrapper"); + if (wrapperArgs && wrapperArgs.length > 0) { + args.unshift(linkerPath); + linkerPath = wrapperArgs.shift(); + args = wrapperArgs.concat(args); + } var commands = []; - var cmd = new Command(product.moduleProperty("cpp", "linkerPath"), args) + var cmd = new Command(linkerPath, args) cmd.description = 'linking ' + primaryOutput.fileName; cmd.highlight = 'linker'; cmd.workingDirectory = FileInfo.path(primaryOutput.filePath) |