mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
libsanitizer: Add option to bootstrap using HWASAN
This is an analogous option to --bootstrap-asan to configure. It allows bootstrapping GCC using HWASAN. For the same reasons as for ASAN we have to avoid using the HWASAN sanitizer when compiling libiberty and the lto-plugin. Also add a function to query whether -fsanitize=hwaddress has been passed. ChangeLog: * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: * bootstrap-hwasan.mk: New file. gcc/ChangeLog: * doc/install.texi: Document new option. libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Avoid using sanitizer. lto-plugin/ChangeLog: * Makefile.am: Avoid using sanitizer. * Makefile.in: Regenerate.
This commit is contained in:
parent
8a769f816f
commit
170e618ef5
8
config/bootstrap-hwasan.mk
Normal file
8
config/bootstrap-hwasan.mk
Normal file
@ -0,0 +1,8 @@
|
||||
# This option enables -fsanitize=hwaddress for stage2 and stage3.
|
||||
|
||||
STAGE2_CFLAGS += -fsanitize=hwaddress
|
||||
STAGE3_CFLAGS += -fsanitize=hwaddress
|
||||
POSTSTAGE1_LDFLAGS += -fsanitize=hwaddress -static-libhwasan \
|
||||
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
|
||||
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/hwasan/ \
|
||||
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/hwasan/.libs
|
2
configure
vendored
2
configure
vendored
@ -9305,7 +9305,7 @@ fi
|
||||
# or bootstrap-ubsan, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
|
||||
case "$BUILD_CONFIG" in
|
||||
*bootstrap-asan* | *bootstrap-ubsan* )
|
||||
*bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
|
||||
bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
|
||||
bootstrap_fixincludes=yes
|
||||
;;
|
||||
|
@ -2814,7 +2814,7 @@ fi
|
||||
# or bootstrap-ubsan, bootstrap it.
|
||||
if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
|
||||
case "$BUILD_CONFIG" in
|
||||
*bootstrap-asan* | *bootstrap-ubsan* )
|
||||
*bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
|
||||
bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
|
||||
bootstrap_fixincludes=yes
|
||||
;;
|
||||
|
@ -2805,6 +2805,11 @@ the build tree.
|
||||
Compiles GCC itself using Address Sanitization in order to catch invalid memory
|
||||
accesses within the GCC code.
|
||||
|
||||
@item @samp{bootstrap-hwasan}
|
||||
Compiles GCC itself using HWAddress Sanitization in order to catch invalid
|
||||
memory accesses within the GCC code. This option is only available on AArch64
|
||||
systems that are running Linux kernel version 5.4 or later.
|
||||
|
||||
@end table
|
||||
|
||||
@section Building a cross compiler
|
||||
|
1
libiberty/configure
vendored
1
libiberty/configure
vendored
@ -5264,6 +5264,7 @@ fi
|
||||
NOASANFLAG=
|
||||
case " ${CFLAGS} " in
|
||||
*\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
|
||||
*\ -fsanitize=hwaddress\ *) NOASANFLAG=-fno-sanitize=hwaddress ;;
|
||||
esac
|
||||
|
||||
|
||||
|
@ -240,6 +240,7 @@ AC_SUBST(PICFLAG)
|
||||
NOASANFLAG=
|
||||
case " ${CFLAGS} " in
|
||||
*\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
|
||||
*\ -fsanitize=hwaddress\ *) NOASANFLAG=-fno-sanitize=hwaddress ;;
|
||||
esac
|
||||
AC_SUBST(NOASANFLAG)
|
||||
|
||||
|
@ -11,8 +11,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
|
||||
AM_CFLAGS = @ac_lto_plugin_warn_cflags@ $(CET_HOST_FLAGS)
|
||||
AM_LDFLAGS = @ac_lto_plugin_ldflags@
|
||||
AM_LIBTOOLFLAGS = --tag=disable-static
|
||||
override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
|
||||
override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
|
||||
override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
|
||||
override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
|
||||
|
||||
libexecsub_LTLIBRARIES = liblto_plugin.la
|
||||
gcc_build_dir = @gcc_build_dir@
|
||||
|
@ -675,8 +675,8 @@ uninstall-am: uninstall-libexecsubLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
|
||||
override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
|
||||
override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
|
||||
override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
|
||||
|
||||
all-local: $(in_gcc_libs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user