Skip to content

Commit cfec031

Browse files
committed
Merge branch 'topic/kliemann/certified-rts-18_24_1' into '24.1'
Backport: Allow configurable debug flags See merge request eng/toolchain/bb-runtimes!61
2 parents 6d3fccc + d7ddcc0 commit cfec031

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

support/bsp_sources/installer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ def install(self, destination, rts_descriptor=None):
267267

268268
# And generate the project files used to build the rts
269269

270-
build_flags = {}
271-
for f in ['common_flags', 'common_gnarl_flags',
272-
'asm_flags', 'c_flags']:
273-
build_flags[f] = '",\n "'.join(rts_obj.build_flags[f])
274-
cnt = readfile(getdatafilepath('target_options.gpr'))
270+
build_flags = {
271+
f: '",\n "'.join(rts_obj.build_flags[f])
272+
for f in rts_obj.build_flags if f.endswith('_flags')
273+
}
274+
cnt = readfile(getdatafilepath('target_options.gpr.in'))
275275
build_flags["gnat_version"] = runtime_sources.version
276276
# Format
277277
cnt = cnt.format(**build_flags)

support/bsp_sources/target.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,13 @@ def __init__(self):
162162

163163
self.rts_options = RTSProfiles(self)
164164

165+
# Flags for keys in target_options.gpr.in must end in _flags. This is
166+
# to avoid duplicating the list of flags in support/bsp_sources/installer.py.
165167
self.build_flags = {'source_dirs': None,
166168
'common_flags': ['-ffunction-sections',
167169
'-fdata-sections'],
168170
'common_gnarl_flags': [],
171+
'common_debug_flags': ['-g'],
169172
'asm_flags': [],
170173
'c_flags': ['-DIN_RTS', '-Dinhibit_libc', '-DLIGHT_RUNTIME']}
171174
# GNAT-LLVM doesn't support -fcallgraph-info
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ abstract project Target_Options is
1616
-- COMFLAGS here is common flags (used for C and Ada).
1717
COMFLAGS := ("{common_flags}");
1818
COMGNARLFLAGS := ("{common_gnarl_flags}");
19+
COMDEBUGFLAGS := ("{common_debug_flags}");
1920

2021
-- Per language flags (COMFLAGS will be added later)
2122
ADAFLAGS := ("-gnatg", "-nostdinc", "-fno-delete-null-pointer-checks");
@@ -28,17 +29,17 @@ abstract project Target_Options is
2829
ADAFLAGS := ADAFLAGS & ("-gnatp", "-gnatn2");
2930
when "Debug" =>
3031
-- Disable optimization and add debug symbols
31-
COMFLAGS := COMFLAGS & ("-O0", "-g");
32-
ASMFLAGS := ASMFLAGS & ("-g");
32+
COMFLAGS := COMFLAGS & COMDEBUGFLAGS & ("-O0");
33+
ASMFLAGS := ASMFLAGS & COMDEBUGFLAGS;
3334
when "Assert" =>
3435
-- Possibly enable assertions. This might use too much memory on
3536
-- some systems or could be too slow.
3637
COMFLAGS := COMFLAGS & ("-O");
3738
ADAFLAGS := ADAFLAGS & ("-gnata");
3839
when "Gnatcov" =>
3940
-- For coverage
40-
COMFLAGS := COMFLAGS & ("-O0", "-g", "-fdump-scos",
41-
"-fpreserve-control-flow");
41+
COMFLAGS := COMFLAGS & COMDEBUGFLAGS &
42+
("-O0", "-fdump-scos", "-fpreserve-control-flow");
4243
end case;
4344
-- Linker flags, used for building shared libraries
4445
LOPTIONS := ();

0 commit comments

Comments
 (0)