[PATCH] D47817: [sanitizer_common] Fix using libtirpc on Linux
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 03:36:41 PDT 2018
mgorny created this revision.
mgorny added reviewers: ygribov, kcc.
mgorny added a project: Sanitizers.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.
mgorny added a reviewer: samsonov.
Fix using libtirpc on Linux by using pkg-config to detect it, and append
appropriate include directory. The libtirpc headers reference one
another via '#include <rpc/...>', so attempting to include it via
'#include <tirpc/...>' just failed and resulted in RPC headers not being
detected at all.
Additionally, perform the header check without -nodefaultlibs as that
apparently causes it to fail.
Repository:
rCRT Compiler Runtime
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>
@@ -1242,7 +1240,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
@@ -168,9 +168,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.150101.patch
Type: text/x-patch
Size: 1585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180606/7dc9593d/attachment.bin>
More information about the llvm-commits
mailing list