+CFLAGS_SANITIZER :=
+CXXFLAGS_SANITIZER :=
+LDFLAGS_SANITIZER :=
+ifeq ($(RC_ENABLE_ADDRESS_SANITIZATION),1)
+ $(info Enabling Address Sanitizer)
+ ASAN_FLAGS:=-fsanitize=address
+ CFLAGS_SANITIZER += $(ASAN_FLAGS)
+ CXXFLAGS_SANITIZER += $(ASAN_FLAGS)
+ LDFLAGS_SANITIZER += $(ASAN_FLAGS)
+endif
+
+ifeq ($(RC_ENABLE_UNDEFINED_BEHAVIOR_SANITIZATION),1)
+ $(info Enabling Undefined Behaviour Sanitizer)
+ UBSAN_FLAGS:=-fsanitize=undefined
+ CFLAGS_SANITIZER += $(UBSAN_FLAGS)
+ CXXFLAGS_SANITIZER += $(UBSAN_FLAGS)
+ LDFLAGS_SANITIZER += $(UBSAN_FLAGS)
+endif
+
+ifeq ($(RC_ENABLE_THREAD_SANITIZATION),1)
+ $(info Enabling Thread Sanitizer)
+ TSAN_FLAGS:=-fsanitize=thread
+ CFLAGS_SANITIZER += $(TSAN_FLAGS)
+ CXXFLAGS_SANITIZER += $(TSAN_FLAGS)
+ LDFLAGS_SANITIZER += $(TSAN_FLAGS)
+endif
+LDFLAGS += $(LDFLAGS_SANITIZER)
+