This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Backport fix for PR 64839 to GCC5 (commited)


On 04/13/2015 12:04 PM, Yury Gribov wrote:
On 04/13/2015 12:03 PM, Yury Gribov wrote:
Hi all,

I've submitted a libsanitizer cherry-pick from LLVM to not require xdr.h
on systems where it's not available. Pre-approved by Jakub in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64839 .

Forgot to attach patch. Commited in r222043.

Hi all,

I've backported patch which fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64839 to gcc-5-branch (r223032).

-Y

Index: libsanitizer/sanitizer_common/Makefile.in
===================================================================
--- libsanitizer/sanitizer_common/Makefile.in	(revision 223031)
+++ libsanitizer/sanitizer_common/Makefile.in	(revision 223032)
@@ -129,7 +129,7 @@
 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_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	(revision 223031)
+++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	(revision 223032)
@@ -131,7 +131,11 @@
 #include <netax25/ax25.h>
 #include <netipx/ipx.h>
 #include <netrom/netrom.h>
-#include <rpc/xdr.h>
+#if HAVE_RPC_XDR_H
+# include <rpc/xdr.h>
+#elif HAVE_TIRPC_RPC_XDR_H
+# include <tirpc/rpc/xdr.h>
+#endif
 #include <scsi/scsi.h>
 #include <sys/mtio.h>
 #include <sys/kd.h>
@@ -1147,7 +1151,7 @@
 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);
Index: libsanitizer/sanitizer_common/sanitizer_platform.h
===================================================================
--- libsanitizer/sanitizer_common/sanitizer_platform.h	(revision 223031)
+++ libsanitizer/sanitizer_common/sanitizer_platform.h	(revision 223032)
@@ -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
Index: libsanitizer/sanitizer_common/Makefile.am
===================================================================
--- libsanitizer/sanitizer_common/Makefile.am	(revision 223031)
+++ libsanitizer/sanitizer_common/Makefile.am	(revision 223032)
@@ -3,7 +3,7 @@
 # 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
Index: libsanitizer/configure
===================================================================
--- libsanitizer/configure	(revision 223031)
+++ libsanitizer/configure	(revision 223032)
@@ -607,6 +607,7 @@
 TSAN_TARGET_DEPENDENT_OBJECTS
 LIBBACKTRACE_SUPPORTED_FALSE
 LIBBACKTRACE_SUPPORTED_TRUE
+RPC_DEFS
 BACKTRACE_SUPPORTS_THREADS
 BACKTRACE_USES_MALLOC
 ALLOC_FILE
@@ -12021,7 +12022,7 @@
   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 @@
   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 @@
 
 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='#'
Index: libsanitizer/Makefile.in
===================================================================
--- libsanitizer/Makefile.in	(revision 223031)
+++ libsanitizer/Makefile.in	(revision 223032)
@@ -181,6 +181,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/asan/Makefile.in
===================================================================
--- libsanitizer/asan/Makefile.in	(revision 223031)
+++ libsanitizer/asan/Makefile.in	(revision 223032)
@@ -190,6 +190,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/ChangeLog
===================================================================
--- libsanitizer/ChangeLog	(revision 223031)
+++ libsanitizer/ChangeLog	(revision 223032)
@@ -1,3 +1,25 @@
+2015-05-12  Yury Gribov  <y.gribov@samsung.com>
+
+	Backport from mainline
+	2015-04-13  Yury Gribov  <y.gribov@samsung.com>
+
+	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-04-22  Release Manager
 
 	* GCC 5.1.0 released.
Index: libsanitizer/lsan/Makefile.in
===================================================================
--- libsanitizer/lsan/Makefile.in	(revision 223031)
+++ libsanitizer/lsan/Makefile.in	(revision 223032)
@@ -181,6 +181,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/config.h.in
===================================================================
--- libsanitizer/config.h.in	(revision 223031)
+++ libsanitizer/config.h.in	(revision 223032)
@@ -43,6 +43,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the <rpc/xdr.h> header file. */
+#undef HAVE_RPC_XDR_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -67,6 +70,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <tirpc/rpc/xdr.h> header file. */
+#undef HAVE_TIRPC_RPC_XDR_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
Index: libsanitizer/configure.ac
===================================================================
--- libsanitizer/configure.ac	(revision 223031)
+++ libsanitizer/configure.ac	(revision 223032)
@@ -312,6 +312,24 @@
   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"])
 
Index: libsanitizer/interception/Makefile.in
===================================================================
--- libsanitizer/interception/Makefile.in	(revision 223031)
+++ libsanitizer/interception/Makefile.in	(revision 223032)
@@ -146,6 +146,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/tsan/Makefile.in
===================================================================
--- libsanitizer/tsan/Makefile.in	(revision 223031)
+++ libsanitizer/tsan/Makefile.in	(revision 223032)
@@ -194,6 +194,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/libbacktrace/Makefile.in
===================================================================
--- libsanitizer/libbacktrace/Makefile.in	(revision 223031)
+++ libsanitizer/libbacktrace/Makefile.in	(revision 223032)
@@ -188,6 +188,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
Index: libsanitizer/ubsan/Makefile.in
===================================================================
--- libsanitizer/ubsan/Makefile.in	(revision 223031)
+++ libsanitizer/ubsan/Makefile.in	(revision 223032)
@@ -177,6 +177,7 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RPC_DEFS = @RPC_DEFS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]