From 8d8cf1acc3805f14d8fd11b52191b929427fd530 Mon Sep 17 00:00:00 2001 From: Leszek Rusinowicz Date: Thu, 21 Mar 2019 11:20:02 +0100 Subject: [PATCH] Workaround for ARMC6 Windows 7 assembler issue On Windows 7 using --preproc option in ARMC6 assembler doesn't work when -MD option is also specified. Compiler creates incorrect filename for dependency file and compilation files. To workaround this issue, this change returns to using a temporary file and separately calling preprocessor and assembler (as in a case of ARMC5). --- tools/toolchains/arm.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 62a132459bf..178e4bb1145 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -583,11 +583,21 @@ def get_compile_options(self, defines, includes, for_asm=False): return opts def assemble(self, source, object, includes): - cmd_pre = copy(self.asm) + # Preprocess first, then assemble + root, _ = splitext(object) + tempfile = root + '.E' + + # Build preprocess assemble command + cmd_pre = copy(self.cc) cmd_pre.extend(self.get_compile_options( - self.get_symbols(True), includes, for_asm=True)) - cmd_pre.extend(["-o", object, source]) - return [cmd_pre] + self.get_symbols(True), includes, for_asm=False)) + cmd_pre.extend(["-E", "-MT", object, "-o", tempfile, source]) + + # Build main assemble command + cmd = self.asm + ["-o", object, tempfile] + + # Return command array, don't execute + return [cmd_pre, cmd] def compile(self, cc, source, object, includes): cmd = copy(cc)