Internals: Rename --enable-asan to --enable-dev-asan and related

This commit is contained in:
Geza Lore 2025-10-03 12:02:33 +01:00
parent 2c74765246
commit 62dbbbba85
10 changed files with 36 additions and 35 deletions

View File

@ -18,7 +18,7 @@ Verilator 5.041 devel
* Add verilator_gantt profiling of DPI imports (#3084). [Geza Lore]
* Add ASSIGNEQEXPR when use `=` inside expressions (#5567). [Ethan Sifferman]
* Add error on non-packed struct randc (#5999). [Seth Pellegrino]
* Add configure `--enable-asan` to compile verilator_bin with the address sanitizer (#6404). [Geza Lore]
* Add configure `--enable-dev-asan` to compile verilator_bin with the address sanitizer (#6404). [Geza Lore]
* Add $(LDFLAGS) and $(LIBS) to when building shared libraries (#6425) (#6426). [Ahmed El-Mahmoudy]
* Add IMPLICITSTATIC also on procedure variables.
* Add FUNCTIMCTL error on function invoking task or time-controlling statements (#6385).

View File

@ -205,7 +205,7 @@ sub ulimit_stack_unlimited {
return "" if !$opt_unlimited_stack;
my $limit = "unlimited";
# AddressSanitizer doesn't work with 'ulimit -s unlimted'
if (`${\(verilator_bin())} --get-supported ASAN` eq "1\n") {
if (`${\(verilator_bin())} --get-supported DEV_ASAN` eq "1\n") {
# Use host 'physical memory / #cores / 8' instead
open(my $fh, "<", "/proc/meminfo") || die "Can't read host memory for asan";
while (<$fh>) {

View File

@ -43,7 +43,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
autoconf
CONFIGURE_ARGS="--enable-longtests --enable-ccwarn"
if [ "$CI_ASAN" = 1 ]; then
CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-asan"
CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-dev-asan"
CXX="$CXX -DVL_LEAK_CHECKS"
fi
./configure $CONFIGURE_ARGS --prefix="$INSTALL_DIR"

View File

@ -59,19 +59,19 @@ AC_MSG_RESULT($CFG_ENABLE_PARTIAL_STATIC)
# Flag to enable compiling with AddressSanitizer
AC_MSG_CHECKING(whether to use AddressSanitizer)
AC_ARG_ENABLE([asan],
[AS_HELP_STRING([--enable-asan],
AC_ARG_ENABLE([dev-asan],
[AS_HELP_STRING([--enable-dev-asan],
[Enable compiling Verilator with ASAN
AddressSanitizer for memory error detection.
This disables tcmalloc. Does not affect
Verilated models using ASAN.])],
[case "${enableval}" in
yes) CFG_WITH_ASAN=yes ;;
no) CFG_WITH_ASAN=no ;;
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-asan]) ;;
yes) CFG_WITH_DEV_ASAN=yes ;;
no) CFG_WITH_DEV_ASAN=no ;;
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-dev-asan]) ;;
esac],
CFG_WITH_ASAN=no)
AC_MSG_RESULT($CFG_WITH_ASAN)
CFG_WITH_DEV_ASAN=no)
AC_MSG_RESULT($CFG_WITH_DEV_ASAN)
# Flag to enable linking Verilator with tcmalloc if available
AC_MSG_CHECKING(whether to use tcmalloc)
@ -85,9 +85,9 @@ AC_ARG_ENABLE([tcmalloc],
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-tcmalloc]) ;;
esac],
[CFG_WITH_TCMALLOC=check;])
if test "$CFG_WITH_ASAN" = "yes"; then
if test "$CFG_WITH_DEV_ASAN" = "yes"; then
CFG_WITH_TCMALLOC=no
AC_MSG_RESULT("disabled by --enable-asan")
AC_MSG_RESULT("disabled by --enable-dev-asan")
else
AC_MSG_RESULT($CFG_WITH_TCMALLOC)
fi
@ -453,14 +453,14 @@ AC_SUBST(CFG_CXXFLAGS_COROUTINES)
AC_SUBST(HAVE_COROUTINES)
# Flags for compiling Verilator internals including parser always
if test "$CFG_WITH_ASAN" = "yes"; then
if test "$CFG_WITH_DEV_ASAN" = "yes"; then
_MY_CXX_CHECK_IFELSE(-fsanitize=address -DVL_ASAN,
[CFG_CXXFLAGS_SRC="$CFG_CXXFLAGS_SRC -fsanitize=address -DVL_ASAN"
CFG_LDFLAGS_SRC="$CFG_LDFLAGS_SRC -fsanitize=address"
AC_DEFINE([HAVE_ASAN],[1],[Defined if built with AddresSanitizer])]
AC_DEFINE([HAVE_DEV_ASAN],[1],[Defined if built with AddresSanitizer])]
)
fi
AC_SUBST(HAVE_ASAN)
AC_SUBST(HAVE_DEV_ASAN)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)

