[V2] mesa, llvm, meson: Update llvm to 8.0.1 plus define and use LLVM version globally

Message ID 20190803183536.38590-1-raj.khem@gmail.com
State Accepted
Commit 3c08b638348abd543fc92baf56c28ca16ae6aac6
Headers show
Series
  • [V2] mesa, llvm, meson: Update llvm to 8.0.1 plus define and use LLVM version globally
Related show

Commit Message

Khem Raj Aug. 3, 2019, 6:35 p.m.
- 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

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
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.patch

-- 
2.22.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Alexander Kanavin Aug. 3, 2019, 6:54 p.m. | #1
On Sat, 3 Aug 2019 at 20:36, Khem Raj <raj.khem@gmail.com> wrote:

> diff --git a/meta/recipes-devtools/llvm/llvm_git.bb

> b/meta/recipes-devtools/llvm/llvm_git.bb

> index 0067635c2b..35ad3ced37 100644

> --- a/meta/recipes-devtools/llvm/llvm_git.bb

> +++ b/meta/recipes-devtools/llvm/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"

>


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
<div dir="ltr"><div dir="ltr">On Sat, 3 Aug 2019 at 20:36, Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt; wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">diff --git a/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb" rel="noreferrer" target="_blank">llvm_git.bb</a> b/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb" rel="noreferrer" target="_blank">llvm_git.bb</a><br>
index 0067635c2b..35ad3ced37 100644<br>
--- a/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb" rel="noreferrer" target="_blank">llvm_git.bb</a><br>
+++ b/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb" rel="noreferrer" target="_blank">llvm_git.bb</a><br> 
BRANCH = &quot;release/${MAJOR_VERSION}.x&quot;<br>
 MAJOR_VERSION = &quot;8&quot;<br>
 MINOR_VERSION = &quot;0&quot;<br>
-PATCH_VERSION = &quot;0&quot;<br>
+PATCH_VERSION = &quot;1&quot;<br>
 SOLIBVER = &quot;1&quot;<br>
 PV = &quot;${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}&quot;<br>
 SRC_URI = &quot;git://<a href="http://github.com/llvm/llvm-project.git;branch=$%7BBRANCH%7D" rel="noreferrer" target="_blank">github.com/llvm/llvm-project.git;branch=${BRANCH}</a> \<br> 
&quot;-Dgallium-xa=true, -Dgallium-xa=false&quot;<br>
</blockquote><div><br></div><div>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.</div><div><br></div><div>Alex<br></div></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Aug. 3, 2019, 7:42 p.m. | #2
On 8/3/19 11:54 AM, Alexander Kanavin wrote:
> On Sat, 3 Aug 2019 at 20:36, Khem Raj <raj.khem@gmail.com 

> <mailto:raj.khem@gmail.com>> 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"

>

>

> 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.


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.


>

