From 26de78f5fece9313f9158b0bac8e0c575e68c1fa Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Tue, 13 Oct 2020 23:37:05 +0800 Subject: llvm: fix build with LLVM11 Ensure that we can build with both dunfell (LLVM10) and current master (LLVM11) of meta-clang. Look for LLVMVERSION set by meta-clang and include relevant patches based on the version. There's no official release for SPIRV-LLVM-Translator yet for LLVM11 so pick the latest. Signed-off-by: Anuj Mittal --- .../clang/files/llvm11-skip-building-tests.patch | 51 ++++++++++++++++++++++ .../clang/llvm-project-source.bbappend | 28 +++++++++--- 2 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch new file mode 100644 index 00000000..011c09ee --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch @@ -0,0 +1,51 @@ +From d362652617c5e840089273df0c6623a9745c92a2 Mon Sep 17 00:00:00 2001 +From: Naveen Saini +Date: Wed, 21 Aug 2019 14:35:31 +0800 +Subject: [PATCH] llvm-spirv: skip building tests + +Some of these need clang to be built and since we're building this in-tree, +that leads to problems when compiling libcxx, compiler-rt which aren't built +in-tree. + +Instead of using SPIRV_SKIP_CLANG_BUILD to skip clang build and adding this to +all components, disable the building of tests altogether. + +Upstream-Status: Inappropriate + +Signed-off-by: Anuj Mittal +Signed-off-by: Naveen Saini +--- + CMakeLists.txt | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ecebb4cb..578ca602 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,13 +25,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL) + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + +- if(LLVM_SPIRV_INCLUDE_TESTS) +- set(LLVM_TEST_COMPONENTS +- llvm-as +- llvm-dis +- ) +- endif(LLVM_SPIRV_INCLUDE_TESTS) +- + find_package(LLVM ${BASE_LLVM_VERSION} REQUIRED + COMPONENTS + Analysis +@@ -62,9 +55,6 @@ set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) + + add_subdirectory(lib/SPIRV) + add_subdirectory(tools/llvm-spirv) +-if(LLVM_SPIRV_INCLUDE_TESTS) +- add_subdirectory(test) +-endif(LLVM_SPIRV_INCLUDE_TESTS) + + install( + FILES +-- +2.26.2 + diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend b/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend index 4c05b659..8a6f6c70 100644 --- a/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend +++ b/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend @@ -1,11 +1,27 @@ FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:" +SPIRV_BRANCH = "${@bb.utils.contains('LLVMVERSION', '10.0.1', 'llvm_release_100', 'llvm_release_110', d)}" + +SPIRV10_SRCREV = "4d43f68a30a510b4e7607351caab3df8e7426a6b" +SPIRV11_SRCREV = "61a10b27604bc4a9f6840f8fad82b779e708a279" + +SPIRV_SRCREV = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SPIRV10_SRCREV}', '${SPIRV11_SRCREV}', d)}" + +SRC_URI_LLVM10 = " \ + file://llvm10-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \ + file://fix-shared-libs.patch;patchdir=llvm/projects/llvm-spirv \ + file://BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch;patchdir=llvm \ + file://IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch;patchdir=llvm \ + " + +SRC_URI_LLVM11 = " \ + file://llvm11-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \ + " + SRC_URI_append_intel-x86-common = " \ - git://github.com/KhronosGroup/SPIRV-LLVM-Translator.git;protocol=https;branch=llvm_release_100;destsuffix=git/llvm/projects/llvm-spirv;name=spirv \ - file://llvm10-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \ - file://fix-shared-libs.patch;patchdir=llvm/projects/llvm-spirv \ - file://BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch;patchdir=llvm \ - file://IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch;patchdir=llvm \ + git://github.com/KhronosGroup/SPIRV-LLVM-Translator.git;protocol=https;branch=${SPIRV_BRANCH};destsuffix=git/llvm/projects/llvm-spirv;name=spirv \ " -SRCREV_spirv = "4d43f68a30a510b4e7607351caab3df8e7426a6b" +SRC_URI_append_intel-x86-common = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SRC_URI_LLVM10}', '${SRC_URI_LLVM11}', d)}" + +SRCREV_spirv = "${SPIRV_SRCREV}" -- cgit v1.2.3-54-g00ecf