View File

@ -780,7 +780,7 @@ Summary:
be useful in makefiles. See also :vlopt:`-V`, and the various
:file:`*.mk` files.
Feature may be one of the following: COROUTINES, SYSTEMC, ASAN.
Feature may be one of the following: COROUTINES, DEV_ASAN, SYSTEMC.
.. option:: --getenv <variable>

View File

@ -841,11 +841,11 @@ string V3Options::getSupported(const string& var) {
// If update below, also update V3Options::showVersion()
if (var == "COROUTINES" && coroutineSupport()) {
return "1";
} else if (var == "DEV_ASAN" && devAsan()) {
return "1";
// cppcheck-suppress knownConditionTrueFalse
} else if (var == "SYSTEMC" && systemCFound()) {
return "1";
} else if (var == "ASAN" && builtWithAsan()) {
return "1";
} else {
return "";
}
@ -872,8 +872,8 @@ bool V3Options::coroutineSupport() {
#endif
}
bool V3Options::builtWithAsan() {
#ifdef HAVE_ASAN
bool V3Options::devAsan() {
#ifdef HAVE_DEV_ASAN
return true;
#else
return false;

View File

@ -784,7 +784,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
static bool devAsan(); // Compiler built with AddressSanitizer
// METHODS (file utilities using these options)
string fileExists(const string& filename);

View File

@ -45,7 +45,7 @@ PACKAGE_VERSION_STRING_CHAR
#undef HAVE_TCMALLOC
// Define if compiled with AddressSanitizer
#undef HAVE_ASAN
#undef HAVE_DEV_ASAN
//**********************************************************************
//**** This file sometimes gets truncated, so check in consumers

View File

@ -126,8 +126,8 @@ class Capabilities:
# @lru_cache(maxsize=1024) broken with @staticmethod on older pythons we use
_cached_cmake_version = None
_cached_cxx_version = None
_cached_have_asan = None
_cached_have_coroutines = None
_cached_have_dev_asan = None
_cached_have_gdb = None
_cached_have_sc = None
_cached_have_solver = None
@ -154,12 +154,6 @@ class Capabilities:
return Capabilities._cached_cxx_version
@staticproperty
def have_asan() -> bool: # pylint: disable=no-method-argument
if Capabilities._cached_have_asan is None:
Capabilities._cached_have_asan = bool(Capabilities._verilator_get_supported('ASAN'))
return Capabilities._cached_have_asan
@staticproperty
def have_coroutines() -> bool: # pylint: disable=no-method-argument
if Capabilities._cached_have_coroutines is None:
@ -167,6 +161,13 @@ class Capabilities:
Capabilities._verilator_get_supported('COROUTINES'))
return Capabilities._cached_have_coroutines
@staticproperty
def have_dev_asan() -> bool: # pylint: disable=no-method-argument
if Capabilities._cached_have_dev_asan is None:
Capabilities._cached_have_dev_asan = bool(
Capabilities._verilator_get_supported('DEV_ASAN'))
return Capabilities._cached_have_dev_asan
@staticproperty
def have_gdb() -> bool: # pylint: disable=no-method-argument
if Capabilities._cached_have_gdb is None:
@ -211,8 +212,8 @@ class Capabilities:
# Fetch
@staticmethod
def warmup_cache() -> None:
_ignore = Capabilities.have_asan
_ignore = Capabilities.have_coroutines
_ignore = Capabilities.have_dev_asan
_ignore = Capabilities.have_gdb
_ignore = Capabilities.have_sc
_ignore = Capabilities.have_solver
@ -1650,10 +1651,6 @@ class VlTest:
def cxx_version(self) -> str:
return Capabilities.cxx_version
@property
def have_asan(self) -> bool:
return Capabilities.have_asan
@property
def have_cmake(self) -> bool:
ver = Capabilities.cmake_version
@ -1668,6 +1665,10 @@ class VlTest:
def have_coroutines(self) -> bool:
return Capabilities.have_coroutines
@property
def have_dev_asan(self) -> bool:
return Capabilities.have_dev_asan
@property
def have_gdb(self) -> bool:
return Capabilities.have_gdb

View File

@ -19,7 +19,7 @@ with open(test.top_filename, "w", encoding="utf8") as f:
f.write(f" int x{i} = 'd{i};\n")
f.write("endmodule\n")
test.timeout(30 if not test.have_asan else 60)
test.timeout(30 if not test.have_dev_asan else 60)
test.lint(verilator_flags2=[f"--max-num-width {2**29}"])