[PATCH] D47817: [sanitizer_common] Fix using libtirpc on Linux

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 02:08:52 PDT 2018


mgorny updated this revision to Diff 171646.
mgorny added a comment.

Rebased.


https://reviews.llvm.org/D47817

Files:
  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
@@ -146,8 +146,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>
@@ -1243,7 +1241,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
@@ -191,9 +191,18 @@
 
 set(SANITIZER_COMMON_DEFINITIONS)
 
+include(FindPkgConfig)
+pkg_check_modules(TIRPC libtirpc)
+if (TIRPC_FOUND)
+  include_directories(${TIRPC_INCLUDE_DIRS})
+  set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
+endif()
+
 include(CheckIncludeFile)
+cmake_push_check_state()
+string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 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)
+cmake_pop_check_state()
 
 set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 append_rtti_flag(OFF SANITIZER_CFLAGS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47817.171646.patch
Type: text/x-patch
Size: 1585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/882208ee/attachment.bin>


More information about the llvm-commits mailing list