Skip to content

Commit 205a970

Browse files
author
Mohammad Azim Khan
committed
Consolidate coverage flags in one variable as they are same for compile and link. Removed flag -fprofile-dir=. as it is ineffactive in our unconventional build system
1 parent 924b8d8 commit 205a970

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/toolchains/gcc.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class GCC(mbedToolchain):
2929
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
3030
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
3131

32-
COVERAGE_COMPILE_FLAGS = ["-fprofile-arcs", "-ftest-coverage", "-fprofile-dir=."]
33-
COVERAGE_LINK_FLAGS = ["-fprofile-arcs", "-ftest-coverage", "-fprofile-dir=."]
32+
COVERAGE_FLAGS = ["-fprofile-arcs", "-ftest-coverage"]
3433
COVERAGE_MACRO = 'MBED_CFG_DEBUG_OPTIONS_COVERAGE'
3534

3635
def __init__(self, target, notify=None, macros=None,
@@ -191,7 +190,7 @@ def get_compile_options(self, defines, includes, for_asm=False):
191190
def assemble(self, source, object, includes):
192191
# Build assemble command
193192
if self.check_if_coverage_enabled(source):
194-
cmd = self.asm + self.COVERAGE_COMPILE_FLAGS + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source]
193+
cmd = self.asm + self.COVERAGE_FLAGS + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source]
195194
else:
196195
cmd = self.asm + self.get_compile_options(self.get_symbols(True), includes) + ["-o", object, source]
197196

@@ -205,7 +204,7 @@ def assemble(self, source, object, includes):
205204
def compile(self, cc, source, object, includes):
206205
# Build compile command
207206
if self.check_if_coverage_enabled(source):
208-
cmd = cc + self.COVERAGE_COMPILE_FLAGS + self.get_compile_options(self.get_symbols(), includes)
207+
cmd = cc + self.COVERAGE_FLAGS + self.get_compile_options(self.get_symbols(), includes)
209208
else:
210209
cmd = cc + self.get_compile_options(self.get_symbols(), includes)
211210

@@ -236,7 +235,7 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
236235
map_file = splitext(output)[0] + ".map"
237236

238237
if self.coverage_filter:
239-
cmd = self.ld + self.COVERAGE_LINK_FLAGS + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]
238+
cmd = self.ld + self.COVERAGE_FLAGS + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]
240239
else:
241240
cmd = self.ld + ["-o", output, "-Wl,-Map=%s" % map_file] + objects + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]
242241
if mem_map:

0 commit comments

Comments
 (0)