Skip to content

Commit 9249802

Browse files
authored
Merge pull request #1062 from palmer-dabbelt/libsanitizer
Add an "--enable-libsanitizer" configure-time argument
2 parents ad52c0d + a939758 commit 9249802

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

Makefile.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ WITH_ABI ?= @WITH_ABI@
3535
WITH_TUNE ?= @WITH_TUNE@
3636
WITH_ISA_SPEC ?= @WITH_ISA_SPEC@
3737
SYSROOT := $(INSTALL_DIR)/sysroot
38+
ENABLE_LIBSANITIZER ?= @enable_libsanitizer@
3839

3940
SHELL := /bin/sh
4041
AWK := @GAWK@
@@ -410,9 +411,6 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b
410411
stamps/build-glibc-linux-headers
411412
rm -rf $@ $(notdir $@)
412413
mkdir $(notdir $@)
413-
# libsanitizer not supported rv32,
414-
# but it will break the rv64 multi-lib build, so we disable that
415-
# temporally untill rv32 supported.
416414
cd $(notdir $@) && $</configure \
417415
--target=$(LINUX_TUPLE) \
418416
$(CONFIGURE_HOST) \
@@ -426,7 +424,7 @@ stamps/build-gcc-linux-stage2: $(GCC_SRCDIR) $(GCC_SRC_GIT) $(addprefix stamps/b
426424
--disable-libmudflap \
427425
--disable-libssp \
428426
--disable-libquadmath \
429-
--disable-libsanitizer \
427+
$(ENABLE_LIBSANITIZER) \
430428
--disable-nls \
431429
--disable-bootstrap \
432430
--src=$(gccsrcdir) \

configure

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ PACKAGE_URL=''
585585
ac_subst_vars='LTLIBOBJS
586586
LIBOBJS
587587
with_linux_headers_src
588+
enable_libsanitizer
588589
with_qemu_src
589590
with_gdb_src
590591
with_musl_src
@@ -692,6 +693,7 @@ with_musl_src
692693
with_gdb_src
693694
with_qemu_src
694695
with_linux_headers_src
696+
enable_libsanitizer
695697
'
696698
ac_precious_vars='build_alias
697699
host_alias
@@ -1329,6 +1331,7 @@ Optional Features:
13291331
slow, only enable it when developing gcc
13301332
[--disable-gcc-checking]
13311333
--disable-gdb Don't build GDB, as it's not upstream
1334+
--enable-libsanitizer Build libsanitizer, which only supports rv64
13321335
13331336
Optional Packages:
13341337
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -3675,6 +3678,23 @@ else
36753678
fi
36763679
36773680
3681+
# Check whether --enable-libsanitizer was given.
3682+
if test "${enable_libsanitizer+set}" = set; then :
3683+
enableval=$enable_libsanitizer;
3684+
else
3685+
enable_libsanitizer=no
3686+
3687+
fi
3688+
3689+
3690+
if test "x$enable_libsanitizer" != xno; then :
3691+
enable_libsanitizer=--enable-libsanitizer
3692+
3693+
else
3694+
enable_libsanitizer=--disable-libsanitizer
3695+
3696+
fi
3697+
36783698
if test "x$with_linux_headers_src" != xdefault; then :
36793699
with_linux_headers_src=$with_linux_headers_src
36803700

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,17 @@ AC_ARG_WITH(linux-headers-src,
242242
[with_linux_headers_src=default]
243243
)
244244

245+
AC_ARG_ENABLE(libsanitizer,
246+
[AS_HELP_STRING([--enable-libsanitizer],
247+
[Build libsanitizer, which only supports rv64])],
248+
[],
249+
[enable_libsanitizer=no]
250+
)
251+
252+
AS_IF([test "x$enable_libsanitizer" != xno],
253+
[AC_SUBST(enable_libsanitizer, --enable-libsanitizer)],
254+
[AC_SUBST(enable_libsanitizer, --disable-libsanitizer)])
255+
245256
AS_IF([test "x$with_linux_headers_src" != xdefault],
246257
[AC_SUBST(with_linux_headers_src,$with_linux_headers_src)],
247258
[AC_SUBST(with_linux_headers_src,"\$(srcdir)/linux-headers/include")])

0 commit comments

Comments
 (0)