summaryrefslogtreecommitdiff
path: root/sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch')
-rw-r--r--sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
new file mode 100644
index 000000000000..ca871c37b994
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/7.1.0/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
@@ -0,0 +1,67 @@
+From e198d21b9a5851dbc061f60911e3b3da910bca0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 6 Jun 2018 12:16:38 +0200
+Subject: [PATCH 7/8] [sanitizer_common] Fix using libtirpc on Linux
+
+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.
+---
+ lib/sanitizer_common/CMakeLists.txt | 11 ++++++++++-
+ .../sanitizer_platform_limits_posix.cc | 4 +---
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
+index e0226ae49..4071bc0e8 100644
+--- a/lib/sanitizer_common/CMakeLists.txt
++++ b/lib/sanitizer_common/CMakeLists.txt
+@@ -151,9 +151,18 @@ include_directories(..)
+
+ 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)
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+index feb7bad6f..2e736ee26 100644
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -146,8 +146,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ #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>
+@@ -1236,7 +1234,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
+ 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);
+--
+2.18.0
+