diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-01-14 14:57:47 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-01-15 18:03:57 +0100 |
commit | d305fe3242d0230ff29a726259d3987068f89667 (patch) | |
tree | 310e05249998b09c9ecca15646cb96a62bff6ea5 /share | |
parent | e7cec8e77fa3dadb24d71135a965065c5fc5ff73 (diff) |
Make it possible to link with unresolved symbols.
Task-number: QBS-476
Change-Id: I697cc562b4212a5aa89ba973081571f99c08ba37
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 2 | ||||
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 12 | ||||
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 18 | ||||
-rw-r--r-- | share/qbs/modules/cpp/msvc.js | 2 |
4 files changed, 21 insertions, 13 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index adae32e06..8b7053894 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -181,6 +181,8 @@ Module { property string signingIdentity property string provisionFile + property bool allowUnresolvedSymbols: false + FileTagger { patterns: ["*.c"] fileTags: ["c"] diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 680db41d9..1547d6a43 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -122,8 +122,6 @@ CppModule { args = args.concat([ '-Wl,--hash-style=gnu', '-Wl,--as-needed', - '-Wl,--allow-shlib-undefined', - '-Wl,--no-undefined', '-Wl,-soname=' + Gcc.soname(product, libFilePath) ]); } else if (product.moduleProperty("qbs", "targetOS").contains('darwin')) { @@ -309,16 +307,6 @@ CppModule { args = args.concat(["-sectcreate", "__TEXT", "__info_plist", inputs.infoplist[0].fileName]); } - if (product.moduleProperty("qbs", "targetOS").contains('linux')) { - var transitiveSOs = ModUtils.modulePropertiesFromArtifacts(product, - inputs.dynamiclibrary_copy, 'cpp', 'transitiveSOs') - var uniqueSOs = ModUtils.uniqueConcat([], transitiveSOs) - for (i in uniqueSOs) { - // The real library is located one level up. - args.push("-Wl,-rpath-link=" + FileInfo.path(FileInfo.path(uniqueSOs[i]))); - } - } - args = args.concat(Gcc.linkerFlags(product, inputs)); args = args.concat(Gcc.additionalCompilerAndLinkerFlags(product)); var cmd = new Command(ModUtils.moduleProperty(product, "linkerPath"), args); diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 91db86eb4..9eed803d2 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -66,6 +66,23 @@ function linkerFlags(product, inputs) args = args.concat(['-weak_framework', weakFrameworks[i]]); } + var isDarwin = product.moduleProperty("qbs", "targetOS").contains("darwin"); + var unresolvedSymbolsAction = isDarwin ? "error" : "report-all"; + if (ModUtils.moduleProperty(product, "allowUnresolvedSymbols")) + unresolvedSymbolsAction = isDarwin ? "suppress" : "ignore-all"; + var unresolvedSymbolsKey = isDarwin ? "-undefined," : "--unresolved-symbols="; + args.push("-Wl," + unresolvedSymbolsKey + unresolvedSymbolsAction); + + if (product.moduleProperty("qbs", "targetOS").contains('linux')) { + var transitiveSOs = ModUtils.modulePropertiesFromArtifacts(product, + inputs.dynamiclibrary_copy, 'cpp', 'transitiveSOs') + var uniqueSOs = ModUtils.uniqueConcat([], transitiveSOs) + for (i in uniqueSOs) { + // The real library is located one level up. + args.push("-Wl,-rpath-link=" + FileInfo.path(FileInfo.path(uniqueSOs[i]))); + } + } + return args; } @@ -117,7 +134,6 @@ function configFlags(config) { } if (ModUtils.moduleProperty(config, "treatWarningsAsErrors")) args.push('-Werror'); - return args; } diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 10a8b6c8c..0df17a25e 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -195,6 +195,8 @@ function prepareLinker(product, inputs, outputs, libraryPaths, dynamicLibraries, args.push('/LIBPATH:' + FileInfo.toWindowsSeparators(libraryPaths[i])) } args = args.concat(linkerFlags); + if (ModUtils.moduleProperty(product, "allowUnresolvedSymbols")) + args.push("/FORCE:UNRESOLVED"); var commands = []; var cmd = new Command(product.moduleProperty("cpp", "linkerPath"), args) |