mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Testing: Add --enable-asan configure option to compile with AddressSanitizer (#6404)
This commit is contained in:
@@ -29,6 +29,21 @@
|
||||
|
||||
VL_DEFINE_DEBUG_FUNCTIONS;
|
||||
|
||||
//######################################################################
|
||||
// AddressSanitizer default options
|
||||
|
||||
#ifdef VL_ASAN
|
||||
extern "C" const char* __asan_default_options() {
|
||||
// See https://github.com/google/sanitizers/wiki/SanitizerCommonFlags
|
||||
// or 'env ASAN_OPTIONS=help=1 ./verilator_bin'
|
||||
return ""
|
||||
#ifndef VL_LEAK_CHECKS
|
||||
":detect_leaks=0"
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
//######################################################################
|
||||
// V3Global
|
||||
|
||||
|
||||
@@ -817,6 +817,8 @@ string V3Options::getSupported(const string& var) {
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
} else if (var == "SYSTEMC" && systemCFound()) {
|
||||
return "1";
|
||||
} else if (var == "ASAN" && builtWithAsan()) {
|
||||
return "1";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@@ -843,6 +845,14 @@ bool V3Options::coroutineSupport() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool V3Options::builtWithAsan() {
|
||||
#ifdef HAVE_ASAN
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// V3 Options notification methods
|
||||
|
||||
|
||||
@@ -821,6 +821,7 @@ public:
|
||||
static bool systemCSystemWide();
|
||||
static bool systemCFound(); // SystemC installed, or environment points to it
|
||||
static bool coroutineSupport(); // Compiler supports coroutines
|
||||
static bool builtWithAsan(); // Compiler built with AddressSanitizer
|
||||
|
||||
// METHODS (file utilities using these options)
|
||||
string fileExists(const string& filename);
|
||||
|
||||
@@ -44,6 +44,9 @@ PACKAGE_VERSION_STRING_CHAR
|
||||
// Define if compiled with tcmalloc
|
||||
#undef HAVE_TCMALLOC
|
||||
|
||||
// Define if compiled with AddressSanitizer
|
||||
#undef HAVE_ASAN
|
||||
|
||||
//**********************************************************************
|
||||
//**** This file sometimes gets truncated, so check in consumers
|
||||
#define HAVE_CONFIG_PACKAGE
|
||||
|
||||
Reference in New Issue
Block a user