mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 12:17:35 +00:00
Add --enable-m32 to configure
This commit is contained in:
parent
6016e74b55
commit
24b5215cf9
58
configure.ac
58
configure.ac
@ -52,7 +52,7 @@ AC_MSG_CHECKING(whether to use tcmalloc)
|
||||
AC_ARG_ENABLE([tcmalloc],
|
||||
[AS_HELP_STRING([--enable-tcmalloc],
|
||||
[Use libtcmalloc_minimal for faster dynamic memory
|
||||
management in Verilator binary@<:@default=check@:>@])],
|
||||
management in Verilator binary @<:@default=check@:>@])],
|
||||
[case "${enableval}" in
|
||||
yes) CFG_WITH_TCMALLOC=yes ;;
|
||||
no) CFG_WITH_TCMALLOC=no ;;
|
||||
@ -61,6 +61,20 @@ AC_ARG_ENABLE([tcmalloc],
|
||||
[CFG_WITH_TCMALLOC=check;])
|
||||
AC_MSG_RESULT($CFG_WITH_TCMALLOC)
|
||||
|
||||
# Flag to enable -m32 build
|
||||
AC_MSG_CHECKING(whether to use -m32)
|
||||
AC_ARG_ENABLE([m32],
|
||||
[AS_HELP_STRING([--enable-m32],
|
||||
[Use -m32 for all compilation and link,
|
||||
including Verialtor and generated models.])],
|
||||
[case "${enableval}" in
|
||||
yes) CFG_ENABLE_M32=yes ;;
|
||||
no) CFG_ENABLE_M32=no ;;
|
||||
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-m32]) ;;
|
||||
esac],
|
||||
CFG_ENABLE_M32=no)
|
||||
AC_MSG_RESULT($CFG_ENABLE_M32)
|
||||
|
||||
# Special Substitutions - CFG_WITH_DEFENV
|
||||
AC_MSG_CHECKING(whether to use hardcoded paths)
|
||||
AC_ARG_ENABLE([defenv],
|
||||
@ -211,24 +225,34 @@ AC_DEFUN([_MY_CXX_CHECK_FLAG],
|
||||
CXXFLAGS="$ACO_SAVE_CXXFLAGS"
|
||||
])
|
||||
|
||||
AC_DEFUN([_MY_CXX_CHECK_IFELSE],
|
||||
[# _MY_CXX_CHECK_IFELSE(option,action-if-supported,action-if-not-supported)
|
||||
# Check if compiler supports specific option. If it does,
|
||||
# do action-if-supported, otherwise do action-if-not-supported
|
||||
_MY_CXX_CHECK_FLAG($1)
|
||||
if test "$_my_result" = "yes" ; then
|
||||
true
|
||||
$2
|
||||
else
|
||||
true
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([_MY_CXX_CHECK_SET],
|
||||
[# _MY_CXX_CHECK_SET(variable,flag) -- Check if compiler supports specific options
|
||||
# If it does, set variable to flag, only if not previously set
|
||||
[# _MY_CXX_CHECK_SET(variable,option)
|
||||
# Check if compiler supports specific option. If it does,
|
||||
# set variable to option, only if not previously set.
|
||||
if test "$$1" = ""; then
|
||||
_MY_CXX_CHECK_FLAG($2)
|
||||
if test "$_my_result" = "yes" ; then
|
||||
$1="$2"
|
||||
fi
|
||||
_MY_CXX_CHECK_IFELSE($2, $1="$2")
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([_MY_CXX_CHECK_OPT],
|
||||
[# _MY_CXX_CHECK_OPT(flag) -- Check if compiler supports specific options
|
||||
# If it does, append flag to variable
|
||||
_MY_CXX_CHECK_FLAG($2)
|
||||
if test "$_my_result" = "yes" ; then
|
||||
$1="$$1 $2"
|
||||
fi
|
||||
[# _MY_CXX_CHECK_OPT(variable,option)
|
||||
# Check if compiler supports specific option. If it does,
|
||||
# append option to variable
|
||||
_MY_CXX_CHECK_IFELSE($2, $1="$$1 $2")
|
||||
])
|
||||
|
||||
AC_DEFUN([_MY_LDLIBS_CHECK_FLAG],
|
||||
@ -270,6 +294,14 @@ AC_DEFUN([_MY_LDLIBS_CHECK_OPT],
|
||||
_MY_LDLIBS_CHECK_IFELSE($2, $1="$$1 $2")
|
||||
])
|
||||
|
||||
# When using -m32. Check this first as later checks may fail with the -m32 flag.
|
||||
if test "$CFG_ENABLE_M32" = "yes"; then
|
||||
_MY_CXX_CHECK_IFELSE(
|
||||
-m32,
|
||||
[CXX="$CXX -m32"],
|
||||
[AC_MSG_ERROR([--enable-m32 was given but compiler does not support -m32])])
|
||||
fi
|
||||
|
||||
# Flag to select newest language standard supported
|
||||
# Macros work such that first option that passes is the one we take
|
||||
# Currently enabled gnu++14/c++14 due to packaged SystemC dependency
|
||||
|
@ -601,6 +601,7 @@ sub new {
|
||||
? " -Wl,-undefined,dynamic_lookup"
|
||||
: " -export-dynamic")
|
||||
.($opt_verbose ? " -DTEST_VERBOSE=1":"")
|
||||
.(cfg_with_m32() ? " -m32" : "")
|
||||
." -o $self->{obj_dir}/libvpi.so"],
|
||||
tool_c_flags => [],
|
||||
# ATSIM
|
||||
@ -2304,8 +2305,16 @@ sub cfg_with_threaded {
|
||||
return 1; # C++11 now always required
|
||||
}
|
||||
|
||||
our $_Cfg_with_ccache;
|
||||
sub cfg_with_ccache {
|
||||
return `grep "OBJCACHE \?= ccache" "$ENV{VERILATOR_ROOT}/include/verilated.mk"` ne "";
|
||||
$_Cfg_with_ccache ||= `grep "OBJCACHE \?= ccache" "$ENV{VERILATOR_ROOT}/include/verilated.mk"` ne "";
|
||||
return $_Cfg_with_ccache;
|
||||
}
|
||||
|
||||
our $_Cfg_with_m32;
|
||||
sub cfg_with_m32 {
|
||||
$_Cfg_with_m32 ||= `grep "CXX.*=.*-m32" "$ENV{VERILATOR_ROOT}/include/verilated.mk"` ne "";
|
||||
return $_Cfg_with_m32;
|
||||
}
|
||||
|
||||
sub tries {
|
||||
|
@ -10,14 +10,16 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
|
||||
scenarios(vlt => 1);
|
||||
|
||||
my $m32 = $Self->cfg_with_m32 ? "-m32" : "";
|
||||
|
||||
run(cmd => ["cd $Self->{obj_dir}"
|
||||
." && $ENV{CXX} -c ../../t/t_flag_ldflags_a.cpp"
|
||||
." && $ENV{CXX} $m32 -c ../../t/t_flag_ldflags_a.cpp"
|
||||
." && ar -cr t_flag_ldflags_a.a t_flag_ldflags_a.o"
|
||||
." && ranlib t_flag_ldflags_a.a "],
|
||||
check_finished => 0);
|
||||
run(cmd => ["cd $Self->{obj_dir}"
|
||||
." && $ENV{CXX} -fPIC -c ../../t/t_flag_ldflags_so.cpp"
|
||||
." && $ENV{CXX} -shared -o t_flag_ldflags_so.so -lc t_flag_ldflags_so.o"],
|
||||
." && $ENV{CXX} $m32 -fPIC -c ../../t/t_flag_ldflags_so.cpp"
|
||||
." && $ENV{CXX} $m32 -shared -o t_flag_ldflags_so.so -lc t_flag_ldflags_so.o"],
|
||||
check_finished => 0);
|
||||
|
||||
compile(
|
||||
|
@ -10,6 +10,10 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
|
||||
scenarios(vltmt => 1);
|
||||
|
||||
if ($Self->cfg_with_m32) {
|
||||
skip("Does not work with -m32 (resource unavailable)");
|
||||
}
|
||||
|
||||
compile(
|
||||
verilator_flags2 => ['--cc --threads 1024'],
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user