From 1f6fe0559b3c8d77d43bdb6fc48cd76343f1baf9 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 1 Dec 2017 21:16:13 -0500 Subject: [PATCH] build: Copy and use Clang's vector intrinsics headers. When compiling with GCC, these headers get pulled in from the gcc_syslibs_devel package, but we cannot do something similar for Clang as Clang adds/removes internal builtins used by the headers nearly every version. So instead we just copy all the intrinsics headers from current Clang into generated, and make sure this directory is included before any others. --- build/jam/HeadersRules | 4 ++++ configure | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules index ea6571c67a..ac4d4cb6c1 100644 --- a/build/jam/HeadersRules +++ b/build/jam/HeadersRules @@ -456,6 +456,10 @@ rule FStandardHeaders architecture local headers = ; + if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { + headers += [ FDirName $(HAIKU_OUTPUT_DIR) clang_headers ] ; + } + # The c++ headers. headers += [ C++HeaderDirectories $(architecture) ] ; diff --git a/configure b/configure index f271dc9387..8b27911ce0 100755 --- a/configure +++ b/configure @@ -808,6 +808,12 @@ else # prepare gcc settings and get the actual target architecture if [ $useClang = 1 ]; then gcc="$HAIKU_clang -target ${targetMachine} -no-integrated-as" + + # Clang's compiler intrinsics are not compatible with GCC's or even + # across versions of Clang, so we must collect them for use in the build. + mkdir -p "$outputDir/clang_headers" || exit 1 + clangHeadersDir=`$gcc -print-resource-dir`/include/ + cp $clangHeadersDir/*intrin* $clangHeadersDir/mm3* "$outputDir/clang_headers" || exit 1 elif [ -z "${crossToolsPrefix}" ]; then gcc=`get_variable HAIKU_CC_$targetArch` else