Commit ae5d7f4c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Support C++ runtime for stack checker and cleanup templates

parent 3f79d46a
......@@ -9,7 +9,7 @@ all:
@_LOWER:Node_Names_@_@_Node_CPU_@
@@END_TABLE@@
@@END_INLINE@@
# Check stack usage for all nodes (works with POHIC code only)
# Check stack usage for all tasks of all nodes
python3 ./checkAllStacks.py
# Generate a dynamic library excluding the runtime for each node
......
......@@ -181,8 +181,7 @@ project @_CAPITALIZE:Name_@ is
package Linker is
Common_LD_Switches :=
("-g",
"-lrt",
("-lrt",
"-lpthread",
"-lm",
@@IF@@ @_CPU_Platform_@ = PLATFORM_RPI
......@@ -203,8 +202,12 @@ project @_CAPITALIZE:Name_@ is
for Default_Switches ("C") use Common_LD_Switches;
for Default_Switches ("C++") use Common_LD_Switches;
when "Debug" =>
for Default_Switches ("C") use Common_LD_Switches & "-g" & "-fcommon" & "-fstack-check" & "-fsanitize=address";
for Default_Switches ("C++") use Common_LD_Switches & "-g";
for Default_Switches ("C") use
Common_LD_Switches
& ("-g", "-fcommon", "-fstack-check", "-fsanitize=address");
for Default_Switches ("C++") use
Common_LD_Switches
& ("-g", "-fcommon", "-fstack-check", "-fsanitize=address");
end case;
end Linker;
......
......@@ -81,11 +81,6 @@ project @_CAPITALIZE:Name_@ is
Common_C_Switches :=
("-pthread",
"-I.",
"-I../system_spec",
"-I./runtime",
"-I./runtime/Packetizer",
"-I./runtime/Broker",
"-I./runtime/RuntimeCommon",
@@IF@@ @_Coverage_@
"-fprofile-arcs",
"-ftest-coverage",
......@@ -121,6 +116,7 @@ project @_CAPITALIZE:Name_@ is
("-O0",
"-g")
& Common_C_Switches
& ("-fstack-usage", "-fstack-check", "-fsanitize=address", "-fcommon")
& external_as_list("@_UPPER:Name_@_USER_CFLAGS", " ")
& external_as_list("USER_CFLAGS", " ");
for Default_Switches ("C++") use
......@@ -128,19 +124,20 @@ project @_CAPITALIZE:Name_@ is
"-O0",
"-g")
& Common_C_Switches
& ("-fstack-usage", "-fstack-check", "-fsanitize=address", "-fcommon")
& external_as_list("@_UPPER:Name_@_USER_CFLAGS", " ")
& external_as_list("USER_CFLAGS", " ");
for Default_Switches ("Ada") use
("-Wall",
"-Wextra",
"-gnatd.E");
"-gnatd.E")
& ("-fstack-usage", "-fstack-check");
end case;
end Compiler;
package Linker is
-- for Driver use "g++";
for Default_Switches ("C++") use
Common_LD_Switches :=
("-I.",
"-pthread",
"-lrt",
......@@ -159,6 +156,17 @@ project @_CAPITALIZE:Name_@ is
& external_as_list("@_UPPER:Name_@_USER_LDFLAGS", " ")
& external_as_list("USER_LDFLAGS", " ");
case Build is
when "Release" =>
for Default_Switches ("C") use Common_LD_Switches;
for Default_Switches ("C++") use Common_LD_Switches;
when "Debug" =>
for Default_Switches ("C") use Common_LD_Switches
& ("-g", "-fcommon", "-fstack-check", "-fsanitize=address");
for Default_Switches ("C++") use Common_LD_Switches
& ("-g", "-fcommon", "-fstack-check", "-fsanitize=address");
end case;
end Linker;
package Builder is
......
......@@ -38,6 +38,14 @@ def report_partition_@_LOWER:Name_@():
@@ELSE@@
task_name_job = "Process_Package_" + task_name.title() + "_Job"
@@END_IF@@
@@IF@@ @_CPU_Platform_@ = PLATFORM_GENERIC_LINUX
@@-- N7 runtime use C++ so we must get rid of name mangling
keys = f'''"{'" "'.join(stack_usage.keys())}"'''
noMangling = os.popen(f'c++filt {keys}').readlines()
for idx, key in enumerate(list(stack_usage.keys())):
stack_usage[noMangling[idx].strip('()\n')] = stack_usage.pop(key)
@@END_IF@@
if task_name not in pohic_stack_of:
print("[!] WARNING: Unable to check stack usage of", task_name+"_job")
elif task_name_job not in stack_usage:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment