commit:     eedf77d75e5c31e21ec249ba7d4341c32e3ae84f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 17:44:47 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 17:44:47 2017 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=eedf77d7

crossdev: change USE=sanitize to whitelist

asan needs explicit support code for every arch/OS.
Currently the following seem to have support:
- amd64-glibc
- x86-glibc
- arm-glibc
- aarch64-glibc
- powerpc64-glibc
- mips-glibc
- mips64-glibc (n32 ABI, fails to build)

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 crossdev | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/crossdev b/crossdev
index 1cd59fb..76f9a06 100755
--- a/crossdev
+++ b/crossdev
@@ -323,8 +323,6 @@ parse_target() {
                        KPKG="[none]"
                        STAGE_DEFAULT=${STAGE_LIBC}
                        GUSE+=" cxx -openmp" #489798
-                       # asan needs OS support to implement sanitizers
-                       GUSE+=" -sanitize"
                        MULTILIB_USE="yes" #407275
                        WITH_DEF_HEADERS="no"
                        ;;
@@ -335,6 +333,30 @@ parse_target() {
                        KPKG="[none]"
                        ;;
        esac
+
+       local sanitizer_support=no
+       # Whitelist asan on explicitly supported arches fo linux.
+       # Broken examples:
+       # - musl libc
+       # - bare metal targets
+       # Untested examples:
+       # - *BSD
+       case ${CTARGET} in
+               # glibc targets
+               *-gnu*)
+                       case ${CTARGET} in
+                               mips64*)
+                                       # has some support code, fails to build
+                                       ;;
+                               x86_64*|i?86*|arm*|aarch64|powerpc64)
+                                       sanitizer_support=yes
+                                       ;;
+                       esac
+                       ;;
+       esac
+       if [[ $sanitizer_support = "no" ]]; then
+               GUSE+=" -sanitize"
+       fi
 }
 
 parse_repo_config() {

Reply via email to