summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-10-16 14:43:01 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-10-21 11:09:45 +0000
commit6fa5e8cb9864d21ee29ab4e25bf64b8d3672cbdf (patch)
tree7a3e35436789da230cc35280f8d1e70a77feb146
parent671e578cd9f555b2a0a0bdddcd4e6cc3b99de85a (diff)
Implement cpp.generateLinkerMapFile for GCC-like toolchains
Now it is possible to generate a linker map file from the GCC, MinGW and CLang toolchains. Change-Id: I69b07e907129daac0ff29bd62034d8807cd5fdf1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Richard Weickelt <richard@weickelt.de>
-rw-r--r--doc/reference/modules/cpp-module.qdoc2
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs9
-rw-r--r--share/qbs/modules/cpp/gcc.js7
3 files changed, 15 insertions, 3 deletions
diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc
index 4ef1e4e5b..2f7f06698 100644
--- a/doc/reference/modules/cpp-module.qdoc
+++ b/doc/reference/modules/cpp-module.qdoc
@@ -1673,8 +1673,6 @@
\qmlproperty bool cpp::generateLinkerMapFile
\since Qbs 1.13
- \baremetalproperty
-
Whether to auto-generate a linker map file.
\defaultvalue \c{false}
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 5ededc512..63d5db7b8 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -561,7 +561,7 @@ CppModule {
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
outputFileTags: ["bundle.input", "application", "debuginfo_app","debuginfo_bundle",
- "debuginfo_plist"]
+ "debuginfo_plist", "mem_map"]
outputArtifacts: {
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
@@ -575,6 +575,13 @@ CppModule {
var artifacts = [app];
if (!product.aggregate)
artifacts = artifacts.concat(Gcc.debugInfoArtifacts(product, undefined, "app"));
+ if (product.cpp.generateLinkerMapFile) {
+ artifacts.push({
+ filePath: FileInfo.joinPaths(product.destinationDirectory,
+ product.targetName + ".map"),
+ fileTags: ["mem_map"]
+ });
+ }
return artifacts;
}
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index 0913b27d0..639191da6 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -514,6 +514,13 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat
if (importLibs)
escapableLinkerFlags.push("--out-implib", importLibs[0].filePath);
+ if (outputs.application && product.cpp.generateLinkerMapFile) {
+ if (isDarwin)
+ escapableLinkerFlags.push("-map", outputs.mem_map[0].filePath);
+ else
+ escapableLinkerFlags.push("-Map=" + outputs.mem_map[0].filePath);
+ }
+
var escapedLinkerFlags = escapeLinkerFlags(product, inputs, escapableLinkerFlags);
Array.prototype.push.apply(escapedLinkerFlags, args);
var driverLinkerFlags = useCompilerDriver ? product.cpp.driverLinkerFlags : undefined;