diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2021-04-03 17:37:03 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2021-04-05 15:05:25 +0000 |
commit | ef7b698b74b4f77b2dd8135ff8f4451aca727763 (patch) | |
tree | 8ff9fde4ec7c7ff683dd82fb00b18a1287c1c536 /share/qbs/modules/cpp/sdcc.js | |
parent | af7d67396edadebd3a1f38623453f1af5cae440c (diff) | |
download | qbs-ef7b698b74b4f77b2dd8135ff8f4451aca727763.tar.gz |
baremetal: Improve linkerMapFile() test
Right now we can use the cpp.linkerMapSuffix property
to find out the currently used linker map suffix.
Also we can set a custom cpp.linkerMapSuffix value to
make sure that this applies to the module.
In addition, the generation of a custom linker map file
for SDCC toolchain has been fixed.
Change-Id: I8798cd6bea0ab6b5ea9728400827b8c98b11ba7b
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'share/qbs/modules/cpp/sdcc.js')
-rw-r--r-- | share/qbs/modules/cpp/sdcc.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index a47063401..4010e38db 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -641,6 +641,12 @@ function prepareLinker(project, product, inputs, outputs, input, output) { }; cmds.push(cmd); } + + function buildLinkerMapFilePath(target, suffix) { + return FileInfo.joinPaths(FileInfo.path(target.filePath), + FileInfo.completeBaseName(target.fileName) + suffix); + } + // It is a workaround which removes the generated linker map file // if it is disabled by cpp.generateLinkerMapFile property. // Reason is that the SDCC compiler always generates this file, @@ -649,13 +655,22 @@ function prepareLinker(project, product, inputs, outputs, input, output) { // linking completes. if (!product.cpp.generateLinkerMapFile) { cmd = new JavaScriptCommand(); - cmd.mapFilePath = FileInfo.joinPaths( - FileInfo.path(target.filePath), - FileInfo.completeBaseName(target.fileName) + product.cpp.linkerMapSuffix); + cmd.mapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix); cmd.silent = true; cmd.sourceCode = function() { File.remove(mapFilePath); }; cmds.push(cmd); } + // It is a workaround to rename the extension of the output linker + // map file to the specified one, since the linker generates only + // files with the '.map' extension. + if (product.cpp.generateLinkerMapFile && (product.cpp.linkerMapSuffix !== ".map")) { + cmd = new JavaScriptCommand(); + cmd.newMapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix); + cmd.oldMapFilePath = buildLinkerMapFilePath(target, ".map"); + cmd.silent = true; + cmd.sourceCode = function() { File.move(oldMapFilePath, newMapFilePath); }; + cmds.push(cmd); + } return cmds; } |