From d041a6fcae6d87a98d86efdc8ebe384192236f98 Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Mon, 13 Apr 2015 08:59:55 +0000 Subject: [PATCH] re PR sanitizer/64839 (libsanitizer shouldn't require ) 2015-04-13 Yury Gribov PR sanitizer/64839 libsanitizer/ * sanitizer_common/sanitizer_platform.h: Cherry pick upstream r234470. * sanitizer_common/sanitizer_platform_limits_posix.cc: Ditto. * configure.ac (RPC_DEFS): Check for precense of RPC headers. * sanitizer_common/Makefile.am (DEFS): Pass info to compiler. * Makefile.in: Regenerate. * asan/Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. From-SVN: r222043 --- libsanitizer/ChangeLog | 20 ++++++++ libsanitizer/Makefile.in | 1 + libsanitizer/asan/Makefile.in | 1 + libsanitizer/config.h.in | 6 +++ libsanitizer/configure | 46 ++++++++++++++++++- libsanitizer/configure.ac | 18 ++++++++ libsanitizer/interception/Makefile.in | 1 + libsanitizer/libbacktrace/Makefile.in | 1 + libsanitizer/lsan/Makefile.in | 1 + libsanitizer/sanitizer_common/Makefile.am | 2 +- libsanitizer/sanitizer_common/Makefile.in | 3 +- .../sanitizer_common/sanitizer_platform.h | 6 +++ .../sanitizer_platform_limits_posix.cc | 8 +++- libsanitizer/tsan/Makefile.in | 1 + libsanitizer/ubsan/Makefile.in | 1 + 15 files changed, 110 insertions(+), 6 deletions(-) diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 282afed1e33..6f44dcf09ec 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,23 @@ +2015-04-13 Yury Gribov + + PR sanitizer/64839 + * sanitizer_common/sanitizer_platform.h: Cherry pick + upstream r234470. + * sanitizer_common/sanitizer_platform_limits_posix.cc: Ditto. + * configure.ac (RPC_DEFS): Check for precense of RPC headers. + * sanitizer_common/Makefile.am (DEFS): Pass info to compiler. + * Makefile.in: Regenerate. + * asan/Makefile.in: Regenerate. + * config.h.in: Regenerate. + * configure: Regenerate. + * interception/Makefile.in: Regenerate. + * libbacktrace/Makefile.in: Regenerate. + * lsan/Makefile.in: Regenerate. + * sanitizer_common/Makefile.in: Regenerate. + * tsan/Makefile.in: Regenerate. + * ubsan/Makefile.in: Regenerate. + + 2015-03-23 Christophe Lyon PR sanitizer/59009 diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in index 79a1be686b6..2f5f1bd8ff9 100644 --- a/libsanitizer/Makefile.in +++ b/libsanitizer/Makefile.in @@ -181,6 +181,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in index e61ceda7254..a56c6b14bbf 100644 --- a/libsanitizer/asan/Makefile.in +++ b/libsanitizer/asan/Makefile.in @@ -190,6 +190,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/config.h.in b/libsanitizer/config.h.in index e4b2786324e..7195840f2db 100644 --- a/libsanitizer/config.h.in +++ b/libsanitizer/config.h.in @@ -43,6 +43,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the header file. */ +#undef HAVE_RPC_XDR_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -67,6 +70,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_TIRPC_RPC_XDR_H + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/libsanitizer/configure b/libsanitizer/configure index 9ded4cc7782..1efbd5314af 100755 --- a/libsanitizer/configure +++ b/libsanitizer/configure @@ -607,6 +607,7 @@ LIBOBJS TSAN_TARGET_DEPENDENT_OBJECTS LIBBACKTRACE_SUPPORTED_FALSE LIBBACKTRACE_SUPPORTED_TRUE +RPC_DEFS BACKTRACE_SUPPORTS_THREADS BACKTRACE_USES_MALLOC ALLOC_FILE @@ -12021,7 +12022,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12024 "configure" +#line 12025 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12127,7 +12128,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12130 "configure" +#line 12131 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16341,6 +16342,47 @@ $as_echo "#define HAVE_GETEXECNAME 1" >>confdefs.h fi +# Check for rpc/xdr.h +for ac_header in rpc/xdr.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "rpc/xdr.h" "ac_cv_header_rpc_xdr_h" "$ac_includes_default" +if test "x$ac_cv_header_rpc_xdr_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_RPC_XDR_H 1 +_ACEOF + +fi + +done + +if test x"$ac_cv_header_rpc_xdr_h" = xyes; then + rpc_defs="$rpc_defs -DHAVE_RPC_XDR_H=1" +else + rpc_defs="$rpc_defs -DHAVE_RPC_XDR_H=0" +fi + +# Check for tirpc/rpc/xdr.h +for ac_header in tirpc/rpc/xdr.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "tirpc/rpc/xdr.h" "ac_cv_header_tirpc_rpc_xdr_h" "$ac_includes_default" +if test "x$ac_cv_header_tirpc_rpc_xdr_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIRPC_RPC_XDR_H 1 +_ACEOF + +fi + +done + +if test x"$ac_cv_header_tirpc_rpc_xdr_h" = xyes; then + rpc_defs="$rpc_defs -DHAVE_TIRPC_RPC_XDR_H=1" +else + rpc_defs="$rpc_defs -DHAVE_TIRPC_RPC_XDR_H=0" +fi + +RPC_DEFS=$rpc_defs + + if test "x${BACKTRACE_SUPPORTED}x${BACKTRACE_USES_MALLOC}" = "x1x0"; then LIBBACKTRACE_SUPPORTED_TRUE= LIBBACKTRACE_SUPPORTED_FALSE='#' diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac index 031c2710a82..11e2d9961d6 100644 --- a/libsanitizer/configure.ac +++ b/libsanitizer/configure.ac @@ -312,6 +312,24 @@ if test "$have_getexecname" = "yes"; then AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.]) fi +# Check for rpc/xdr.h +AC_CHECK_HEADERS(rpc/xdr.h) +if test x"$ac_cv_header_rpc_xdr_h" = xyes; then + rpc_defs="$rpc_defs -DHAVE_RPC_XDR_H=1" +else + rpc_defs="$rpc_defs -DHAVE_RPC_XDR_H=0" +fi + +# Check for tirpc/rpc/xdr.h +AC_CHECK_HEADERS(tirpc/rpc/xdr.h) +if test x"$ac_cv_header_tirpc_rpc_xdr_h" = xyes; then + rpc_defs="$rpc_defs -DHAVE_TIRPC_RPC_XDR_H=1" +else + rpc_defs="$rpc_defs -DHAVE_TIRPC_RPC_XDR_H=0" +fi + +AC_SUBST([RPC_DEFS], [$rpc_defs]) + AM_CONDITIONAL(LIBBACKTRACE_SUPPORTED, [test "x${BACKTRACE_SUPPORTED}x${BACKTRACE_USES_MALLOC}" = "x1x0"]) diff --git a/libsanitizer/interception/Makefile.in b/libsanitizer/interception/Makefile.in index 0e261b42669..5a496507588 100644 --- a/libsanitizer/interception/Makefile.in +++ b/libsanitizer/interception/Makefile.in @@ -146,6 +146,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/libbacktrace/Makefile.in b/libsanitizer/libbacktrace/Makefile.in index 7d2e2443e34..66d1962711c 100644 --- a/libsanitizer/libbacktrace/Makefile.in +++ b/libsanitizer/libbacktrace/Makefile.in @@ -188,6 +188,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in index 3ad44012e9f..49fa8749461 100644 --- a/libsanitizer/lsan/Makefile.in +++ b/libsanitizer/lsan/Makefile.in @@ -181,6 +181,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/sanitizer_common/Makefile.am b/libsanitizer/sanitizer_common/Makefile.am index 28ce39b64c2..d541717866b 100644 --- a/libsanitizer/sanitizer_common/Makefile.am +++ b/libsanitizer/sanitizer_common/Makefile.am @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I $(top_srcdir)/include -isystem $(top_srcdir)/include/system # May be used by toolexeclibdir. gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) -DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS +DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS @RPC_DEFS@ 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 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS) AM_CXXFLAGS += -std=gnu++11 diff --git a/libsanitizer/sanitizer_common/Makefile.in b/libsanitizer/sanitizer_common/Makefile.in index 4a0e72762a6..77ad416defb 100644 --- a/libsanitizer/sanitizer_common/Makefile.in +++ b/libsanitizer/sanitizer_common/Makefile.in @@ -129,7 +129,7 @@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS +DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS @RPC_DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -174,6 +174,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h b/libsanitizer/sanitizer_common/sanitizer_platform.h index 55bec90b080..e0e740225e2 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform.h @@ -126,4 +126,10 @@ # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12) #endif +// Assume obsolete RPC headers are available by default +#if !defined(HAVE_RPC_XDR_H) && !defined(HAVE_TIRPC_RPC_XDR_H) +# define HAVE_RPC_XDR_H (SANITIZER_LINUX && !SANITIZER_ANDROID) +# define HAVE_TIRPC_RPC_XDR_H 0 +#endif + #endif // SANITIZER_PLATFORM_H diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index 4971c4075bc..2ef4ca22276 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -131,7 +131,11 @@ #include #include #include -#include +#if HAVE_RPC_XDR_H +# include +#elif HAVE_TIRPC_RPC_XDR_H +# include +#endif #include #include #include @@ -1147,7 +1151,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd); CHECK_SIZE_AND_OFFSET(group, gr_gid); CHECK_SIZE_AND_OFFSET(group, gr_mem); -#if SANITIZER_LINUX && !SANITIZER_ANDROID +#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H CHECK_TYPE_SIZE(XDR); CHECK_SIZE_AND_OFFSET(XDR, x_op); CHECK_SIZE_AND_OFFSET(XDR, x_ops); diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in index c4e649008ec..ed594a6f631 100644 --- a/libsanitizer/tsan/Makefile.in +++ b/libsanitizer/tsan/Makefile.in @@ -194,6 +194,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in index e0f89148948..0973a7a050e 100644 --- a/libsanitizer/ubsan/Makefile.in +++ b/libsanitizer/ubsan/Makefile.in @@ -177,6 +177,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RPC_DEFS = @RPC_DEFS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -- 2.30.2