> Alex
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 8/3/19 11:54 AM, Alexander Kanavin
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANNYZj_Qp_c9ncMaAXKHaAjWHnqn3OG4YkNvvKHebh3viU5i=w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">On Sat, 3 Aug 2019 at 20:36, Khem Raj &lt;<a
            href="mailto:raj.khem@gmail.com" moz-do-not-send="true">raj.khem@gmail.com</a>&gt;
          wrote:<br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">diff --git
            a/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb"
              rel="noreferrer" target="_blank" moz-do-not-send="true">llvm_git.bb</a>
            b/meta/recipes-devtools/llvm/<a href="http://llvm_git.bb"
              rel="noreferrer" target="_blank" moz-do-not-send="true">llvm_git.bb</a><br>
            index 0067635c2b..35ad3ced37 100644<br>
            --- a/meta/recipes-devtools/llvm/<a
              href="http://llvm_git.bb" rel="noreferrer" target="_blank"
              moz-do-not-send="true">llvm_git.bb</a><br>
            +++ b/meta/recipes-devtools/llvm/<a
              href="http://llvm_git.bb" rel="noreferrer" target="_blank"
              moz-do-not-send="true">llvm_git.bb</a><br>
             
            BRANCH = "release/${MAJOR_VERSION}.x"<br>
             MAJOR_VERSION = "8"<br>
             MINOR_VERSION = "0"<br>
            -PATCH_VERSION = "0"<br>
            +PATCH_VERSION = "1"<br>
             SOLIBVER = "1"<br>
             PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"<br>
             SRC_URI = "git://<a
              href="http://github.com/llvm/llvm-project.git;branch=$%7BBRANCH%7D"
              rel="noreferrer" target="_blank" moz-do-not-send="true">github.com/llvm/llvm-project.git;branch=${BRANCH}</a>
            \<br>
             
            "-Dgallium-xa=true, -Dgallium-xa=false"<br>
          </blockquote>
          <div><br>
          </div>
          <div>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.</div>
        </div>
      </div>
    </blockquote>
    <p>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.<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CANNYZj_Qp_c9ncMaAXKHaAjWHnqn3OG4YkNvvKHebh3viU5i=w@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
          <div>Alex<br>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index dafdd18bf4..48ca112d80 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -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
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 69f6344c04..1966dbd521 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -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}"
diff --git a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
deleted file mode 100644
index 1369bcf78c..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
+++ /dev/null
@@ -1,114 +0,0 @@ 
-From 0570fe02c07244a8724c1e6c0437f893c8aa8e93 Mon Sep 17 00:00:00 2001
-From: Martin Kelly <mkelly@xevo.com>
-Date: Fri, 19 May 2017 00:22:57 -0700
-Subject: [PATCH 2/2] 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.
-
-To let it work in multilib environment, we need to provide a knob to supply
-multilib dirname as well
-
-Upstream-Status: Inappropriate [OE-Specific]
-
-Signed-off-by: Martin Kelly <mkelly@xevo.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- tools/llvm-config/llvm-config.cpp | 35 ++++++++++++++++++++++---------
- 1 file changed, 25 insertions(+), 10 deletions(-)
-
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index bec89fef98c..91b4d6e4c43 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -226,6 +226,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;
-@@ -284,7 +291,7 @@ int main(int argc, char **argv) {
-   // bin dir).
-   sys::fs::make_absolute(CurrentPath);
-   CurrentExecPrefix =
--      sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
-+      sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str();
- 
-   // Check to see if we are inside a development tree by comparing to possible
-   // locations (prefix style or CMake style).
-@@ -293,7 +300,7 @@ int main(int argc, char **argv) {
-     DevelopmentTreeLayout = CMakeStyle;
-     ActiveObjRoot = LLVM_OBJ_ROOT;
-   } else if (sys::fs::equivalent(CurrentExecPrefix,
--                                 Twine(LLVM_OBJ_ROOT) + "/bin")) {
-+                                 Twine(LLVM_OBJ_ROOT) + "/bin/llvm8.0.0")) {
-     IsInDevelopmentTree = true;
-     DevelopmentTreeLayout = CMakeBuildModeStyle;
-     ActiveObjRoot = LLVM_OBJ_ROOT;
-@@ -307,37 +314,45 @@ int main(int argc, char **argv) {
-   std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
-               ActiveCMakeDir;
-   std::string ActiveIncludeOption;
-+  // Hack for Yocto: we need to override the multilib path when we are using
-+  // llvm-config from within a target sysroot.
-+  std::string Multilibdir = std::getenv("YOCTO_ALTERNATE_MULTILIB_NAME");
-+  if (Multilibdir.empty()) {
-+    Multilibdir = "/lib/llvm8.0.0" LLVM_LIBDIR_SUFFIX;
-+  }
-+
-   if (IsInDevelopmentTree) {
--    ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
-+    ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include/llvm8.0.0";
-     ActivePrefix = CurrentExecPrefix;
- 
-     // CMake organizes the products differently than a normal prefix style
-     // layout.
-+
-     switch (DevelopmentTreeLayout) {
-     case CMakeStyle:
--      ActiveBinDir = ActiveObjRoot + "/bin";
--      ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
-+      ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0.0";
-+      ActiveLibDir = ActiveObjRoot + "/lib/llvm8.0.0" + LLVM_LIBDIR_SUFFIX;
-       ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-       break;
-     case CMakeBuildModeStyle:
-       ActivePrefix = ActiveObjRoot;
--      ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
-+      ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0.0/" + build_mode;
-       ActiveLibDir =
--          ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
-+          ActiveObjRoot + "/lib/llvm8.0.0" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
-       ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-       break;
-     }
- 
-     // We need to include files from both the source and object trees.
-     ActiveIncludeOption =
--        ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
-+        ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include/llvm8.0.0");
-   } else {
-     ActivePrefix = CurrentExecPrefix;
--    ActiveIncludeDir = ActivePrefix + "/include";
-+    ActiveIncludeDir = ActivePrefix + "/include/llvm8.0.0";
-     SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
-     sys::fs::make_absolute(ActivePrefix, path);
-     ActiveBinDir = path.str();
--    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
-+    ActiveLibDir = ActivePrefix + Multilibdir;
-     ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
--- 
-2.20.1
-
diff --git a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
similarity index 71%
rename from meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
rename to meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index 6dbbced7eb..789c308863 100644
--- a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -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 <raj.khem@gmail.com>
 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 <raj.khem@gmail.com>
 ---
- 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
 
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
new file mode 100644
index 0000000000..f47080c9fd
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
@@ -0,0 +1,38 @@ 
+From b66d6f39a374b8df41e7235351e5dee2e81f440c Mon Sep 17 00:00:00 2001
+From: Martin Kelly <mkelly@xevo.com>
+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 <mkelly@xevo.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index 0067635c2b..35ad3ced37 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -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"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 5bbd13bca2..e99eb39d26 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -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] = ""