diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-08-19 15:04:15 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-08-19 15:26:12 +0200 |
commit | c7ef0f123f92d9746e30e374891409f7cf05cd7e (patch) | |
tree | 6b615dd35253ea698dd208a65eeb1a43160d1868 /share | |
parent | a9fa34172dd37d1d90628c236f0eee00459500c3 (diff) | |
parent | 60b28789ebbab72ed9232643a8216264f7924ddf (diff) |
Merge 1.6 into master
Change-Id: Id711e244f207d6c4f08e240ef4c033f344b530fc
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/ModUtils/utils.js | 12 | ||||
-rw-r--r-- | share/qbs/modules/Android/ndk/utils.js | 6 | ||||
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 7 | ||||
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 5 | ||||
-rw-r--r-- | share/qbs/modules/cpp/android-gcc.qbs | 2 | ||||
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 40 | ||||
-rw-r--r-- | share/qbs/modules/cpp/windows-mingw.qbs | 1 |
7 files changed, 61 insertions, 12 deletions
diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index 3ffb4e504..2eabde78a 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -49,6 +49,18 @@ function sanitizedList(list, product, fullPropertyName) { return list.filter(filterFunc); } +function checkCompatibilityMode(project, minimumQbsVersion, message) { + if (Utilities.versionCompare(project.minimumQbsVersion || "1.3", minimumQbsVersion) < 0) { + console.warn([message || "", + "This message can be silenced by setting your Project's " + + "minimumQbsVersion to " + minimumQbsVersion + + " (and the new behavior will take effect)."].join(" ")); + return true; + } + + return false; +} + function artifactInstalledFilePath(artifact) { var relativeInstallDir = artifact.moduleProperty("qbs", "installDir"); var installPrefix = artifact.moduleProperty("qbs", "installPrefix"); diff --git a/share/qbs/modules/Android/ndk/utils.js b/share/qbs/modules/Android/ndk/utils.js index bcb60ae03..062730b9a 100644 --- a/share/qbs/modules/Android/ndk/utils.js +++ b/share/qbs/modules/Android/ndk/utils.js @@ -62,7 +62,7 @@ function androidAbi(arch) { } function commonCompilerFlags(buildVariant, abi, armMode) { - var flags = ["-ffunction-sections", "-funwind-tables", "-no-canonical-prefixes", + var flags = ["-ffunction-sections", "-funwind-tables", "-Wa,--noexecstack", "-Werror=format-security"]; if (buildVariant === "debug") @@ -112,10 +112,10 @@ function commonCompilerFlags(buildVariant, abi, armMode) { } function commonLinkerFlags(abi) { - var flags = ["-no-canonical-prefixes", "-Wl,-z,noexecstack", "-Wl,-z,relro", "-Wl,-z,now"]; + var flags = ["-z", "noexecstack", "-z", "relro", "-z", "now"]; if (abi === "armeabi-v7a") { - flags.push("-Wl,--fix-cortex-a8"); + flags.push("--fix-cortex-a8"); } return flags; diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index dd3b62935..6aa0211a3 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -212,6 +212,12 @@ Module { description: "additional linker flags" } + property stringList driverFlags + PropertyOptions { + name: "driverFlags" + description: "additional compiler driver flags" + } + property bool positionIndependentCode PropertyOptions { name: "positionIndependentCode" @@ -282,6 +288,7 @@ Module { property stringList platformObjcFlags property stringList platformObjcxxFlags property stringList platformLinkerFlags + property stringList platformDriverFlags // Apple platforms properties property bool automaticReferenceCounting diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index f61611430..d7e4da013 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -93,7 +93,10 @@ CppModule { + "which chooses either the C++ compiler, C compiler, or system linker specified by " + "the linkerName/linkerPath properties, depending on the type of object files " + "present on the linker command line. \"manual\" allows you to explicitly specify " - + "the linker using the linkerName/linkerPath properties." + + "the linker using the linkerName/linkerPath properties, and allows linker flags " + + "passed to the linkerFlags and platformLinkerFlags properties to be escaped " + + "manually (using -Wl or -Xlinker) instead of automatically based on the selected " + + "linker." } property string exportedSymbolsCheckMode: "ignore-undefined" diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs index ad8437a21..34ef322b6 100644 --- a/share/qbs/modules/cpp/android-gcc.qbs +++ b/share/qbs/modules/cpp/android-gcc.qbs @@ -113,6 +113,8 @@ LinuxGCC { linkerFlags: NdkUtils.commonLinkerFlags(Android.ndk.abi) + platformDriverFlags: ["-no-canonical-prefixes"] + libraryPaths: { var prefix = FileInfo.joinPaths(sysroot, "usr"); var paths = []; diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index c8bf0860b..8edcf5e16 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -72,11 +72,14 @@ function useCompilerDriverLinker(product, inputs) { return linker === product.moduleProperty("cpp", "compilerPath"); } -function escapeLinkerFlags(product, inputs, linkerFlags) { +function escapeLinkerFlags(product, inputs, linkerFlags, allowEscape) { + if (allowEscape === undefined) + allowEscape = true; + if (!linkerFlags || linkerFlags.length === 0) return []; - if (useCompilerDriverLinker(product, inputs)) { + if (useCompilerDriverLinker(product, inputs) && allowEscape) { var sep = ","; var useXlinker = linkerFlags.some(function (f) { return f.contains(sep); }); if (useXlinker) { @@ -97,7 +100,7 @@ function escapeLinkerFlags(product, inputs, linkerFlags) { return linkerFlags; } -function linkerFlags(product, inputs, output) { +function linkerFlags(project, product, inputs, output) { var libraryPaths = ModUtils.moduleProperty(product, 'libraryPaths'); var dynamicLibraries = ModUtils.moduleProperty(product, "dynamicLibraries"); var staticLibraries = ModUtils.modulePropertiesFromArtifacts(product, inputs.staticlibrary, 'cpp', 'staticLibraries'); @@ -240,9 +243,22 @@ function linkerFlags(product, inputs, output) { if (isDarwin && ModUtils.moduleProperty(product, "warningLevel") === "none") args.push('-w'); - args = args.concat(configFlags(product)); - args = args.concat(ModUtils.moduleProperty(product, 'platformLinkerFlags')); - args = args.concat(ModUtils.moduleProperty(product, 'linkerFlags')); + var allowEscape = !ModUtils.checkCompatibilityMode(project, "1.6", + "Enabling linker flags compatibility mode. cpp.linkerFlags and " + + "cpp.platformLinkerFlags escaping is handled automatically beginning in Qbs 1.6. " + + "When upgrading to Qbs 1.6, you should only pass raw linker flags to these " + + "properties; do not escape them using -Wl or -Xlinker. This allows Qbs to " + + "automatically supply the correct linker flags regardless of whether the " + + "linker chosen is the compiler driver or system linker (see the documentation for " + + "cpp.linkerMode for more information)."); + + args = args.concat(configFlags(product, useCompilerDriverLinker(product, inputs))); + args = args.concat(escapeLinkerFlags( + product, inputs, + ModUtils.moduleProperty(product, 'platformLinkerFlags'), allowEscape)); + args = args.concat(escapeLinkerFlags( + product, inputs, + ModUtils.moduleProperty(product, 'linkerFlags'), allowEscape)); args.push("-o", output.filePath); @@ -298,9 +314,17 @@ function linkerFlags(product, inputs, output) { } // for compiler AND linker -function configFlags(config) { +function configFlags(config, isDriver) { + if (isDriver === undefined) + isDriver = true; + var args = []; + if (isDriver) { + args = args.concat(ModUtils.moduleProperty(config, 'platformDriverFlags')); + args = args.concat(ModUtils.moduleProperty(config, 'driverFlags')); + } + var frameworkPaths = ModUtils.moduleProperty(config, 'frameworkPaths'); if (frameworkPaths) args = args.concat(frameworkPaths.map(function(path) { return '-F' + path })); @@ -726,7 +750,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) { } cmd = new Command(effectiveLinkerPath(product, inputs), - linkerFlags(product, inputs, primaryOutput)); + linkerFlags(project, product, inputs, primaryOutput)); cmd.description = 'linking ' + primaryOutput.fileName; cmd.highlight = 'linker'; cmd.responseFileUsagePrefix = '@'; diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index 0c83e6aeb..0f75dad76 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -42,6 +42,7 @@ GenericGCC { staticLibrarySuffix: ".a" dynamicLibrarySuffix: ".dll" executableSuffix: ".exe" + debugInfoSuffix: ".debug" imageFormat: "pe" windowsApiCharacterSet: "unicode" platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet)) |