[PATCH] libsanitizer: Disable libbacktrace on sanitizer_platform_limits_freebsd.cpp
Richard Biener
richard.guenther@gmail.com
Tue Nov 2 09:14:29 GMT 2021
On Sat, Oct 30, 2021 at 10:54 PM H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> sanitizer_platform_limits_freebsd.cpp must include <md5.h> from the OS,
> not include/md5.h in GCC source tree which is included by libbacktrace
> support. Disable libbacktrace on sanitizer_platform_limits_freebsd.cpp
> to avoid include/md5.h to restore bootstrap on FreeBSD.
Err, but that will just get complaints about disabled libbacktrace backtracking
(from within the sanitizer?)?
> PR bootstrap/102675
> * sanitizer_common/Makefile.am (AM_CXXFLAGS): Extract libbacktrace
> CXXFLAGS to ...
> (LIBBACKTRACE_CXXFLAGS): Here. New.
> (sanitizer_common_files): Move sanitizer_platform_limits_freebsd.cpp
> to ...
> (sanitizer_common_files_no_libbacktrace): Here. New.
> (AM_CXXFLAGS): Add $(LIBBACKTRACE_CXXFLAGS) for
> $(sanitizer_common_files).
> (libsanitizer_common_la_SOURCES): Add
> $(sanitizer_common_files_no_libbacktrace).
> * sanitizer_common/Makefile.in: Regenerate.
> ---
> libsanitizer/sanitizer_common/Makefile.am | 24 +++++++++++-----
> libsanitizer/sanitizer_common/Makefile.in | 35 ++++++++++++++++-------
> 2 files changed, 41 insertions(+), 18 deletions(-)
>
> diff --git a/libsanitizer/sanitizer_common/Makefile.am b/libsanitizer/sanitizer_common/Makefile.am
> index d04f2d8bd16..0ea459c2b3a 100644
> --- a/libsanitizer/sanitizer_common/Makefile.am
> +++ b/libsanitizer/sanitizer_common/Makefile.am
> @@ -9,11 +9,12 @@ AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
> AM_CXXFLAGS += -std=gnu++14
> AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
> if LIBBACKTRACE_SUPPORTED
> -AM_CXXFLAGS += -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
> - -I $(top_srcdir)/../libbacktrace \
> - -I $(top_builddir)/libbacktrace \
> - -I $(top_srcdir)/../include \
> - -include $(top_srcdir)/libbacktrace/backtrace-rename.h
> +LIBBACKTRACE_CXXFLAGS = \
> + -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
> + -I $(top_srcdir)/../libbacktrace \
> + -I $(top_builddir)/libbacktrace \
> + -I $(top_srcdir)/../include \
> + -include $(top_srcdir)/libbacktrace/backtrace-rename.h
> endif
> AM_CCASFLAGS = $(EXTRA_ASFLAGS)
> ACLOCAL_AMFLAGS = -I m4
> @@ -45,7 +46,6 @@ sanitizer_common_files = \
> sanitizer_netbsd.cpp \
> sanitizer_openbsd.cpp \
> sanitizer_persistent_allocator.cpp \
> - sanitizer_platform_limits_freebsd.cpp \
> sanitizer_platform_limits_linux.cpp \
> sanitizer_platform_limits_openbsd.cpp \
> sanitizer_platform_limits_posix.cpp \
> @@ -81,8 +81,18 @@ sanitizer_common_files = \
> sanitizer_unwind_win.cpp \
> sanitizer_win.cpp
>
> +# Don't add $(LIBBACKTRACE_CXXFLAGS) for the following files:
> +# 1. sanitizer_platform_limits_freebsd.cpp must include <md5.h> from
> +# the OS, not include/md5.h in GCC source tree.
> +sanitizer_common_files_no_libbacktrace = \
> + sanitizer_platform_limits_freebsd.cpp
>
> -libsanitizer_common_la_SOURCES = $(sanitizer_common_files)
> +$(sanitizer_common_files:.cpp=.lo) \
> + $(sanitizer_common_files:.cpp=.$(OBJEXT)): AM_CXXFLAGS += $(LIBBACKTRACE_CXXFLAGS)
> +
> +libsanitizer_common_la_SOURCES = \
> + $(sanitizer_common_files) \
> + $(sanitizer_common_files_no_libbacktrace)
> libsanitizer_common_la_LIBADD = $(SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS)
> libsanitizer_common_la_DEPENDENCIES = $(SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS)
>
> diff --git a/libsanitizer/sanitizer_common/Makefile.in b/libsanitizer/sanitizer_common/Makefile.in
> index 2856894d62b..1433db2238b 100644
> --- a/libsanitizer/sanitizer_common/Makefile.in
> +++ b/libsanitizer/sanitizer_common/Makefile.in
> @@ -89,12 +89,6 @@ POST_UNINSTALL = :
> build_triplet = @build@
> host_triplet = @host@
> target_triplet = @target@
> -@LIBBACKTRACE_SUPPORTED_TRUE@am__append_1 = -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
> -@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_srcdir)/../libbacktrace \
> -@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_builddir)/libbacktrace \
> -@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_srcdir)/../include \
> -@LIBBACKTRACE_SUPPORTED_TRUE@ -include $(top_srcdir)/libbacktrace/backtrace-rename.h
> -
> subdir = sanitizer_common
> ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
> am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
> @@ -131,7 +125,6 @@ am__objects_1 = sancov_flags.lo sanitizer_allocator.lo \
> sanitizer_mac.lo sanitizer_mac_libcdep.lo sanitizer_mutex.lo \
> sanitizer_netbsd.lo sanitizer_openbsd.lo \
> sanitizer_persistent_allocator.lo \
> - sanitizer_platform_limits_freebsd.lo \
> sanitizer_platform_limits_linux.lo \
> sanitizer_platform_limits_openbsd.lo \
> sanitizer_platform_limits_posix.lo \
> @@ -153,7 +146,8 @@ am__objects_1 = sancov_flags.lo sanitizer_allocator.lo \
> sanitizer_thread_registry.lo sanitizer_tls_get_addr.lo \
> sanitizer_unwind_linux_libcdep.lo sanitizer_unwind_win.lo \
> sanitizer_win.lo
> -am_libsanitizer_common_la_OBJECTS = $(am__objects_1)
> +am__objects_2 = sanitizer_platform_limits_freebsd.lo
> +am_libsanitizer_common_la_OBJECTS = $(am__objects_1) $(am__objects_2)
> libsanitizer_common_la_OBJECTS = $(am_libsanitizer_common_la_OBJECTS)
> AM_V_lt = $(am__v_lt_@AM_V@)
> am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
> @@ -376,7 +370,14 @@ AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
> -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
> -fomit-frame-pointer -funwind-tables -fvisibility=hidden \
> -Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS) \
> - -std=gnu++14 $(EXTRA_CXXFLAGS) $(am__append_1)
> + -std=gnu++14 $(EXTRA_CXXFLAGS)
> +@LIBBACKTRACE_SUPPORTED_TRUE@LIBBACKTRACE_CXXFLAGS = \
> +@LIBBACKTRACE_SUPPORTED_TRUE@ -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE \
> +@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_srcdir)/../libbacktrace \
> +@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_builddir)/libbacktrace \
> +@LIBBACKTRACE_SUPPORTED_TRUE@ -I $(top_srcdir)/../include \
> +@LIBBACKTRACE_SUPPORTED_TRUE@ -include $(top_srcdir)/libbacktrace/backtrace-rename.h
> +
> AM_CCASFLAGS = $(EXTRA_ASFLAGS)
> ACLOCAL_AMFLAGS = -I m4
> noinst_LTLIBRARIES = libsanitizer_common.la
> @@ -405,7 +406,6 @@ sanitizer_common_files = \
> sanitizer_netbsd.cpp \
> sanitizer_openbsd.cpp \
> sanitizer_persistent_allocator.cpp \
> - sanitizer_platform_limits_freebsd.cpp \
> sanitizer_platform_limits_linux.cpp \
> sanitizer_platform_limits_openbsd.cpp \
> sanitizer_platform_limits_posix.cpp \
> @@ -441,7 +441,17 @@ sanitizer_common_files = \
> sanitizer_unwind_win.cpp \
> sanitizer_win.cpp
>
> -libsanitizer_common_la_SOURCES = $(sanitizer_common_files)
> +
> +# Don't add $(LIBBACKTRACE_CXXFLAGS) for the following files:
> +# 1. sanitizer_platform_limits_freebsd.cpp must include <md5.h> from
> +# the OS, not include/md5.h in GCC source tree.
> +sanitizer_common_files_no_libbacktrace = \
> + sanitizer_platform_limits_freebsd.cpp
> +
> +libsanitizer_common_la_SOURCES = \
> + $(sanitizer_common_files) \
> + $(sanitizer_common_files_no_libbacktrace)
> +
> libsanitizer_common_la_LIBADD = $(SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS)
> libsanitizer_common_la_DEPENDENCIES = $(SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS)
>
> @@ -800,6 +810,9 @@ uninstall-am:
> .PRECIOUS: Makefile
>
>
> +$(sanitizer_common_files:.cpp=.lo) \
> + $(sanitizer_common_files:.cpp=.$(OBJEXT)): AM_CXXFLAGS += $(LIBBACKTRACE_CXXFLAGS)
> +
> # Tell versions [3.59,3.63) of GNU make to not export all variables.
> # Otherwise a system limit (for SysV at least) may be exceeded.
> .NOEXPORT:
> --
> 2.33.0
>
More information about the Gcc-patches
mailing list