Skip to content

Commit

Permalink
Add option to modify debug flags
Browse files Browse the repository at this point in the history
Some bare metal runtimes require custom debug flags. To
fulfil that requirement the debug flags are now configurable
via common_debug_flags analogous to common_flags.

ref eng/cert/certified-rts#18
  • Loading branch information
jklmnn committed Dec 5, 2023
1 parent 8bde8d9 commit d7ddcc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions support/bsp_sources/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def __init__(self):
'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
9 changes: 5 additions & 4 deletions support/data/target_options.gpr.in
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 d7ddcc0

Please sign in to comment.