Skip to content

Commit

Permalink
Merge branch 'topic/kliemann/certified-rts-18_24_1' into '24.1'
Browse files Browse the repository at this point in the history
Backport:  Allow configurable debug flags

See merge request eng/toolchain/bb-runtimes!61
  • Loading branch information
jklmnn committed Dec 5, 2023
2 parents 6d3fccc + d7ddcc0 commit cfec031
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions support/bsp_sources/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ def install(self, destination, rts_descriptor=None):

# And generate the project files used to build the rts

build_flags = {}
for f in ['common_flags', 'common_gnarl_flags',
'asm_flags', 'c_flags']:
build_flags[f] = '",\n "'.join(rts_obj.build_flags[f])
cnt = readfile(getdatafilepath('target_options.gpr'))
build_flags = {
f: '",\n "'.join(rts_obj.build_flags[f])
for f in rts_obj.build_flags if f.endswith('_flags')
}
cnt = readfile(getdatafilepath('target_options.gpr.in'))
build_flags["gnat_version"] = runtime_sources.version
# Format
cnt = cnt.format(**build_flags)
Expand Down
3 changes: 3 additions & 0 deletions support/bsp_sources/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ def __init__(self):

self.rts_options = RTSProfiles(self)

# Flags for keys in target_options.gpr.in must end in _flags. This is
# to avoid duplicating the list of flags in support/bsp_sources/installer.py.
self.build_flags = {'source_dirs': None,
'common_flags': ['-ffunction-sections',
'-fdata-sections'],
'common_gnarl_flags': [],
'common_debug_flags': ['-g'],
'asm_flags': [],
'c_flags': ['-DIN_RTS', '-Dinhibit_libc', '-DLIGHT_RUNTIME']}
# GNAT-LLVM doesn't support -fcallgraph-info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ abstract project Target_Options is
-- COMFLAGS here is common flags (used for C and Ada).
COMFLAGS := ("{common_flags}");
COMGNARLFLAGS := ("{common_gnarl_flags}");
COMDEBUGFLAGS := ("{common_debug_flags}");

-- Per language flags (COMFLAGS will be added later)
ADAFLAGS := ("-gnatg", "-nostdinc", "-fno-delete-null-pointer-checks");
Expand All @@ -28,17 +29,17 @@ abstract project Target_Options is
ADAFLAGS := ADAFLAGS & ("-gnatp", "-gnatn2");
when "Debug" =>
-- Disable optimization and add debug symbols
COMFLAGS := COMFLAGS & ("-O0", "-g");
ASMFLAGS := ASMFLAGS & ("-g");
COMFLAGS := COMFLAGS & COMDEBUGFLAGS & ("-O0");
ASMFLAGS := ASMFLAGS & COMDEBUGFLAGS;
when "Assert" =>
-- Possibly enable assertions. This might use too much memory on
-- some systems or could be too slow.
COMFLAGS := COMFLAGS & ("-O");
ADAFLAGS := ADAFLAGS & ("-gnata");
when "Gnatcov" =>
-- For coverage
COMFLAGS := COMFLAGS & ("-O0", "-g", "-fdump-scos",
"-fpreserve-control-flow");
COMFLAGS := COMFLAGS & COMDEBUGFLAGS &
("-O0", "-fdump-scos", "-fpreserve-control-flow");
end case;
-- Linker flags, used for building shared libraries
LOPTIONS := ();
Expand Down

0 comments on commit cfec031

Please sign in to comment.