Skip to content

Commit 689b07e

Browse files
committed
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).
1 parent 014a5ec commit 689b07e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tools/toolchains/arm.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -575,19 +575,25 @@ def get_compile_options(self, defines, includes, for_asm=False):
575575
config_header = self.get_config_header()
576576
if config_header:
577577
opts.extend(self.get_config_option(config_header))
578-
if for_asm:
579-
return [
580-
"--cpreproc",
581-
"--cpreproc_opts=%s" % ",".join(self.flags['common'] + opts)
582-
]
583578
return opts
584579

585580
def assemble(self, source, object, includes):
586-
cmd_pre = copy(self.asm)
581+
# Preprocess first, then assemble
582+
dir = join(dirname(object), '.temp')
583+
mkdir(dir)
584+
tempfile = join(dir, basename(object) + '.E.s')
585+
586+
# Build preprocess assemble command
587+
cmd_pre = copy(self.cc)
587588
cmd_pre.extend(self.get_compile_options(
588589
self.get_symbols(True), includes, for_asm=True))
589-
cmd_pre.extend(["-o", object, source])
590-
return [cmd_pre]
590+
cmd_pre.extend(["-E", "-o", tempfile, source])
591+
592+
# Build main assemble command
593+
cmd = self.asm + ["-o", object, tempfile]
594+
595+
# Return command array, don't execute
596+
return [cmd_pre, cmd]
591597

592598
def compile(self, cc, source, object, includes):
593599
cmd = copy(cc)

0 commit comments

Comments
 (0)