[PATCH] D47817: [compiler-rt] [sanitizer_common] Fix using libtirpc on Linux

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 23 14:58:59 PST 2018


mgorny updated this revision to Diff 179453.
mgorny retitled this revision from "[sanitizer_common] Fix using libtirpc on Linux" to "[compiler-rt] [sanitizer_common] Fix using libtirpc on Linux".
mgorny edited the summary of this revision.
mgorny added a reviewer: Lekensteyn.
mgorny added a comment.
Herald added a subscriber: dberris.

Ok, I give up. Here's a version using `find_package()`. Can we finally get this fixed?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47817/new/

https://reviews.llvm.org/D47817

Files:
  cmake/Modules/FindLibtirpc.cmake
  lib/sanitizer_common/CMakeLists.txt
  lib/sanitizer_common/sanitizer_platform_limits_posix.cc


Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -114,8 +114,6 @@
 #include <netrom/netrom.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>
@@ -1210,7 +1208,7 @@
 CHECK_SIZE_AND_OFFSET(group, gr_gid);
 CHECK_SIZE_AND_OFFSET(group, gr_mem);
 
-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
+#if HAVE_RPC_XDR_H
 CHECK_TYPE_SIZE(XDR);
 CHECK_SIZE_AND_OFFSET(XDR, x_op);
 CHECK_SIZE_AND_OFFSET(XDR, x_ops);
Index: lib/sanitizer_common/CMakeLists.txt
===================================================================
--- lib/sanitizer_common/CMakeLists.txt
+++ lib/sanitizer_common/CMakeLists.txt
@@ -193,9 +193,12 @@
 
 set(SANITIZER_COMMON_DEFINITIONS)
 
-include(CheckIncludeFile)
-append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
-append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
+find_package(Libtirpc)
+
+if (Libtirpc_FOUND)
+  include_directories(${Libtirpc_INCLUDE_DIRS})
+  list(APPEND SANITIZER_COMMON_DEFINITIONS HAVE_RPC_XDR_H=1)
+endif()
 
 set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 append_rtti_flag(OFF SANITIZER_CFLAGS)
Index: cmake/Modules/FindLibtirpc.cmake
===================================================================
--- /dev/null
+++ cmake/Modules/FindLibtirpc.cmake
@@ -0,0 +1,22 @@
+# CMake find_package() Module for libtirpc
+#
+# Example usage:
+#
+# find_package(Libtirpc)
+#
+# If successful the following variables will be defined
+# Libtirpc_FOUND
+# Libtirpc_INCLUDE_DIRS
+
+find_path(Libtirpc_INCLUDE_DIR
+  NAMES rpc/xdr.h
+  PATH_SUFFIXES tirpc
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libtirpc
+	REQUIRED_VARS Libtirpc_INCLUDE_DIR)
+
+if(Libtirpc_FOUND)
+  set(Libtirpc_INCLUDE_DIRS ${Libtirpc_INCLUDE_DIR})
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47817.179453.patch
Type: text/x-patch
Size: 2092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181223/3ed3d5db/attachment.bin>


More information about the cfe-commits mailing list