summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-12-21 16:36:48 +0100
committerMichał Górny <mgorny@gentoo.org>2020-12-21 20:06:10 +0100
commit1aa0758046606b008709a7c3a1ff3cbd87a56eae (patch)
treeb51752b0898000038e9f942c311a71f9ea4f7e83 /sys-libs
parentprofiles: Mask sys-libs/compiler-rt-sanitizers flags per arch (diff)
downloadgentoo-1aa0758046606b008709a7c3a1ff3cbd87a56eae.tar.gz
gentoo-1aa0758046606b008709a7c3a1ff3cbd87a56eae.tar.bz2
gentoo-1aa0758046606b008709a7c3a1ff3cbd87a56eae.zip
sys-libs/compiler-rt-sanitizers: Provide flags for sanitizers
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild39
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild39
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild39
-rw-r--r--sys-libs/compiler-rt-sanitizers/metadata.xml15
4 files changed, 123 insertions, 9 deletions
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
index 67e9b199c31b..81547ee16054 100644
--- 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
@@ -12,9 +12,20 @@ HOMEPAGE="https://llvm.org/"
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
SLOT="$(ver_cut 1-3)"
KEYWORDS=""
-IUSE="+clang +libfuzzer +profile +sanitize test +xray elibc_glibc"
+IUSE="+clang test elibc_glibc"
+# base targets
+IUSE+=" +libfuzzer +profile +xray"
+# sanitizer targets, keep in sync with config-ix.cmake
+# NB: ubsan, scudo deliberately match two entries
+SANITIZER_FLAGS=(
+ asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
+ shadowcallstack gwp-asan
+)
+IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
REQUIRED_USE="
- || ( libfuzzer profile sanitize xray )"
+ || ( ${SANITIZER_FLAGS[*]} libfuzzer profile xray )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
RESTRICT="!test? ( test ) !clang? ( test )"
CLANG_SLOT=${SLOT%%.*}
@@ -62,6 +73,20 @@ pkg_setup() {
src_prepare() {
sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
+ local flag
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if ! use "${flag}"; then
+ local cmake_flag=${flag/-/_}
+ sed -i -e "/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
+ cmake/config-ix.cmake || die
+ fi
+ done
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
+ fi
+
llvm.org_src_prepare
}
@@ -75,6 +100,14 @@ src_configure() {
strip-unsupported-flags
fi
+ local flag want_sanitizer=OFF
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if use "${flag}"; then
+ want_sanitizer=ON
+ break
+ fi
+ done
+
local mycmakeargs=(
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
# use a build dir structure consistent with install
@@ -87,7 +120,7 @@ src_configure() {
-DCOMPILER_RT_BUILD_CRT=OFF
-DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
-DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
- -DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize)
+ -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
-DCOMPILER_RT_BUILD_XRAY=$(usex xray)
-DPython3_EXECUTABLE="${PYTHON}"
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
index 67e9b199c31b..81547ee16054 100644
--- 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
@@ -12,9 +12,20 @@ HOMEPAGE="https://llvm.org/"
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
SLOT="$(ver_cut 1-3)"
KEYWORDS=""
-IUSE="+clang +libfuzzer +profile +sanitize test +xray elibc_glibc"
+IUSE="+clang test elibc_glibc"
+# base targets
+IUSE+=" +libfuzzer +profile +xray"
+# sanitizer targets, keep in sync with config-ix.cmake
+# NB: ubsan, scudo deliberately match two entries
+SANITIZER_FLAGS=(
+ asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
+ shadowcallstack gwp-asan
+)
+IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
REQUIRED_USE="
- || ( libfuzzer profile sanitize xray )"
+ || ( ${SANITIZER_FLAGS[*]} libfuzzer profile xray )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
RESTRICT="!test? ( test ) !clang? ( test )"
CLANG_SLOT=${SLOT%%.*}
@@ -62,6 +73,20 @@ pkg_setup() {
src_prepare() {
sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
+ local flag
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if ! use "${flag}"; then
+ local cmake_flag=${flag/-/_}
+ sed -i -e "/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
+ cmake/config-ix.cmake || die
+ fi
+ done
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
+ fi
+
llvm.org_src_prepare
}
@@ -75,6 +100,14 @@ src_configure() {
strip-unsupported-flags
fi
+ local flag want_sanitizer=OFF
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if use "${flag}"; then
+ want_sanitizer=ON
+ break
+ fi
+ done
+
local mycmakeargs=(
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
# use a build dir structure consistent with install
@@ -87,7 +120,7 @@ src_configure() {
-DCOMPILER_RT_BUILD_CRT=OFF
-DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
-DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
- -DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize)
+ -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
-DCOMPILER_RT_BUILD_XRAY=$(usex xray)
-DPython3_EXECUTABLE="${PYTHON}"
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
index 67e9b199c31b..81547ee16054 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
@@ -12,9 +12,20 @@ HOMEPAGE="https://llvm.org/"
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
SLOT="$(ver_cut 1-3)"
KEYWORDS=""
-IUSE="+clang +libfuzzer +profile +sanitize test +xray elibc_glibc"
+IUSE="+clang test elibc_glibc"
+# base targets
+IUSE+=" +libfuzzer +profile +xray"
+# sanitizer targets, keep in sync with config-ix.cmake
+# NB: ubsan, scudo deliberately match two entries
+SANITIZER_FLAGS=(
+ asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
+ shadowcallstack gwp-asan
+)
+IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
REQUIRED_USE="
- || ( libfuzzer profile sanitize xray )"
+ || ( ${SANITIZER_FLAGS[*]} libfuzzer profile xray )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
RESTRICT="!test? ( test ) !clang? ( test )"
CLANG_SLOT=${SLOT%%.*}
@@ -62,6 +73,20 @@ pkg_setup() {
src_prepare() {
sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
+ local flag
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if ! use "${flag}"; then
+ local cmake_flag=${flag/-/_}
+ sed -i -e "/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
+ cmake/config-ix.cmake || die
+ fi
+ done
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
+ fi
+
llvm.org_src_prepare
}
@@ -75,6 +100,14 @@ src_configure() {
strip-unsupported-flags
fi
+ local flag want_sanitizer=OFF
+ for flag in "${SANITIZER_FLAGS[@]}"; do
+ if use "${flag}"; then
+ want_sanitizer=ON
+ break
+ fi
+ done
+
local mycmakeargs=(
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
# use a build dir structure consistent with install
@@ -87,7 +120,7 @@ src_configure() {
-DCOMPILER_RT_BUILD_CRT=OFF
-DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
-DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
- -DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize)
+ -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
-DCOMPILER_RT_BUILD_XRAY=$(usex xray)
-DPython3_EXECUTABLE="${PYTHON}"
diff --git a/sys-libs/compiler-rt-sanitizers/metadata.xml b/sys-libs/compiler-rt-sanitizers/metadata.xml
index 8f5cbb8b29ad..5f139415fce4 100644
--- a/sys-libs/compiler-rt-sanitizers/metadata.xml
+++ b/sys-libs/compiler-rt-sanitizers/metadata.xml
@@ -11,5 +11,20 @@
<flag name='profile'>Build profiling runtime.</flag>
<flag name='sanitize'>Build sanitizer runtimes.</flag>
<flag name='xray'>Build XRay runtime.</flag>
+
+ <flag name='asan'>Build Address Sanitizer runtime.</flag>
+ <flag name='dfsan'>Build Data Flow Sanitizer runtime.</flag>
+ <flag name='lsan'>Build Leak Sanitizer runtime.</flag>
+ <flag name='msan'>Build Memory Sanitizer runtime.</flag>
+ <flag name='hwasan'>Build Hardware ASAN runtime.</flag>
+ <flag name='tsan'>Build Thread Sanitizer runtime.</flag>
+ <flag name='ubsan'>
+ Build Undefined Behavior Sanitizer runtime.
+ </flag>
+ <flag name='safestack'>Build SafeStack runtime.</flag>
+ <flag name='cfi'>Build Control Flow Integrity runtime.</flag>
+ <flag name='scudo'>Build Scudo Hardened Allocator.</flag>
+ <flag name='shadowcallstack'>Build ShadowCallStack.</flag>
+ <flag name='gwp-asan'>Build GWP-ASAN runtime.</flag>
</use>
</pkgmetadata>