From 9c3efec88084c4dee352ae9ffd61a893fdd7335a Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Thu, 26 Aug 2021 06:51:04 +0000 Subject: [PATCH] Add a build mode for AddressSanitizer --- gnat/spawn.gpr | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gnat/spawn.gpr b/gnat/spawn.gpr index a974393..3f8a0f6 100644 --- a/gnat/spawn.gpr +++ b/gnat/spawn.gpr @@ -27,7 +27,7 @@ library project Spawn is type Library_Kind is ("static", "static-pic", "relocatable"); Library_Type : Library_Kind := external ("LIBRARY_TYPE", "static"); - type Spawn_Build_Kind is ("dev", "prod", "coverage"); + type Spawn_Build_Kind is ("dev", "prod", "coverage", "AddressSanitizer"); Build_Mode : Spawn_Build_Kind := external ("SPAWN_BUILD_MODE", external ("BUILD_MODE", "prod")); @@ -114,6 +114,15 @@ library project Spawn is "--coverage"); Linker_Options := Linker_Options & ("--coverage"); + + when "AddressSanitizer" => + Ada_Switches := Ada_Switches & ( + -- Standard development flags + "-O0", "-g", + -- Enable the AddressSanitizer + "-fsanitize=address"); + + Linker_Options := Linker_Options & ("-fsanitize=address"); end case; package Compiler is