Enable ubsan configure argument for CS (#2658)

* Refactor --enable-ubsan to m4 macro and include it from racket and cs
* Regenerate configure scripts
* upload ubsan artifacts even if it fails
This commit is contained in:
Paulo Matos 2019-05-20 11:41:22 +02:00 committed by GitHub
parent 18e897bfb8
commit 6e7920e204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 8 deletions

View File

@ -129,6 +129,7 @@ test:ubsan:
after_script:
- grep 'runtime error' logs/*.log > runtime-errors.log
artifacts:
when: always
paths:
- logs/
- runtime-errors.log
@ -161,6 +162,7 @@ test:ubsan:cs:
after_script:
- grep 'runtime error' cs-logs/*.log > runtime-errors.log
artifacts:
when: always
paths:
- cs-logs/
- runtime-errors.log

7
racket/src/ac/ubsan.m4 Normal file
View File

@ -0,0 +1,7 @@
if test "${enable_ubsan}" = "yes" ; then
UBSAN="-fsanitize=undefined -fno-sanitize=alignment -fno-sanitize=float-divide-by-zero"
CFLAGS="$CFLAGS $UBSAN"
CPPFLAGS="$CPPFLAGS $UBSAN"
PREFLAGS="$PREFLAGS $UBSAN"
LDFLAGS="$LDFLAGS $UBSAN"
fi

View File

@ -0,0 +1 @@
AC_ARG_ENABLE(ubsan, [ --enable-ubsan compile with -fsanitize=undefined)])

View File

@ -2880,6 +2880,7 @@ if test "${enable_ubsan+set}" = set; then :
enableval=$enable_ubsan;
fi
# Check whether --enable-jitframe was given.
if test "${enable_jitframe+set}" = set; then :
enableval=$enable_jitframe;
@ -6763,6 +6764,7 @@ if test "${enable_ubsan}" = "yes" ; then
LDFLAGS="$LDFLAGS $UBSAN"
fi
############## usersetup ################
if test "${enable_usersetup}" != "yes" ; then

View File

@ -780,6 +780,7 @@ enable_libfw
enable_userfw
enable_mac64
enable_noopt
enable_ubsan
enable_csdefault
enable_csonly
enable_parent
@ -1422,6 +1423,7 @@ Optional Features:
--enable-userfw install Mac OS frameworks to ~/Library/Frameworks
--enable-mac64 allow 64-bit Mac OS build (enabled by default)
--enable-strip strip debug on install (usually enabled by default)
--enable-ubsan compile with -fsanitize=undefined)
--enable-csdefault use CS as default build
--enable-csonly build CS only
--enable-parent Create "../Makefile" (internal use)
@ -2437,6 +2439,12 @@ strip_debug_flags=""
enable_strip_by_default=yes
strip_needs_dash_s=no
# Check whether --enable-ubsan was given.
if test "${enable_ubsan+set}" = set; then :
enableval=$enable_ubsan;
fi
# Check whether --enable-csdefault was given.
if test "${enable_csdefault+set}" = set; then :
enableval=$enable_csdefault;
@ -4315,6 +4323,17 @@ if test "${enable_natipkg}" = "yes" ; then
CONFIGURE_RACKET_SO_COMPILE="${CONFIGURE_RACKET_SO_COMPILE} env PLT_CS_SLSP_SUFFIX=-natipkg"
fi
############## ubsan ################
if test "${enable_ubsan}" = "yes" ; then
UBSAN="-fsanitize=undefined -fno-sanitize=alignment -fno-sanitize=float-divide-by-zero"
CFLAGS="$CFLAGS $UBSAN"
CPPFLAGS="$CPPFLAGS $UBSAN"
PREFLAGS="$PREFLAGS $UBSAN"
LDFLAGS="$LDFLAGS $UBSAN"
fi
############## Makefile includes ################
if test "$INCLUDEDEP" = "#" ; then

View File

@ -25,6 +25,7 @@ AC_ARG_ENABLE(target, [ --enable-target=<mach> Cross-build for Chez Scheme
m4_include(../ac/natipkg_arg.m4)
m4_include(../ac/sdk_arg.m4)
m4_include(../ac/strip_arg.m4)
m4_include(../ac/ubsan_arg.m4)
AC_ARG_ENABLE(csdefault, [ --enable-csdefault use CS as default build])
AC_ARG_ENABLE(csonly, [ --enable-csonly build CS only])
AC_ARG_ENABLE(parent, [ --enable-parent Create "../Makefile" (internal use)])
@ -415,6 +416,10 @@ if test "${enable_natipkg}" = "yes" ; then
CONFIGURE_RACKET_SO_COMPILE="${CONFIGURE_RACKET_SO_COMPILE} env PLT_CS_SLSP_SUFFIX=-natipkg"
fi
############## ubsan ################
m4_include(../ac/ubsan.m4)
############## Makefile includes ################
if test "$INCLUDEDEP" = "#" ; then

View File

@ -78,7 +78,7 @@ AC_ARG_ENABLE(gcov, [ --enable-gcov compile to gather gcov statist
m4_include(../ac/strip_arg.m4)
AC_ARG_ENABLE(noopt, [ --enable-noopt drop -O C flags (useful for low-level debugging)])
AC_ARG_ENABLE(ubsan, [ --enable-ubsan compile with -fsanitize=undefined)])
m4_include(../ac/ubsan_arg.m4)
AC_ARG_ENABLE(jitframe,[ --enable-jitframe x86_64: use frame pointer for internal calls])
m4_include(../ac/crossany_arg.m4)
@ -1289,13 +1289,7 @@ fi
############## ubsan ################
if test "${enable_ubsan}" = "yes" ; then
UBSAN="-fsanitize=undefined -fno-sanitize=alignment -fno-sanitize=float-divide-by-zero"
CFLAGS="$CFLAGS $UBSAN"
CPPFLAGS="$CPPFLAGS $UBSAN"
PREFLAGS="$PREFLAGS $UBSAN"
LDFLAGS="$LDFLAGS $UBSAN"
fi
m4_include(../ac/ubsan.m4)
############## usersetup ################