Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt-sanitizers/, sys-libs/compiler-rt-sanitizers/files/9999/
Date: Wed, 05 Sep 2018 06:20:25
Message-Id: 1536128412.a24ec3238f68cc33307abf658b7a1d08e4ffc480.mgorny@gentoo
1 commit: a24ec3238f68cc33307abf658b7a1d08e4ffc480
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 5 06:06:11 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 5 06:20:12 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a24ec323
7
8 sys-libs/compiler-rt-sanitizers: Inline new glibc patches
9
10 Inline the patches needed for new glibc (with split tirpc) since they
11 have not been merged upstream, and are appropriately needed for -9999
12 as well.
13
14 .../compiler-rt-sanitizers-7.0.0_rc2.ebuild | 11 +--
15 ...itizer_common-Fix-using-libtirpc-on-Linux.patch | 67 ++++++++++++++
16 ...0002-test-Support-using-libtirpc-on-Linux.patch | 100 +++++++++++++++++++++
17 3 files changed, 171 insertions(+), 7 deletions(-)
18
19 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
20 index f606ef2f383..07047f9ba30 100644
21 --- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
22 +++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
23 @@ -17,7 +17,6 @@ LLVM_P=llvm-${PV/_/}.src
24 DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
25 HOMEPAGE="https://llvm.org/"
26 SRC_URI="https://prereleases.llvm.org/${PV/_//}/${MY_P}.tar.xz
27 - https://dev.gentoo.org/~mgorny/dist/llvm/${PN}-6.0.1-patchset.tar.xz
28 test? ( https://releases.llvm.org/${PV/_//}/${LLVM_P}.tar.xz )"
29
30 LICENSE="|| ( UoI-NCSA MIT )"
31 @@ -63,8 +62,6 @@ pkg_setup() {
32 src_unpack() {
33 einfo "Unpacking ${MY_P}.tar.xz ..."
34 tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
35 - einfo "Unpacking ${P}-patchset.tar.xz ..."
36 - tar -xf "${DISTDIR}/${PN}-6.0.1-patchset.tar.xz" || die
37
38 if use test; then
39 einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
40 @@ -77,12 +74,12 @@ src_unpack() {
41 src_prepare() {
42 cmake-utils_src_prepare
43
44 - # apply the patchset (new glibc fixes)
45 - eapply "${WORKDIR}/${PN}-6.0.1-patchset/0007-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
46 - eapply "${WORKDIR}/${PN}-6.0.1-patchset/0008-test-Support-using-libtirpc-on-Linux.patch"
47 + # apply the fixes for new glibc / split tirpc
48 + eapply "${FILESDIR}/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
49 + eapply "${FILESDIR}/9999/0002-test-Support-using-libtirpc-on-Linux.patch"
50
51 if use test; then
52 - # remove tests that are broken by new glibc
53 + # remove tests that are (still) broken by new glibc
54 # https://bugs.llvm.org/show_bug.cgi?id=36065
55 if use elibc_glibc && has_version '>=sys-libs/glibc-2.25'; then
56 rm test/lsan/TestCases/Linux/use_tls_dynamic.cc || die
57
58 diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
59 new file mode 100644
60 index 00000000000..ca871c37b99
61 --- /dev/null
62 +++ b/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
63 @@ -0,0 +1,67 @@
64 +From e198d21b9a5851dbc061f60911e3b3da910bca0a Mon Sep 17 00:00:00 2001
65 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
66 +Date: Wed, 6 Jun 2018 12:16:38 +0200
67 +Subject: [PATCH 7/8] [sanitizer_common] Fix using libtirpc on Linux
68 +
69 +Fix using libtirpc on Linux by using pkg-config to detect it, and append
70 +appropriate include directory. The libtirpc headers reference one
71 +another via '#include <rpc/...>', so attempting to include it via
72 +'#include <tirpc/...>' just failed and resulted in RPC headers not being
73 +detected at all.
74 +
75 +Additionally, perform the header check without -nodefaultlibs as that
76 +apparently causes it to fail.
77 +---
78 + lib/sanitizer_common/CMakeLists.txt | 11 ++++++++++-
79 + .../sanitizer_platform_limits_posix.cc | 4 +---
80 + 2 files changed, 11 insertions(+), 4 deletions(-)
81 +
82 +diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
83 +index e0226ae49..4071bc0e8 100644
84 +--- a/lib/sanitizer_common/CMakeLists.txt
85 ++++ b/lib/sanitizer_common/CMakeLists.txt
86 +@@ -151,9 +151,18 @@ include_directories(..)
87 +
88 + set(SANITIZER_COMMON_DEFINITIONS)
89 +
90 ++include(FindPkgConfig)
91 ++pkg_check_modules(TIRPC libtirpc)
92 ++if (TIRPC_FOUND)
93 ++ include_directories(${TIRPC_INCLUDE_DIRS})
94 ++ set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
95 ++endif()
96 ++
97 + include(CheckIncludeFile)
98 ++cmake_push_check_state()
99 ++string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
100 + append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
101 +-append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
102 ++cmake_pop_check_state()
103 +
104 + set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
105 + append_rtti_flag(OFF SANITIZER_CFLAGS)
106 +diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
107 +index feb7bad6f..2e736ee26 100644
108 +--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
109 ++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
110 +@@ -146,8 +146,6 @@ typedef struct user_fpregs elf_fpregset_t;
111 + #include <netrom/netrom.h>
112 + #if HAVE_RPC_XDR_H
113 + # include <rpc/xdr.h>
114 +-#elif HAVE_TIRPC_RPC_XDR_H
115 +-# include <tirpc/rpc/xdr.h>
116 + #endif
117 + #include <scsi/scsi.h>
118 + #include <sys/mtio.h>
119 +@@ -1236,7 +1234,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
120 + CHECK_SIZE_AND_OFFSET(group, gr_gid);
121 + CHECK_SIZE_AND_OFFSET(group, gr_mem);
122 +
123 +-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
124 ++#if HAVE_RPC_XDR_H
125 + CHECK_TYPE_SIZE(XDR);
126 + CHECK_SIZE_AND_OFFSET(XDR, x_op);
127 + CHECK_SIZE_AND_OFFSET(XDR, x_ops);
128 +--
129 +2.18.0
130 +
131
132 diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch
133 new file mode 100644
134 index 00000000000..880284775e2
135 --- /dev/null
136 +++ b/sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch
137 @@ -0,0 +1,100 @@
138 +From 4fc99ef388e2f110759dc774428fd194b65614c8 Mon Sep 17 00:00:00 2001
139 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
140 +Date: Wed, 6 Jun 2018 12:45:55 +0200
141 +Subject: [PATCH 8/8] [test] Support using libtirpc on Linux
142 +
143 +Add compiler flags necessary for using libtirpc on Linux (RPC headers
144 +split out of glibc). The flags are obtained via pkg-config. This fixes
145 +test failures due to tests being unable to find <rpc/...> includes.
146 +---
147 + cmake/base-config-ix.cmake | 4 ++++
148 + lib/sanitizer_common/CMakeLists.txt | 2 --
149 + test/msan/lit.cfg | 3 ++-
150 + test/msan/lit.site.cfg.in | 1 +
151 + test/tsan/lit.cfg | 3 ++-
152 + test/tsan/lit.site.cfg.in | 1 +
153 + 6 files changed, 10 insertions(+), 4 deletions(-)
154 +
155 +diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
156 +index b208f0852..46b88f72b 100644
157 +--- a/cmake/base-config-ix.cmake
158 ++++ b/cmake/base-config-ix.cmake
159 +@@ -8,6 +8,10 @@ include(CheckCXXSourceCompiles)
160 +
161 + check_include_file(unwind.h HAVE_UNWIND_H)
162 +
163 ++# used in sanitizer_common and tests
164 ++include(FindPkgConfig)
165 ++pkg_check_modules(TIRPC libtirpc)
166 ++
167 + # Top level target used to build all compiler-rt libraries.
168 + add_custom_target(compiler-rt ALL)
169 + add_custom_target(install-compiler-rt)
170 +diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
171 +index 4071bc0e8..08d1781a6 100644
172 +--- a/lib/sanitizer_common/CMakeLists.txt
173 ++++ b/lib/sanitizer_common/CMakeLists.txt
174 +@@ -151,8 +151,6 @@ include_directories(..)
175 +
176 + set(SANITIZER_COMMON_DEFINITIONS)
177 +
178 +-include(FindPkgConfig)
179 +-pkg_check_modules(TIRPC libtirpc)
180 + if (TIRPC_FOUND)
181 + include_directories(${TIRPC_INCLUDE_DIRS})
182 + set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
183 +diff --git a/test/msan/lit.cfg b/test/msan/lit.cfg
184 +index cac260999..fe8525047 100644
185 +--- a/test/msan/lit.cfg
186 ++++ b/test/msan/lit.cfg
187 +@@ -14,7 +14,8 @@ clang_msan_cflags = (["-fsanitize=memory",
188 + "-fno-omit-frame-pointer",
189 + "-fno-optimize-sibling-calls"] +
190 + [config.target_cflags] +
191 +- config.debug_info_flags)
192 ++ config.debug_info_flags +
193 ++ [config.rpc_cflags])
194 + # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
195 + if config.host_os == 'FreeBSD':
196 + clang_msan_cflags += ["-lexecinfo"]
197 +diff --git a/test/msan/lit.site.cfg.in b/test/msan/lit.site.cfg.in
198 +index f744d71fd..35634d324 100644
199 +--- a/test/msan/lit.site.cfg.in
200 ++++ b/test/msan/lit.site.cfg.in
201 +@@ -6,6 +6,7 @@ config.target_cflags = "@MSAN_TEST_TARGET_CFLAGS@"
202 + config.target_arch = "@MSAN_TEST_TARGET_ARCH@"
203 + config.use_lld = @MSAN_TEST_USE_LLD@
204 + config.use_thinlto = @MSAN_TEST_USE_THINLTO@
205 ++config.rpc_cflags = "@TIRPC_CFLAGS@"
206 +
207 + # Load common config for all compiler-rt lit tests.
208 + lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
209 +diff --git a/test/tsan/lit.cfg b/test/tsan/lit.cfg
210 +index fdbafefbc..82fd2f79d 100644
211 +--- a/test/tsan/lit.cfg
212 ++++ b/test/tsan/lit.cfg
213 +@@ -49,7 +49,8 @@ clang_tsan_cflags = (["-fsanitize=thread",
214 + [config.target_cflags] +
215 + config.debug_info_flags +
216 + extra_cflags +
217 +- ["-I%s" % tsan_incdir])
218 ++ ["-I%s" % tsan_incdir] +
219 ++ [config.rpc_cflags])
220 + clang_tsan_cxxflags = config.cxx_mode_flags + clang_tsan_cflags + ["-std=c++11"] + ["-I%s" % tsan_incdir]
221 + # Add additional flags if we're using instrumented libc++.
222 + # Instrumented libcxx currently not supported on Darwin.
223 +diff --git a/test/tsan/lit.site.cfg.in b/test/tsan/lit.site.cfg.in
224 +index a215e664a..142d61bf2 100644
225 +--- a/test/tsan/lit.site.cfg.in
226 ++++ b/test/tsan/lit.site.cfg.in
227 +@@ -7,6 +7,7 @@ config.ios = @TSAN_TEST_IOS_PYBOOL@
228 + config.iossim = @TSAN_TEST_IOSSIM_PYBOOL@
229 + config.target_cflags = "@TSAN_TEST_TARGET_CFLAGS@"
230 + config.target_arch = "@TSAN_TEST_TARGET_ARCH@"
231 ++config.rpc_cflags = "@TIRPC_CFLAGS@"
232 +
233 + # Load common config for all compiler-rt lit tests.
234 + lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
235 +--
236 +2.18.0
237 +