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/
Date: Wed, 06 Jan 2021 21:23:58
Message-Id: 1609968204.57efce0c389e7224aa64efa22e063d9697a153d2.mgorny@gentoo
1 commit: 57efce0c389e7224aa64efa22e063d9697a153d2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 6 17:18:52 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 6 21:23:24 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57efce0c
7
8 sys-libs/compiler-rt-sanitizers: Remove 11.0.1 RCs and live
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/compiler-rt-sanitizers/Manifest | 2 -
13 .../compiler-rt-sanitizers-11.0.1.9999.ebuild | 197 --------------------
14 .../compiler-rt-sanitizers-11.0.1_rc1.ebuild | 164 -----------------
15 .../compiler-rt-sanitizers-11.0.1_rc2.ebuild | 201 ---------------------
16 4 files changed, 564 deletions(-)
17
18 diff --git a/sys-libs/compiler-rt-sanitizers/Manifest b/sys-libs/compiler-rt-sanitizers/Manifest
19 index 29b0efe3c21..47a7ff9f78f 100644
20 --- a/sys-libs/compiler-rt-sanitizers/Manifest
21 +++ b/sys-libs/compiler-rt-sanitizers/Manifest
22 @@ -1,6 +1,4 @@
23 DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3c8a6ff1a1f152f94bfe362c07884339fe571ff7fe903ed3b3deb150b2fa868c387887a0dea2930dc08b81db71a5b1 SHA512 48078fff9293a87f1a973f3348f79506f04c3da774295f5eb67d74dd2d1aa94f0973f8ced3f4ab9e8339902071f82c603b43d5608ad7227046c4da769c5d2151
24 DIST llvmorg-11.0.0.tar.gz 122743665 BLAKE2B 3f95570240789fd68ddb747df817f5c6cdc9da40911bbe9ee3531c15ada9165e5002b1c2f778cf8735858485ea05a8754e3d3a5f4b15bdd6cb33d64a14692984 SHA512 b6d38871ccce0e086e27d35e42887618d68e57d8274735c59e3eabc42dee352412489296293f8d5169fe0044936345915ee7da61ebdc64ec10f7737f6ecd90f2
25 -DIST llvmorg-11.0.1-rc1.tar.gz 122777435 BLAKE2B 23b520d33cf4b641027ee52bb10c6171d60356c9167d5b94012929e6e547c526cda1a6177c295ed19592dfb83b020f63b2cef4cabc70ce9a2a8e098fe654a3cd SHA512 605c7bbff1610f335be8ea4f1204df797fed21185a54c77565f6ff2d00794d1967e9c5fab7c87633e242f2f999bdffb76da83f756d261c1ca476114599409ae1
26 -DIST llvmorg-11.0.1-rc2.tar.gz 122793330 BLAKE2B 5d42f7bd7ba253ac3ca08cf9901c79db5b51b86f0f66c8e63f4f9808ca5fb72cacccfad098b4f6701a34b0d77bdd66fe3839a3962a251eae53776240a2e13b06 SHA512 acda5a5be38cc8aae730c34cd1bb8f29a82e2ed3dd9734ca293ff092d5b30c8c255ab3054245b8f6ed541d5dbf8bc674b744bb2f81788db8826f69a204dda0c3
27 DIST llvmorg-11.0.1.tar.gz 122790338 BLAKE2B 0130996b4a8c4d9f757136fd7fb318068c9bfdc565060dec0d4336480c4ab66c4ae3185a7fdb05f13cf9ee8fd4123b09df938881b75d6e5d3689595114b7e32a SHA512 f5e6ef0b3111aae08a89cd01adb2ff4abfa9ef779c68b9190421d0447efd25c2cc00e5aae9f4764805f5fa31434866043d1510ae7389817e28ae53a5442e2fdf
28 DIST llvmorg-9.0.1.tar.gz 113193320 BLAKE2B b86e405f2b8e00436045fd409fe19cdde75c797b1192c62a22b5ec75e6b4dc8e874a0f33008dc31562445e4cbe53a992b6f48c684255a6a1ef261e595b8b161f SHA512 fa88beeaae94b6d0cd9b5ba38658d0ffed8004035d7d8a4f95c3d31a709b88b581ae9bd7761333c8e5375c44b8f6be01768b5a3be901163159d7e6c43b71da59
29
30 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild
31 deleted file mode 100644
32 index 14dbd46a8db..00000000000
33 --- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild
34 +++ /dev/null
35 @@ -1,197 +0,0 @@
36 -# Copyright 1999-2020 Gentoo Authors
37 -# Distributed under the terms of the GNU General Public License v2
38 -
39 -EAPI=7
40 -
41 -PYTHON_COMPAT=( python3_{6..9} )
42 -inherit check-reqs cmake flag-o-matic llvm llvm.org python-any-r1
43 -
44 -DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
45 -HOMEPAGE="https://llvm.org/"
46 -
47 -LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
48 -SLOT="$(ver_cut 1-3)"
49 -KEYWORDS=""
50 -IUSE="+clang test elibc_glibc"
51 -# base targets
52 -IUSE+=" +libfuzzer +profile +xray"
53 -# sanitizer targets, keep in sync with config-ix.cmake
54 -# NB: ubsan, scudo deliberately match two entries
55 -SANITIZER_FLAGS=(
56 - asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
57 - shadowcallstack gwp-asan
58 -)
59 -IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
60 -REQUIRED_USE="
61 - || ( ${SANITIZER_FLAGS[*]} libfuzzer profile xray )
62 - gwp-asan? ( scudo )
63 - ubsan? ( cfi )"
64 -RESTRICT="!test? ( test ) !clang? ( test )"
65 -
66 -CLANG_SLOT=${SLOT%%.*}
67 -# llvm-6 for new lit options
68 -DEPEND="
69 - >=sys-devel/llvm-6"
70 -BDEPEND="
71 - >=dev-util/cmake-3.16
72 - clang? ( sys-devel/clang )
73 - elibc_glibc? ( net-libs/libtirpc )
74 - test? (
75 - !<sys-apps/sandbox-2.13
76 - $(python_gen_any_dep ">=dev-python/lit-5[\${PYTHON_USEDEP}]")
77 - =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
78 - sys-libs/compiler-rt:${SLOT}
79 - )
80 - ${PYTHON_DEPS}"
81 -
82 -LLVM_COMPONENTS=( compiler-rt )
83 -LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
84 -llvm.org_set_globals
85 -
86 -PATCHES=(
87 - "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
88 -)
89 -
90 -python_check_deps() {
91 - use test || return 0
92 - has_version "dev-python/lit[${PYTHON_USEDEP}]"
93 -}
94 -
95 -check_space() {
96 - if use test; then
97 - local CHECKREQS_DISK_BUILD=11G
98 - check-reqs_pkg_pretend
99 - fi
100 -}
101 -
102 -pkg_pretend() {
103 - check_space
104 -}
105 -
106 -pkg_setup() {
107 - check_space
108 - llvm_pkg_setup
109 - python-any-r1_pkg_setup
110 -}
111 -
112 -src_prepare() {
113 - sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
114 -
115 - local flag
116 - for flag in "${SANITIZER_FLAGS[@]}"; do
117 - if ! use "${flag}"; then
118 - local cmake_flag=${flag/-/_}
119 - sed -i -e "/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
120 - cmake/config-ix.cmake || die
121 - fi
122 - done
123 -
124 - if use asan && ! use profile; then
125 - # TODO: fix these tests to be skipped upstream
126 - rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
127 - fi
128 -
129 - llvm.org_src_prepare
130 -}
131 -
132 -src_configure() {
133 - # pre-set since we need to pass it to cmake
134 - BUILD_DIR=${WORKDIR}/compiler-rt_build
135 -
136 - if use clang; then
137 - local -x CC=${CHOST}-clang
138 - local -x CXX=${CHOST}-clang++
139 - strip-unsupported-flags
140 - fi
141 -
142 - local flag want_sanitizer=OFF
143 - for flag in "${SANITIZER_FLAGS[@]}"; do
144 - if use "${flag}"; then
145 - want_sanitizer=ON
146 - break
147 - fi
148 - done
149 -
150 - local mycmakeargs=(
151 - -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
152 - # use a build dir structure consistent with install
153 - # this makes it possible to easily deploy test-friendly clang
154 - -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
155 -
156 - -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
157 - # builtins & crt installed by sys-libs/compiler-rt
158 - -DCOMPILER_RT_BUILD_BUILTINS=OFF
159 - -DCOMPILER_RT_BUILD_CRT=OFF
160 - -DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
161 - -DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
162 - -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
163 - -DCOMPILER_RT_BUILD_XRAY=$(usex xray)
164 -
165 - -DPython3_EXECUTABLE="${PYTHON}"
166 - )
167 - if use test; then
168 - mycmakeargs+=(
169 - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
170 - -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
171 - -DLLVM_LIT_ARGS="$(get_lit_flags)"
172 -
173 - # they are created during src_test()
174 - -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang"
175 - -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang++"
176 - )
177 -
178 - # same flags are passed for build & tests, so we need to strip
179 - # them down to a subset supported by clang
180 - CC=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang \
181 - CXX=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++ \
182 - strip-unsupported-flags
183 - fi
184 -
185 - if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
186 - mycmakeargs+=(
187 - # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
188 - # this allows adding arm64 support using SDK in EPREFIX
189 - -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
190 - # Set version based on the SDK in EPREFIX
191 - # This disables i386 for SDK >= 10.15
192 - # Will error if has_use tsan and SDK < 10.12
193 - -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
194 - # Use our libtool instead of looking it up with xcrun
195 - -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
196 - )
197 - fi
198 -
199 - cmake_src_configure
200 -
201 - if use test; then
202 - local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
203 - [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
204 - [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
205 -
206 - # copy clang over since resource_dir is located relatively to binary
207 - # therefore, we can put our new libraries in it
208 - mkdir -p "${BUILD_DIR}"/lib/{llvm/${CLANG_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
209 - cp "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/bin/clang{,++} \
210 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/bin/ || die
211 - cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
212 - "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
213 - cp "${sys_dir}"/*builtins*.a \
214 - "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
215 - # we also need LLVMgold.so for gold-based tests
216 - if [[ -f ${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
217 - ln -s "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so \
218 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/$(get_libdir)/ || die
219 - fi
220 - fi
221 -}
222 -
223 -src_test() {
224 - # respect TMPDIR!
225 - local -x LIT_PRESERVES_TMP=1
226 - # disable sandbox to have it stop clobbering LD_PRELOAD
227 - local -x SANDBOX_ON=0
228 - # wipe LD_PRELOAD to make ASAN happy
229 - local -x LD_PRELOAD=
230 -
231 - cmake_build check-all
232 -}
233
234 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild
235 deleted file mode 100644
236 index cc4d0af346b..00000000000
237 --- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild
238 +++ /dev/null
239 @@ -1,164 +0,0 @@
240 -# Copyright 1999-2020 Gentoo Authors
241 -# Distributed under the terms of the GNU General Public License v2
242 -
243 -EAPI=7
244 -
245 -PYTHON_COMPAT=( python3_{6..9} )
246 -inherit check-reqs cmake flag-o-matic llvm llvm.org python-any-r1
247 -
248 -DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
249 -HOMEPAGE="https://llvm.org/"
250 -
251 -LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
252 -SLOT="$(ver_cut 1-3)"
253 -KEYWORDS=""
254 -IUSE="+clang +libfuzzer +profile +sanitize test +xray elibc_glibc"
255 -# FIXME: libfuzzer does not enable all its necessary dependencies
256 -REQUIRED_USE="libfuzzer? ( || ( sanitize xray ) )"
257 -RESTRICT="!test? ( test ) !clang? ( test )"
258 -
259 -CLANG_SLOT=${SLOT%%.*}
260 -# llvm-6 for new lit options
261 -DEPEND="
262 - >=sys-devel/llvm-6"
263 -BDEPEND="
264 - >=dev-util/cmake-3.16
265 - clang? ( sys-devel/clang )
266 - elibc_glibc? ( net-libs/libtirpc )
267 - test? (
268 - !<sys-apps/sandbox-2.13
269 - $(python_gen_any_dep ">=dev-python/lit-5[\${PYTHON_USEDEP}]")
270 - =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
271 - sys-libs/compiler-rt:${SLOT}
272 - )
273 - ${PYTHON_DEPS}"
274 -
275 -LLVM_COMPONENTS=( compiler-rt )
276 -LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
277 -llvm.org_set_globals
278 -
279 -PATCHES=(
280 - "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
281 -)
282 -
283 -python_check_deps() {
284 - use test || return 0
285 - has_version "dev-python/lit[${PYTHON_USEDEP}]"
286 -}
287 -
288 -check_space() {
289 - if use test; then
290 - local CHECKREQS_DISK_BUILD=11G
291 - check-reqs_pkg_pretend
292 - fi
293 -}
294 -
295 -pkg_pretend() {
296 - check_space
297 -}
298 -
299 -pkg_setup() {
300 - check_space
301 - llvm_pkg_setup
302 - python-any-r1_pkg_setup
303 -}
304 -
305 -src_prepare() {
306 - sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
307 -
308 - llvm.org_src_prepare
309 -}
310 -
311 -src_configure() {
312 - # pre-set since we need to pass it to cmake
313 - BUILD_DIR=${WORKDIR}/compiler-rt_build
314 -
315 - if use clang; then
316 - local -x CC=${CHOST}-clang
317 - local -x CXX=${CHOST}-clang++
318 - strip-unsupported-flags
319 - fi
320 -
321 - local mycmakeargs=(
322 - -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
323 - # use a build dir structure consistent with install
324 - # this makes it possible to easily deploy test-friendly clang
325 - -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
326 -
327 - -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
328 - # builtins & crt installed by sys-libs/compiler-rt
329 - -DCOMPILER_RT_BUILD_BUILTINS=OFF
330 - -DCOMPILER_RT_BUILD_CRT=OFF
331 - -DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
332 - -DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
333 - -DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize)
334 - -DCOMPILER_RT_BUILD_XRAY=$(usex xray)
335 -
336 - -DPython3_EXECUTABLE="${PYTHON}"
337 - )
338 - if use test; then
339 - mycmakeargs+=(
340 - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
341 - -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
342 - -DLLVM_LIT_ARGS="$(get_lit_flags)"
343 -
344 - # they are created during src_test()
345 - -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang"
346 - -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang++"
347 - )
348 -
349 - # same flags are passed for build & tests, so we need to strip
350 - # them down to a subset supported by clang
351 - CC=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang \
352 - CXX=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++ \
353 - strip-unsupported-flags
354 - fi
355 -
356 - if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
357 - mycmakeargs+=(
358 - # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
359 - # this allows adding arm64 support using SDK in EPREFIX
360 - -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
361 - # Set version based on the SDK in EPREFIX
362 - # This disables i386 for SDK >= 10.15
363 - # Will error if has_use tsan and SDK < 10.12
364 - -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
365 - # Use our libtool instead of looking it up with xcrun
366 - -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
367 - )
368 - fi
369 -
370 - cmake_src_configure
371 -
372 - if use test; then
373 - local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
374 - [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
375 - [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
376 -
377 - # copy clang over since resource_dir is located relatively to binary
378 - # therefore, we can put our new libraries in it
379 - mkdir -p "${BUILD_DIR}"/lib/{llvm/${CLANG_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
380 - cp "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/bin/clang{,++} \
381 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/bin/ || die
382 - cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
383 - "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
384 - cp "${sys_dir}"/*builtins*.a \
385 - "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
386 - # we also need LLVMgold.so for gold-based tests
387 - if [[ -f ${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
388 - ln -s "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so \
389 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/$(get_libdir)/ || die
390 - fi
391 - fi
392 -}
393 -
394 -src_test() {
395 - # respect TMPDIR!
396 - local -x LIT_PRESERVES_TMP=1
397 - # disable sandbox to have it stop clobbering LD_PRELOAD
398 - local -x SANDBOX_ON=0
399 - # wipe LD_PRELOAD to make ASAN happy
400 - local -x LD_PRELOAD=
401 -
402 - cmake_build check-all
403 -}
404
405 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild
406 deleted file mode 100644
407 index 938e4e371e8..00000000000
408 --- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild
409 +++ /dev/null
410 @@ -1,201 +0,0 @@
411 -# Copyright 1999-2020 Gentoo Authors
412 -# Distributed under the terms of the GNU General Public License v2
413 -
414 -EAPI=7
415 -
416 -PYTHON_COMPAT=( python3_{6..9} )
417 -inherit check-reqs cmake flag-o-matic llvm llvm.org python-any-r1
418 -
419 -DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
420 -HOMEPAGE="https://llvm.org/"
421 -
422 -LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
423 -SLOT="$(ver_cut 1-3)"
424 -KEYWORDS=""
425 -IUSE="+clang test elibc_glibc"
426 -# base targets
427 -IUSE+=" +libfuzzer +profile +xray"
428 -# sanitizer targets, keep in sync with config-ix.cmake
429 -# NB: ubsan, scudo deliberately match two entries
430 -SANITIZER_FLAGS=(
431 - asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
432 - shadowcallstack gwp-asan
433 -)
434 -IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
435 -REQUIRED_USE="
436 - || ( ${SANITIZER_FLAGS[*]} libfuzzer profile xray )
437 - gwp-asan? ( scudo )
438 - ubsan? ( cfi )"
439 -RESTRICT="!test? ( test ) !clang? ( test )"
440 -
441 -CLANG_SLOT=${SLOT%%.*}
442 -# llvm-6 for new lit options
443 -DEPEND="
444 - >=sys-devel/llvm-6"
445 -BDEPEND="
446 - >=dev-util/cmake-3.16
447 - clang? ( sys-devel/clang )
448 - elibc_glibc? ( net-libs/libtirpc )
449 - test? (
450 - !<sys-apps/sandbox-2.13
451 - $(python_gen_any_dep ">=dev-python/lit-5[\${PYTHON_USEDEP}]")
452 - =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
453 - sys-libs/compiler-rt:${SLOT}
454 - )
455 - ${PYTHON_DEPS}"
456 -
457 -LLVM_COMPONENTS=( compiler-rt )
458 -LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
459 -llvm.org_set_globals
460 -
461 -PATCHES=(
462 - "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
463 -)
464 -
465 -python_check_deps() {
466 - use test || return 0
467 - has_version "dev-python/lit[${PYTHON_USEDEP}]"
468 -}
469 -
470 -check_space() {
471 - if use test; then
472 - local CHECKREQS_DISK_BUILD=11G
473 - check-reqs_pkg_pretend
474 - fi
475 -}
476 -
477 -pkg_pretend() {
478 - check_space
479 -}
480 -
481 -pkg_setup() {
482 - check_space
483 - llvm_pkg_setup
484 - python-any-r1_pkg_setup
485 -}
486 -
487 -src_prepare() {
488 - sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
489 -
490 - local flag
491 - for flag in "${SANITIZER_FLAGS[@]}"; do
492 - if ! use "${flag}"; then
493 - local cmake_flag=${flag/-/_}
494 - sed -i -e "/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
495 - cmake/config-ix.cmake || die
496 - fi
497 - done
498 -
499 - if use asan && ! use profile; then
500 - # TODO: fix these tests to be skipped upstream
501 - rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
502 - fi
503 -
504 - # broken with new glibc
505 - sed -i -e '/EXPECT_EQ.*ThreadDescriptorSize/d' \
506 - lib/sanitizer_common/tests/sanitizer_linux_test.cpp || die
507 -
508 - llvm.org_src_prepare
509 -}
510 -
511 -src_configure() {
512 - # pre-set since we need to pass it to cmake
513 - BUILD_DIR=${WORKDIR}/compiler-rt_build
514 -
515 - if use clang; then
516 - local -x CC=${CHOST}-clang
517 - local -x CXX=${CHOST}-clang++
518 - strip-unsupported-flags
519 - fi
520 -
521 - local flag want_sanitizer=OFF
522 - for flag in "${SANITIZER_FLAGS[@]}"; do
523 - if use "${flag}"; then
524 - want_sanitizer=ON
525 - break
526 - fi
527 - done
528 -
529 - local mycmakeargs=(
530 - -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
531 - # use a build dir structure consistent with install
532 - # this makes it possible to easily deploy test-friendly clang
533 - -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
534 -
535 - -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
536 - # builtins & crt installed by sys-libs/compiler-rt
537 - -DCOMPILER_RT_BUILD_BUILTINS=OFF
538 - -DCOMPILER_RT_BUILD_CRT=OFF
539 - -DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
540 - -DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
541 - -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
542 - -DCOMPILER_RT_BUILD_XRAY=$(usex xray)
543 -
544 - -DPython3_EXECUTABLE="${PYTHON}"
545 - )
546 - if use test; then
547 - mycmakeargs+=(
548 - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
549 - -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
550 - -DLLVM_LIT_ARGS="$(get_lit_flags)"
551 -
552 - # they are created during src_test()
553 - -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang"
554 - -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/bin/clang++"
555 - )
556 -
557 - # same flags are passed for build & tests, so we need to strip
558 - # them down to a subset supported by clang
559 - CC=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang \
560 - CXX=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++ \
561 - strip-unsupported-flags
562 - fi
563 -
564 - if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
565 - mycmakeargs+=(
566 - # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
567 - # this allows adding arm64 support using SDK in EPREFIX
568 - -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
569 - # Set version based on the SDK in EPREFIX
570 - # This disables i386 for SDK >= 10.15
571 - # Will error if has_use tsan and SDK < 10.12
572 - -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
573 - # Use our libtool instead of looking it up with xcrun
574 - -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
575 - )
576 - fi
577 -
578 - cmake_src_configure
579 -
580 - if use test; then
581 - local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
582 - [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
583 - [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
584 -
585 - # copy clang over since resource_dir is located relatively to binary
586 - # therefore, we can put our new libraries in it
587 - mkdir -p "${BUILD_DIR}"/lib/{llvm/${CLANG_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
588 - cp "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/bin/clang{,++} \
589 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/bin/ || die
590 - cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
591 - "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
592 - cp "${sys_dir}"/*builtins*.a \
593 - "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
594 - # we also need LLVMgold.so for gold-based tests
595 - if [[ -f ${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
596 - ln -s "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so \
597 - "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/$(get_libdir)/ || die
598 - fi
599 - fi
600 -}
601 -
602 -src_test() {
603 - # respect TMPDIR!
604 - local -x LIT_PRESERVES_TMP=1
605 - # disable sandbox to have it stop clobbering LD_PRELOAD
606 - local -x SANDBOX_ON=0
607 - # wipe LD_PRELOAD to make ASAN happy
608 - local -x LD_PRELOAD=
609 -
610 - cmake_build check-all
611 -}