mesa, llvm, meson: Update llvm to 8.0.1 plus define and use LLVM version globally
PATCH v2 1/1 mesa, llvm, meson: Update llvm to 8.0.1 plus define and use LLVM version globally
- Add missing dependency on libedit
- Define LLVMVERSION on the same lines as GCCVERSION and other tools
- Use LLVMVERSION in mesa and meson.bbclass to get llvm version instead of hardcoding it
- Use llvm patches unmodified from meta-clang, helps in keeping them in sync
- Define PREFERRED_VERSION for llvm, llvm-native, nativesdk-llvm
---
v2:
- Fix build failure due to meson hardcoding llvm version
- Refresh and sync patches with meta-clang
- Define LLVMVERSION
meta/classes/meson.bbclass | 2 +-
meta/conf/distro/include/tcmode-default.inc | 7 ++
...-llvm-allow-env-override-of-exe-path.patch | 114 ------------------
...yInfo-Undefine-libc-functions-if-th.patch} | 31 ++---
...-llvm-allow-env-override-of-exe-path.patch | 38 ++++++
meta/recipes-devtools/llvm/llvm_git.bb | 10 +-
meta/recipes-graphics/mesa/mesa.inc | 6 +-
7 files changed, 71 insertions(+), 137 deletions(-)
delete mode 100644 meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
rename meta/recipes-devtools/llvm/llvm/{0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch => 0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch} (71%)
create mode 100644 meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patchmeta/classes/meson.bbclass +1 -1
@@ -82,7 +82,7 @@ ld = ${@meson_array('LD', d)} strip = ${@meson_array('STRIP', d)} readelf = ${@meson_array('READELF', d)} pkgconfig = 'pkg-config' -llvm-config = 'llvm-config8.0.0' +llvm-config = 'llvm-config${LLVMVERSION}' [properties] needs_exe_wrapper = true
meta/conf/distro/include/tcmode-default.inc +7 -0
@@ -26,6 +26,9 @@ GLIBCVERSION ?= "2.30%" LINUXLIBCVERSION ?= "5.0%" QEMUVERSION ?= "4.0%" GOVERSION ?= "1.12%" +# This can not use wildcards like 8.0.% since it is also used in mesa to denote +# llvm version being used, so always bump it with llvm recipe version bump +LLVMVERSION ?= "8.0.1" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}"
@@ -76,3 +79,7 @@ PREFERRED_VERSION_go-native ?= "${GOVERSION}" PREFERRED_VERSION_go-runtime ?= "${GOVERSION}" PREFERRED_VERSION_nativesdk-go ?= "${GOVERSION}" PREFERRED_VERSION_nativesdk-go-runtime ?= "${GOVERSION}" + +PREFERRED_VERSION_llvm = "${LLVMVERSION}" +PREFERRED_VERSION_llvm-native = "${LLVMVERSION}" +PREFERRED_VERSION_nativesdk-llvm = "${LLVMVERSION}"
meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch deleted +0 -114
114 lines not on this page · raw message
meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch renamed from meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch +16 -15
@@ -1,7 +1,8 @@ -From 905cac8934fb17e20416a4df712a566e757471a3 Mon Sep 17 00:00:00 2001 +From 4c08879d2dfbe7face4e679ac8499dc7bff2dd20 Mon Sep 17 00:00:00 2001 From: Khem Raj <[email protected]> Date: Sat, 21 May 2016 00:33:20 +0000 -Subject: [PATCH 1/2] llvm: TargetLibraryInfo: Undefine libc functions if they are macros +Subject: [PATCH 06/19] llvm: TargetLibraryInfo: Undefine libc functions if + they are macros musl defines some functions as macros and not inline functions if this is the case then make sure to undefine them
@@ -9,14 +10,14 @@ if this is the case then make sure to undefine them Upstream-Status: Pending Signed-off-by: Khem Raj <[email protected]> --- - include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++ + .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) -diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def -index 518a85ee1a0..6b4ead4efc6 100644 ---- a/include/llvm/Analysis/TargetLibraryInfo.def -+++ b/include/llvm/Analysis/TargetLibraryInfo.def -@@ -731,6 +731,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") +diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def +index afed404f04c..876888656f2 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def +@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") TLI_DEFINE_ENUM_INTERNAL(fopen) TLI_DEFINE_STRING_INTERNAL("fopen") /// FILE *fopen64(const char *filename, const char *opentype)
@@ -26,7 +27,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_ENUM_INTERNAL(fopen64) TLI_DEFINE_STRING_INTERNAL("fopen64") /// int fork(); -@@ -778,6 +781,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") +@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") /// int fseeko(FILE *stream, off_t offset, int whence); TLI_DEFINE_ENUM_INTERNAL(fseeko) TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +37,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 /// int fseeko64(FILE *stream, off64_t offset, int whence) TLI_DEFINE_ENUM_INTERNAL(fseeko64) TLI_DEFINE_STRING_INTERNAL("fseeko64") -@@ -788,6 +794,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") +@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") TLI_DEFINE_ENUM_INTERNAL(fstat) TLI_DEFINE_STRING_INTERNAL("fstat") /// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +47,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_ENUM_INTERNAL(fstat64) TLI_DEFINE_STRING_INTERNAL("fstat64") /// int fstatvfs(int fildes, struct statvfs *buf); -@@ -803,6 +812,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") +@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") TLI_DEFINE_ENUM_INTERNAL(ftello) TLI_DEFINE_STRING_INTERNAL("ftello") /// off64_t ftello64(FILE *stream)
@@ -56,7 +57,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_ENUM_INTERNAL(ftello64) TLI_DEFINE_STRING_INTERNAL("ftello64") /// int ftrylockfile(FILE *file); -@@ -929,6 +941,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") +@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") TLI_DEFINE_ENUM_INTERNAL(lstat) TLI_DEFINE_STRING_INTERNAL("lstat") /// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +67,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_ENUM_INTERNAL(lstat64) TLI_DEFINE_STRING_INTERNAL("lstat64") /// void *malloc(size_t size); -@@ -1154,6 +1169,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") +@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") TLI_DEFINE_ENUM_INTERNAL(stat) TLI_DEFINE_STRING_INTERNAL("stat") /// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +77,7 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_ENUM_INTERNAL(stat64) TLI_DEFINE_STRING_INTERNAL("stat64") /// int statvfs(const char *path, struct statvfs *buf); -@@ -1283,6 +1301,9 @@ TLI_DEFINE_STRING_INTERNAL("times") +@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times") TLI_DEFINE_ENUM_INTERNAL(tmpfile) TLI_DEFINE_STRING_INTERNAL("tmpfile") /// FILE *tmpfile64(void)
@@ -87,5 +88,5 @@ index 518a85ee1a0..6b4ead4efc6 100644 TLI_DEFINE_STRING_INTERNAL("tmpfile64") /// int toascii(int c); -- -2.20.1 +2.22.0
meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch new file +38 -0
@@ -0,0 +1,38 @@ +From b66d6f39a374b8df41e7235351e5dee2e81f440c Mon Sep 17 00:00:00 2001 +From: Martin Kelly <[email protected]> +Date: Fri, 19 May 2017 00:22:57 -0700 +Subject: [PATCH 07/19] llvm: allow env override of exe path + +When using a native llvm-config from inside a sysroot, we need llvm-config to +return the libraries, include directories, etc. from inside the sysroot rather +than from the native sysroot. Thus provide an env override for calling +llvm-config from a target sysroot. + +Upstream-Status: Pending +Signed-off-by: Martin Kelly <[email protected]> +Signed-off-by: Khem Raj <[email protected]> +--- + llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 7ef7c46a262..a4f7ed82c7b 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -225,6 +225,13 @@ Typical components:\n\ + + /// Compute the path to the main executable. + std::string GetExecutablePath(const char *Argv0) { ++ // Hack for Yocto: we need to override the root path when we are using ++ // llvm-config from within a target sysroot. ++ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH"); ++ if (Sysroot != nullptr) { ++ return Sysroot; ++ } ++ + // This just needs to be some symbol in the binary; C++ doesn't + // allow taking the address of ::main however. + void *P = (void *)(intptr_t)GetExecutablePath; +-- +2.22.0 +
meta/recipes-devtools/llvm/llvm_git.bb +5 -5
@@ -8,7 +8,7 @@ SECTION = "devel" LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648" -DEPENDS = "libffi libxml2 zlib ninja-native llvm-native" +DEPENDS = "libffi libxml2 zlib libedit ninja-native llvm-native" RDEPENDS_${PN}_append_class-target = " ncurses-terminfo"
@@ -19,17 +19,17 @@ PROVIDES += "llvm${PV}" LLVM_RELEASE = "${PV}" LLVM_DIR = "llvm${LLVM_RELEASE}" -SRCREV = "d2298e74235598f15594fe2c99bbac870a507c59" +SRCREV = "19a71f6bdf2dddb10764939e7f0ec2b98dba76c9" BRANCH = "release/${MAJOR_VERSION}.x" MAJOR_VERSION = "8" MINOR_VERSION = "0" -PATCH_VERSION = "0" +PATCH_VERSION = "1" SOLIBVER = "1" PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH} \ - file://0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ - file://0002-llvm-allow-env-override-of-exe-path.patch \ + file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch;striplevel=2 \ + file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ " S = "${WORKDIR}/git/llvm"
meta/recipes-graphics/mesa/mesa.inc +4 -2
@@ -36,6 +36,10 @@ PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \ export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config" export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}" +export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}" +export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" + +MESA_LLVM_RELEASE ?= "${LLVMVERSION}" EXTRA_OEMESON = " \ -Dshared-glapi=true \
@@ -107,10 +111,8 @@ GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', GALLIUMDRIVERS_append = ",virgl" PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''" -MESA_LLVM_RELEASE ?= "8.0.0" PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \ ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" -export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false" PACKAGECONFIG[lima] = ""
Signature · 1 line
2.22.0
Quoted 13 lines · Khem Raj
meta/recipes-devtools/llvm/llvm_git.bb +1
-1BRANCH = "release/${MAJOR_VERSION}.x" MAJOR_VERSION = "8" MINOR_VERSION = "0" -PATCH_VERSION = "0" +PATCH_VERSION = "1" SOLIBVER = "1" PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH}
Quoted 3 lines
<http://github.com/llvm/llvm-project.git;branch=$%7BBRANCH%7D> \
"-Dgallium-xa=true, -Dgallium-xa=false"
Should this bit also use LLVMVERSION? It would be good to define the llvm version in a single place, otherwise we will continue to trip over partial mismatching updates. MAJOR_VERSION can be easily determined via inline python.
Alex
Quoted 21 lines · Alexander Kanavin
On Sat, 3 Aug 2019 at 20:36, Khem Raj <[email protected] <mailto:[email protected]>> wrote:
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb <http://llvm_git.bb> b/meta/recipes-devtools/llvm/llvm_git.bb <http://llvm_git.bb> index 0067635c2b..35ad3ced37 100644 --- a/meta/recipes-devtools/llvm/llvm_git.bb <http://llvm_git.bb> +++ b/meta/recipes-devtools/llvm/llvm_git.bb <http://llvm_git.bb> BRANCH = "release/${MAJOR_VERSION}.x" MAJOR_VERSION = "8" MINOR_VERSION = "0" -PATCH_VERSION = "0" +PATCH_VERSION = "1" SOLIBVER = "1" PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH} <http://github.com/llvm/llvm-project.git;branch=$%7BBRANCH%7D> \ "-Dgallium-xa=true, -Dgallium-xa=false"
Quoted 1 line
Should this bit also use LLVMVERSION? It would be good to define the llvm version in a single place, otherwise we will continue to trip over partial mismatching updates.
MAJOR_VERSIONcan be easily determined via inline python.
it will limit the option of having another llvm recipe which could be provided by other layers for different reasons. so we provide a fallback implementation if someone wants to override they can.
Quoted 2 lines
Alex