diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2020-09-14 14:35:45 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2020-09-17 15:06:29 +0000 |
commit | cbda67789e6c59363908ca0f5da728db07c1ebdc (patch) | |
tree | 1b51da0bfc172ef95b7fa0b30dec3c90bc4b628a /share | |
parent | 8f8a7b8110c0ebef04c3dba4075bfeb1dd3ac169 (diff) |
baremetal: Pass 'generate-linker-map' test for SDCC toolchain
A problem is that the SDCC toolchain has not an option
to disable the generation for the linker MAP file.
So, we need to remove this file explicitly after the linking,
when the cpp.generateLinkerMapFile property is in false.
Change-Id: Ic1e5cb08066441b51d86aece09acd5fae91a83f2
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/sdcc.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index ad2a99896..b7df93299 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -579,11 +579,11 @@ function prepareAssembler(project, product, inputs, outputs, input, output, expl function prepareLinker(project, product, inputs, outputs, input, output) { var cmds = []; - var primaryOutput = outputs.application[0]; + var target = outputs.application[0]; var args = linkerFlags(project, product, inputs, outputs); var linkerPath = effectiveLinkerPath(product); var cmd = new Command(linkerPath, args); - cmd.description = "linking " + primaryOutput.fileName; + cmd.description = "linking " + target.fileName; cmd.highlight = "linker"; cmds.push(cmd); @@ -609,6 +609,21 @@ function prepareLinker(project, product, inputs, outputs, input, output) { }; cmds.push(cmd); } + // 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, + // and does not have an option to disable generation for a linker + // map file. So, we can to remove a listing files only after the + // linking completes. + if (!product.cpp.generateLinkerMapFile) { + cmd = new JavaScriptCommand(); + cmd.mapFilePath = FileInfo.joinPaths( + FileInfo.path(target.filePath), + FileInfo.completeBaseName(target.fileName) + ".map"); + cmd.sourceCode = function() { File.remove(mapFilePath); }; + cmds.push(cmd); + } + return cmds; } |