diff options
| author | Khem Raj <raj.khem@gmail.com> | 2025-05-04 21:15:11 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-05 18:02:48 +0100 |
| commit | 79030cd4c463f7fd6a716d94ab5dc7707a3fed77 (patch) | |
| tree | 620b060128c3a6e1ae2d9ecd1ae6a0722aaf0ab1 /meta/recipes-devtools/llvm | |
| parent | 437ad6eaa8383a2c2ab9364caa05442e99ed6efc (diff) | |
| download | poky-79030cd4c463f7fd6a716d94ab5dc7707a3fed77.tar.gz | |
clang: Merge llvm/clang family recipes from meta-clang
This can ensure that meta-clang does not carry them and can rely on core layer
while mesa can use them too.
Omit time stamps in openmp from generated files to improve
reproducibility
fix the issue that:
| file /usr/include/llvm/Config/llvm-config.h conflicts between attempted installs of lib32-llvm-dev-20.1.2-r0.core2_32 and llvm-dev-20.1.2-r0.core2_64
(From OE-Core rev: d77e398095228b34851762858a76640e3c2cb0ab)
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/llvm')
8 files changed, 0 insertions, 560 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch deleted file mode 100644 index f71c5d4bd4..0000000000 --- a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 001d56983078842c5aa2a1786b84dc429bd46abd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 3 | Date: Fri, 27 Nov 2020 10:11:08 +0000 | ||
| 4 | Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well | ||
| 5 | |||
| 6 | Otherwise, there are instances which are identical in | ||
| 7 | every other field and therefore sort non-reproducibly | ||
| 8 | (which breaks binary and source reproducibiliy). | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://reviews.llvm.org/D97477] | ||
| 11 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 12 | --- | ||
| 13 | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++- | ||
| 14 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp | ||
| 17 | index 7684387d8..d225a3b6d 100644 | ||
| 18 | --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp | ||
| 19 | +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp | ||
| 20 | @@ -361,7 +361,10 @@ public: | ||
| 21 | // name of a class shouldn't be significant. However, some of the backends | ||
| 22 | // accidentally rely on this behaviour, so it will have to stay like this | ||
| 23 | // until they are fixed. | ||
| 24 | - return ValueName < RHS.ValueName; | ||
| 25 | + if (ValueName != RHS.ValueName) | ||
| 26 | + return ValueName < RHS.ValueName; | ||
| 27 | + // All else being equal, we should sort by name, for source and binary reproducibility | ||
| 28 | + return Name < RHS.Name; | ||
| 29 | } | ||
| 30 | }; | ||
| 31 | |||
diff --git a/meta/recipes-devtools/llvm/llvm/0001-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch b/meta/recipes-devtools/llvm/llvm/0001-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch deleted file mode 100644 index 2320399d5f..0000000000 --- a/meta/recipes-devtools/llvm/llvm/0001-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 1 | From caff2482f786dd7fd5f1f46f2667f7ed847cb8f8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 3 | Date: Wed, 2 Apr 2025 17:05:17 +0300 | ||
| 4 | Subject: [PATCH] llvm-config: remove LLVM_LDFLAGS from --ldflags output | ||
| 5 | |||
| 6 | On native OE builds the LLVM_LDFLAGS gets a lot of extra flags which may | ||
| 7 | depend on exact build dir and as such be inappropriate to binaries | ||
| 8 | shared through sstate-cache. It is not possible to override this | ||
| 9 | behaviour in llvm-config since crossscripts are not being used for | ||
| 10 | native builds. As a OE-specific modification ignore LLVM_LDFLAGS for | ||
| 11 | native builds. | ||
| 12 | |||
| 13 | Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 14 | Upstream-Status: Inappropriate [OE-Specific] | ||
| 15 | --- | ||
| 16 | llvm/tools/llvm-config/llvm-config.cpp | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp | ||
| 20 | index d5b76b1bb6c1..29f7c2eaa419 100644 | ||
| 21 | --- a/llvm/tools/llvm-config/llvm-config.cpp | ||
| 22 | +++ b/llvm/tools/llvm-config/llvm-config.cpp | ||
| 23 | @@ -529,7 +529,7 @@ int main(int argc, char **argv) { | ||
| 24 | OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; | ||
| 25 | } else if (Arg == "--ldflags") { | ||
| 26 | OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L") | ||
| 27 | - << ActiveLibDir << ' ' << LLVM_LDFLAGS << '\n'; | ||
| 28 | + << ActiveLibDir << '\n'; | ||
| 29 | } else if (Arg == "--system-libs") { | ||
| 30 | PrintSystemLibs = true; | ||
| 31 | } else if (Arg == "--libs") { | ||
| 32 | -- | ||
| 33 | 2.39.5 | ||
| 34 | |||
diff --git a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch deleted file mode 100644 index f1ab005464..0000000000 --- a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | From 3eb1eefed6fc654d19ab97bbc748454c22a29009 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Martin Kelly <mkelly@xevo.com> | ||
| 3 | Date: Fri, 19 May 2017 00:22:57 -0700 | ||
| 4 | Subject: [PATCH] llvm: allow env override of exe and libdir path | ||
| 5 | |||
| 6 | When using a native llvm-config from inside a sysroot, we need llvm-config to | ||
| 7 | return the libraries, include directories, etc. from inside the sysroot rather | ||
| 8 | than from the native sysroot. Thus provide an env override for calling | ||
| 9 | llvm-config from a target sysroot. | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE-specific] | ||
| 12 | |||
| 13 | Signed-off-by: Martin Kelly <mkelly@xevo.com> | ||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++ | ||
| 17 | 1 file changed, 7 insertions(+) | ||
| 18 | |||
| 19 | diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp | ||
| 20 | index d5b76b1bb..6c28c34bc 100644 | ||
| 21 | --- a/llvm/tools/llvm-config/llvm-config.cpp | ||
| 22 | +++ b/llvm/tools/llvm-config/llvm-config.cpp | ||
| 23 | @@ -246,6 +246,13 @@ Typical components:\n\ | ||
| 24 | |||
| 25 | /// Compute the path to the main executable. | ||
| 26 | std::string GetExecutablePath(const char *Argv0) { | ||
| 27 | + // Hack for Yocto: we need to override the root path when we are using | ||
| 28 | + // llvm-config from within a target sysroot. | ||
| 29 | + const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH"); | ||
| 30 | + if (Sysroot != nullptr) { | ||
| 31 | + return Sysroot; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | // This just needs to be some symbol in the binary; C++ doesn't | ||
| 35 | // allow taking the address of ::main however. | ||
| 36 | void *P = (void *)(intptr_t)GetExecutablePath; | ||
diff --git a/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch b/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch deleted file mode 100644 index 94c056ab8e..0000000000 --- a/meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | From 93141cee493022d9f39dbd1f5f0bb0a1110ac829 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ovidiu Panait <ovidiu.panait@windriver.com> | ||
| 3 | Date: Fri, 31 Jan 2020 10:56:11 +0200 | ||
| 4 | Subject: [PATCH] cmake: Fix configure for packages using find_package() | ||
| 5 | |||
| 6 | Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git]) | ||
| 7 | that depends on LLVM/Clang tries to run cmake find_package() during | ||
| 8 | do_configure, it will fail with a similar error: | ||
| 9 | |||
| 10 | | The imported target "llvm-tblgen" references the file | ||
| 11 | | ".../recipe-sysroot/usr/bin/llvm-tblgen" | ||
| 12 | | | ||
| 13 | | but this file does not exist. Possible reasons include: | ||
| 14 | | * The file was deleted, renamed, or moved to another location. | ||
| 15 | | * An install or uninstall procedure did not complete successfully. | ||
| 16 | | * The installation package was faulty and contained | ||
| 17 | | ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake" | ||
| 18 | | but not all the files it references. | ||
| 19 | |||
| 20 | This is due to the fact that currently the cmake scripts look for target | ||
| 21 | binaries in sysroot. Work around this by not exporting the target binaries in | ||
| 22 | Exports-* cmake files. | ||
| 23 | |||
| 24 | Upstream-Status: Inappropriate [oe-specific] | ||
| 25 | |||
| 26 | Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> | ||
| 27 | --- | ||
| 28 | clang/cmake/modules/AddClang.cmake | 2 -- | ||
| 29 | llvm/cmake/modules/AddLLVM.cmake | 9 ++------- | ||
| 30 | llvm/cmake/modules/TableGen.cmake | 6 ------ | ||
| 31 | 3 files changed, 2 insertions(+), 15 deletions(-) | ||
| 32 | |||
| 33 | diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake | ||
| 34 | index cdc8bd5cd503..5faa9117a30f 100644 | ||
| 35 | --- a/clang/cmake/modules/AddClang.cmake | ||
| 36 | +++ b/clang/cmake/modules/AddClang.cmake | ||
| 37 | @@ -182,7 +182,6 @@ macro(add_clang_tool name) | ||
| 38 | if (CLANG_BUILD_TOOLS) | ||
| 39 | get_target_export_arg(${name} Clang export_to_clangtargets) | ||
| 40 | install(TARGETS ${name} | ||
| 41 | - ${export_to_clangtargets} | ||
| 42 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
| 43 | COMPONENT ${name}) | ||
| 44 | |||
| 45 | @@ -191,7 +190,6 @@ macro(add_clang_tool name) | ||
| 46 | DEPENDS ${name} | ||
| 47 | COMPONENT ${name}) | ||
| 48 | endif() | ||
| 49 | - set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) | ||
| 50 | endif() | ||
| 51 | endif() | ||
| 52 | set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON) | ||
| 53 | diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake | ||
| 54 | index d3e9377c8d2f..fe22d6f2b35a 100644 | ||
| 55 | --- a/llvm/cmake/modules/AddLLVM.cmake | ||
| 56 | +++ b/llvm/cmake/modules/AddLLVM.cmake | ||
| 57 | @@ -1492,7 +1492,6 @@ macro(llvm_add_tool project name) | ||
| 58 | if( LLVM_BUILD_TOOLS ) | ||
| 59 | get_target_export_arg(${name} ${project} export_to_llvmexports) | ||
| 60 | install(TARGETS ${name} | ||
| 61 | - ${export_to_llvmexports} | ||
| 62 | RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR} | ||
| 63 | COMPONENT ${name}) | ||
| 64 | |||
| 65 | @@ -1503,10 +1502,8 @@ macro(llvm_add_tool project name) | ||
| 66 | endif() | ||
| 67 | endif() | ||
| 68 | endif() | ||
| 69 | - if( LLVM_BUILD_TOOLS ) | ||
| 70 | - string(TOUPPER "${project}" project_upper) | ||
| 71 | - set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name}) | ||
| 72 | - endif() | ||
| 73 | + string(TOUPPER "${project}" project_upper) | ||
| 74 | + set_target_properties(${name} PROPERTIES FOLDER "Tools") | ||
| 75 | endif() | ||
| 76 | get_subproject_title(subproject_title) | ||
| 77 | set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools") | ||
| 78 | @@ -1556,7 +1553,6 @@ macro(add_llvm_utility name) | ||
| 79 | if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) | ||
| 80 | get_target_export_arg(${name} LLVM export_to_llvmexports) | ||
| 81 | install(TARGETS ${name} | ||
| 82 | - ${export_to_llvmexports} | ||
| 83 | RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR} | ||
| 84 | COMPONENT ${name}) | ||
| 85 | |||
| 86 | @@ -1565,7 +1561,6 @@ macro(add_llvm_utility name) | ||
| 87 | DEPENDS ${name} | ||
| 88 | COMPONENT ${name}) | ||
| 89 | endif() | ||
| 90 | - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) | ||
| 91 | elseif(LLVM_BUILD_UTILS) | ||
| 92 | set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name}) | ||
| 93 | endif() | ||
| 94 | diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake | ||
| 95 | index ffcc718b4777..a76f28e74b86 100644 | ||
| 96 | --- a/llvm/cmake/modules/TableGen.cmake | ||
| 97 | +++ b/llvm/cmake/modules/TableGen.cmake | ||
| 98 | @@ -232,12 +232,7 @@ macro(add_tablegen target project) | ||
| 99 | |||
| 100 | if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND | ||
| 101 | (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)) | ||
| 102 | - set(export_arg) | ||
| 103 | - if(ADD_TABLEGEN_EXPORT) | ||
| 104 | - get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg) | ||
| 105 | - endif() | ||
| 106 | install(TARGETS ${target} | ||
| 107 | - ${export_arg} | ||
| 108 | COMPONENT ${target} | ||
| 109 | RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}") | ||
| 110 | if(NOT LLVM_ENABLE_IDE) | ||
| 111 | @@ -248,6 +243,5 @@ macro(add_tablegen target project) | ||
| 112 | endif() | ||
| 113 | if(ADD_TABLEGEN_EXPORT) | ||
| 114 | string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper) | ||
| 115 | - set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target}) | ||
| 116 | endif() | ||
| 117 | endmacro() | ||
diff --git a/meta/recipes-devtools/llvm/llvm/llvm-config b/meta/recipes-devtools/llvm/llvm/llvm-config deleted file mode 100644 index 6cf3e7578f..0000000000 --- a/meta/recipes-devtools/llvm/llvm/llvm-config +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Copyright OpenEmbedded Contributors | ||
| 4 | # | ||
| 5 | # SPDX-License-Identifier: MIT | ||
| 6 | # | ||
| 7 | # Wrap llvm-config since the native llvm-config will remap some values correctly | ||
| 8 | # if placed in the target sysroot but for flags, it would provide the native ones. | ||
| 9 | # Provide ours from the environment instead. | ||
| 10 | |||
| 11 | NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" | ||
| 12 | if [[ $# == 0 ]]; then | ||
| 13 | exec "$NEXT_LLVM_CONFIG" | ||
| 14 | fi | ||
| 15 | |||
| 16 | remain="" | ||
| 17 | output="" | ||
| 18 | for arg in "$@"; do | ||
| 19 | case "$arg" in | ||
| 20 | --cppflags) | ||
| 21 | output="${output} ${CPPFLAGS}" | ||
| 22 | ;; | ||
| 23 | --cflags) | ||
| 24 | output="${output} ${CFLAGS}" | ||
| 25 | ;; | ||
| 26 | --cxxflags) | ||
| 27 | output="${output} ${CXXFLAGS}" | ||
| 28 | ;; | ||
| 29 | --ldflags) | ||
| 30 | output="${output} ${LDFLAGS}" | ||
| 31 | ;; | ||
| 32 | --shared-mode) | ||
| 33 | output="${output} shared" | ||
| 34 | ;; | ||
| 35 | --libs) | ||
| 36 | output="${output} -lLLVM" | ||
| 37 | ;; | ||
| 38 | --libdir) | ||
| 39 | output="${output} ${libdir}" | ||
| 40 | ;; | ||
| 41 | --link-shared) | ||
| 42 | break | ||
| 43 | ;; | ||
| 44 | *) | ||
| 45 | remain="${remain} ${arg}" | ||
| 46 | ;; | ||
| 47 | esac | ||
| 48 | done | ||
| 49 | |||
| 50 | if [ "${remain}" != "" ]; then | ||
| 51 | output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) | ||
| 52 | fi | ||
| 53 | |||
| 54 | echo "${output}" | ||
diff --git a/meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch b/meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch deleted file mode 100644 index 555d40f4fb..0000000000 --- a/meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 3 | Date: Fri, 21 Mar 2025 17:17:52 +0200 | ||
| 4 | Subject: [PATCH] SPIRV-LLVM-Translator: fix handling of built-in SPIRV targer | ||
| 5 | |||
| 6 | If the SPIRV-LLVM-Translator is being built together with the LLVM, set | ||
| 7 | the defines declaring whether SPIRV target is also included into the | ||
| 8 | LLVM library or not. Otherwise llvm-spirv execution fails because | ||
| 9 | spirv-ext option is registered twice. | ||
| 10 | |||
| 11 | Upstream-Status: Pending [will be submitted upstream after internal clearance] | ||
| 12 | Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 13 | |||
| 14 | Index: llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt | ||
| 15 | =================================================================== | ||
| 16 | --- llvm-project-20.1.0.src.orig/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt | ||
| 17 | +++ llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt | ||
| 18 | @@ -116,6 +116,12 @@ if(LLVM_SPIRV_BUILD_EXTERNAL) | ||
| 19 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) | ||
| 20 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) | ||
| 21 | endif() | ||
| 22 | +else() | ||
| 23 | + is_llvm_target_library("SPIRV" spirv_present_result INCLUDED_TARGETS) | ||
| 24 | + if(spirv_present_result) | ||
| 25 | + set(SPIRV_BACKEND_FOUND TRUE) | ||
| 26 | + add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT) | ||
| 27 | + endif() | ||
| 28 | endif() | ||
| 29 | |||
| 30 | set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
diff --git a/meta/recipes-devtools/llvm/llvm/spirv-shared-library.patch b/meta/recipes-devtools/llvm/llvm/spirv-shared-library.patch deleted file mode 100644 index edc595d576..0000000000 --- a/meta/recipes-devtools/llvm/llvm/spirv-shared-library.patch +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 3 | Date: Thu, 9 Apr 2025 15:20:32 +0200 | ||
| 4 | Subject: [PATCH] SPIRV-LLVM-Translator: build shared library | ||
| 5 | |||
| 6 | By default SPIRV-LLVM-Translator builds only a static version of the library. | ||
| 7 | Unfortunately this might result in linking erros when uninative is in play, if | ||
| 8 | libLLVMSPIRV uses symbols which are provided only by the uninative libc and are | ||
| 9 | not provided by the host libc. | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE-Specific] | ||
| 12 | Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 13 | |||
| 14 | Index: llvm-project-20.1.1.src/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/CMakeLists.txt | ||
| 15 | =================================================================== | ||
| 16 | --- llvm-project-20.1.1.src.orig/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/CMakeLists.txt | ||
| 17 | +++ llvm-project-20.1.1.src/llvm/projects/SPIRV-LLVM-Translator/lib/SPIRV/CMakeLists.txt | ||
| 18 | @@ -42,6 +42,7 @@ set(SRC_LIST | ||
| 19 | ) | ||
| 20 | add_llvm_library(LLVMSPIRVLib | ||
| 21 | ${SRC_LIST} | ||
| 22 | + SHARED | ||
| 23 | LINK_COMPONENTS | ||
| 24 | Analysis | ||
| 25 | BitWriter | ||
diff --git a/meta/recipes-devtools/llvm/llvm_20.1.2.bb b/meta/recipes-devtools/llvm/llvm_20.1.2.bb deleted file mode 100644 index 98855fa4c1..0000000000 --- a/meta/recipes-devtools/llvm/llvm_20.1.2.bb +++ /dev/null | |||
| @@ -1,233 +0,0 @@ | |||
| 1 | # Copyright (C) 2017 Khem Raj <raj.khem@gmail.com> | ||
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
| 3 | |||
| 4 | SUMMARY = "The LLVM Compiler Infrastructure" | ||
| 5 | HOMEPAGE = "http://llvm.org" | ||
| 6 | LICENSE = "Apache-2.0-with-LLVM-exception" | ||
| 7 | SECTION = "devel" | ||
| 8 | |||
| 9 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" | ||
| 10 | |||
| 11 | DEPENDS = "libffi libxml2 zlib zstd libedit ninja-native llvm-native" | ||
| 12 | |||
| 13 | RDEPENDS:${PN}:append:class-target = " ncurses-terminfo" | ||
| 14 | |||
| 15 | inherit cmake pkgconfig | ||
| 16 | # could be 'rcX' or 'git' or empty ( for release ) | ||
| 17 | VER_SUFFIX = "" | ||
| 18 | |||
| 19 | PV .= "${VER_SUFFIX}" | ||
| 20 | |||
| 21 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" | ||
| 22 | MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" | ||
| 23 | |||
| 24 | LLVM_RELEASE = "${PV}" | ||
| 25 | |||
| 26 | SRCREV_spirv = "68edc9d3d10ff6ec6353803a1bc60a5c25e7b715" | ||
| 27 | # pattern: llvm_branch_200, currently there are no minor releases, so, no llvm_branch_201 | ||
| 28 | SPIRV_BRANCH = "llvm_release_${@oe.utils.trim_version('${PV}', 1).replace('.', '')}0" | ||
| 29 | |||
| 30 | SRC_URI_SPIRV = " \ | ||
| 31 | git://github.com/KhronosGroup/SPIRV-LLVM-Translator;protocol=https;name=spirv;branch=${SPIRV_BRANCH};destsuffix=llvm-project-${PV}.src/llvm/projects/SPIRV-LLVM-Translator \ | ||
| 32 | file://spirv-internal-build.patch \ | ||
| 33 | " | ||
| 34 | |||
| 35 | SRC_URI_SPIRV:append:class-native = " \ | ||
| 36 | file://spirv-shared-library.patch \ | ||
| 37 | " | ||
| 38 | |||
| 39 | SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ | ||
| 40 | file://0007-llvm-allow-env-override-of-exe-path.patch \ | ||
| 41 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ | ||
| 42 | file://0014-cmake-Fix-configure-for-packages-using-find_package.patch \ | ||
| 43 | ${@bb.utils.contains('PACKAGECONFIG', 'spirv-llvm-translator', '${SRC_URI_SPIRV}', '', d)} \ | ||
| 44 | file://llvm-config \ | ||
| 45 | " | ||
| 46 | SRC_URI[sha256sum] = "f0a4a240aabc9b056142d14d5478bb6d962aeac549cbd75b809f5499240a8b38" | ||
| 47 | UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project" | ||
| 48 | UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" | ||
| 49 | |||
| 50 | SRC_URI:append:class-native = " file://0001-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch" | ||
| 51 | |||
| 52 | S = "${WORKDIR}/llvm-project-${PV}.src" | ||
| 53 | |||
| 54 | OECMAKE_SOURCEPATH = "${S}/llvm" | ||
| 55 | |||
| 56 | LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install" | ||
| 57 | |||
| 58 | PACKAGECONFIG ??= "libllvm libclc spirv-llvm-translator" | ||
| 59 | # if optviewer OFF, force the modules to be not found or the ones on the host would be found | ||
| 60 | PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml" | ||
| 61 | PACKAGECONFIG[libllvm] = "" | ||
| 62 | PACKAGECONFIG[libclc] = "" | ||
| 63 | PACKAGECONFIG[spirv-llvm-translator] = "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_INCDIR}/.. ,,spirv-tools-native spirv-headers" | ||
| 64 | |||
| 65 | # | ||
| 66 | # Default to build all OE-Core supported target arches (user overridable). | ||
| 67 | # | ||
| 68 | LLVM_TARGETS ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch;NVPTX;SPIRV" | ||
| 69 | |||
| 70 | ARM_INSTRUCTION_SET:armv5 = "arm" | ||
| 71 | ARM_INSTRUCTION_SET:armv4t = "arm" | ||
| 72 | |||
| 73 | LLVM_PROJECTS_CLANG = "${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv-llvm-translator', 'clang', '', d)}" | ||
| 74 | LLVM_PROJECTS_CLC = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', ';libclc', '', d)}" | ||
| 75 | LLVM_PROJECTS = "${LLVM_PROJECTS_CLANG}${LLVM_PROJECTS_CLC}" | ||
| 76 | |||
| 77 | EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ | ||
| 78 | -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \ | ||
| 79 | -DLLVM_ENABLE_PIC=ON \ | ||
| 80 | -DLLVM_BINDINGS_LIST='' \ | ||
| 81 | -DLLVM_LINK_LLVM_DYLIB=ON \ | ||
| 82 | -DLLVM_ENABLE_FFI=ON \ | ||
| 83 | -DLLVM_ENABLE_RTTI=ON \ | ||
| 84 | -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \ | ||
| 85 | -DLLVM_OPTIMIZED_TABLEGEN=ON \ | ||
| 86 | -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS}' \ | ||
| 87 | -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \ | ||
| 88 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ | ||
| 89 | -DCMAKE_BUILD_TYPE=Release \ | ||
| 90 | -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \ | ||
| 91 | " | ||
| 92 | |||
| 93 | EXTRA_OECMAKE:append:class-target = "\ | ||
| 94 | -DCMAKE_CROSSCOMPILING:BOOL=ON \ | ||
| 95 | -DLLVM_HOST_TRIPLE=${TARGET_SYS} \ | ||
| 96 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ | ||
| 97 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ | ||
| 98 | -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ | ||
| 99 | " | ||
| 100 | |||
| 101 | EXTRA_OECMAKE:append:class-nativesdk = "\ | ||
| 102 | -DCMAKE_CROSSCOMPILING:BOOL=ON \ | ||
| 103 | -DLLVM_HOST_TRIPLE=${SDK_SYS} \ | ||
| 104 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ | ||
| 105 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ | ||
| 106 | -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ | ||
| 107 | " | ||
| 108 | |||
| 109 | # patch out build host paths for reproducibility | ||
| 110 | do_compile:prepend:class-target() { | ||
| 111 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | ||
| 112 | } | ||
| 113 | |||
| 114 | do_compile:prepend:class-nativesdk() { | ||
| 115 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | ||
| 116 | } | ||
| 117 | |||
| 118 | do_compile() { | ||
| 119 | if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then | ||
| 120 | ninja -v ${PARALLEL_MAKE} | ||
| 121 | else | ||
| 122 | ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen | ||
| 123 | fi | ||
| 124 | } | ||
| 125 | |||
| 126 | do_install() { | ||
| 127 | if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then | ||
| 128 | DESTDIR=${D} ninja -v install | ||
| 129 | |||
| 130 | # llvm harcodes usr/lib as install path, so this corrects it to actual libdir | ||
| 131 | mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true | ||
| 132 | |||
| 133 | # Remove opt-viewer: https://llvm.org/docs/Remarks.html | ||
| 134 | rm -rf ${D}${datadir}/opt-viewer | ||
| 135 | |||
| 136 | # reproducibility | ||
| 137 | sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake | ||
| 138 | fi | ||
| 139 | |||
| 140 | # Remove clang bits from target packages, we are not providing it for the system | ||
| 141 | if ${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv-llvm-translator', 'true', 'false', d)} && | ||
| 142 | [ "${CLASSOVERRIDE}" != "class-native" ] ; then | ||
| 143 | rm -f ${D}${bindir}/clang* | ||
| 144 | rm -fr ${D}${libdir}/clang | ||
| 145 | rm -fr ${D}${datadir}/clang | ||
| 146 | |||
| 147 | rm -f ${D}${bindir}/scan* | ||
| 148 | rm -fr ${D}${libdir}/libscanbuild | ||
| 149 | rm -fr ${D}${datadir}/scan-build | ||
| 150 | rm -fr ${D}${datadir}/scan-view | ||
| 151 | |||
| 152 | rm -fr ${D}${libdir}/libear | ||
| 153 | fi | ||
| 154 | |||
| 155 | # Try to clean up datadir if it is empty, but don't fail if there are | ||
| 156 | # libclc files there | ||
| 157 | rmdir ${D}${datadir} || true | ||
| 158 | } | ||
| 159 | |||
| 160 | do_install:append:class-native() { | ||
| 161 | install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV} | ||
| 162 | install -D -m 0755 ${B}/bin/llvm-min-tblgen ${D}${bindir}/llvm-min-tblgen | ||
| 163 | install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV} | ||
| 164 | ln -sf llvm-config${PV} ${D}${bindir}/llvm-config | ||
| 165 | |||
| 166 | if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} ; then | ||
| 167 | install -D -m 0755 ${B}/bin/prepare_builtins ${D}${bindir}/prepare_builtins | ||
| 168 | fi | ||
| 169 | } | ||
| 170 | |||
| 171 | SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess" | ||
| 172 | SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " llvm_sysroot_preprocess" | ||
| 173 | |||
| 174 | llvm_sysroot_preprocess() { | ||
| 175 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
| 176 | install -m 0755 ${UNPACKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
| 177 | ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} | ||
| 178 | } | ||
| 179 | |||
| 180 | PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto ${PN}-clc ${PN}-spirv" | ||
| 181 | PROVIDES = "${@bb.utils.filter('PACKAGECONFIG', 'libclc spirv-llvm-translator', d)}" | ||
| 182 | |||
| 183 | RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" | ||
| 184 | RPROVIDES:${PN}-clc = "${@bb.utils.filter('PACKAGECONFIG', 'libclc', d)}" | ||
| 185 | RPROVIDES:${PN}-spirv = "${@bb.utils.filter('PACKAGECONFIG', 'spirv-llvm-translator', d)}" | ||
| 186 | |||
| 187 | FILES:${PN}-bugpointpasses = "\ | ||
| 188 | ${libdir}/BugpointPasses.so \ | ||
| 189 | " | ||
| 190 | |||
| 191 | FILES:${PN}-libllvm = "\ | ||
| 192 | ${libdir}/libLLVM-${MAJOR_VERSION}.so \ | ||
| 193 | ${libdir}/libLLVM.so.${MAJ_MIN_VERSION} \ | ||
| 194 | " | ||
| 195 | |||
| 196 | FILES:${PN}-liblto += "\ | ||
| 197 | ${libdir}/libLTO.so.* \ | ||
| 198 | " | ||
| 199 | |||
| 200 | FILES:${PN}-liboptremarks += "\ | ||
| 201 | ${libdir}/libRemarks.so.* \ | ||
| 202 | " | ||
| 203 | |||
| 204 | FILES:${PN}-llvmhello = "\ | ||
| 205 | ${libdir}/LLVMHello.so \ | ||
| 206 | " | ||
| 207 | |||
| 208 | FILES:${PN}-dev += " \ | ||
| 209 | ${libdir}/llvm-config \ | ||
| 210 | ${libdir}/libRemarks.so \ | ||
| 211 | ${libdir}/libLLVM-${PV}.so \ | ||
| 212 | " | ||
| 213 | |||
| 214 | FILES:${PN}-staticdev += "\ | ||
| 215 | ${libdir}/*.a \ | ||
| 216 | " | ||
| 217 | |||
| 218 | FILES:${PN}-clc += "${datadir}/clc" | ||
| 219 | |||
| 220 | FILES:${PN}-spirv = " \ | ||
| 221 | ${bindir}/llvm-spirv \ | ||
| 222 | ${includedir}/LLVMSPIRVLib \ | ||
| 223 | ${libdir}/pkgconfig/LLVMSPIRVLib.pc \ | ||
| 224 | ${libdir}/libLLVMSPIRV* \ | ||
| 225 | " | ||
| 226 | |||
| 227 | INSANE_SKIP:${PN}-libllvm += "dev-so" | ||
| 228 | |||
| 229 | # SPIRV-LLVM-Translator provides only static libraries, they are included into | ||
| 230 | # the llvm-spirv package. | ||
| 231 | INSANE_SKIP:${PN}-spirv += "staticdev" | ||
| 232 | |||
| 233 | BBCLASSEXTEND = "native nativesdk" | ||
