Subject: [bug#56452] [PATCH 1/5] gnu: llvm-8: Fix build with gcc-10.

From: Greg Hogan <[email-masked]>
Date: Fri, 8 Jul 2022 15:58:48 +0000

* gnu/packages/patches/llvm-8-fix-build-with-gcc-10.patch: New file.
* gnu/packages/llvm.scm (clang-8, clang-runtime-8): Update to 8.0.1.
* gnu/packages/llvm.scm (llvm-8): Use patch and update to 8.0.1.
* gnu/local.mk: Register patch.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/llvm.scm                         |  9 ++---
 .../llvm-8-fix-build-with-gcc-10.patch        | 34 +++++++++++++++++++
 3 files changed, 40 insertions(+), 4 deletions(-)
 create mode 100644 gnu/packages/patches/llvm-8-fix-build-with-gcc-10.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 2516562ea4..0a5de26266 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1452,6 +1452,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/llhttp-bootstrap-CVE-2020-8287.patch	\
   %D%/packages/patches/llvm-3.5-fix-clang-build-with-gcc5.patch	\
   %D%/packages/patches/llvm-3.6-fix-build-with-gcc-10.patch	\
+  %D%/packages/patches/llvm-8-fix-build-with-gcc-10.patch	\
   %D%/packages/patches/llvm-9-fix-bitcast-miscompilation.patch	\
   %D%/packages/patches/llvm-9-fix-lpad-miscompilation.patch	\
   %D%/packages/patches/llvm-9-fix-scev-miscompilation.patch	\
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index ffa156af15..f8320c4112 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -912,24 +912,25 @@ (define-public clang-toolchain-9
 (define-public llvm-8
   (package
     (inherit llvm-9)
-    (version "8.0.0")
+    (version "8.0.1")
     (source (origin
               (method url-fetch)
               (uri (llvm-uri "llvm" version))
               (sha256
                (base32
-                "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8"))))
+                "1rvm5gqp5v8hfn17kqws3zhk94w4kxndal12bqa0y57p09nply24"))
+              (patches (search-patches "llvm-8-fix-build-with-gcc-10.patch"))))
     (license license:ncsa)))
 
 (define-public clang-runtime-8
   (clang-runtime-from-llvm
    llvm-8
-   "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"
+   "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi"
    '("clang-runtime-9-libsanitizer-mode-field.patch")))
 
 (define-public clang-8
   (clang-from-llvm llvm-8 clang-runtime-8
-                   "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08"
+                   "0ihnbdl058gvl2wdy45p5am55bq8ifx8m9mhcsgj9ax8yxlzvvvh"
                    #:patches '("clang-8.0-libc-search-path.patch")))
 
 (define-public clang-toolchain-8
diff --git a/gnu/packages/patches/llvm-8-fix-build-with-gcc-10.patch b/gnu/packages/patches/llvm-8-fix-build-with-gcc-10.patch
new file mode 100644
index 0000000000..9b36cc772c
--- /dev/null
+++ b/gnu/packages/patches/llvm-8-fix-build-with-gcc-10.patch
@@ -0,0 +1,34 @@
+From b288d90b39f4b905c02092a9bfcfd6d78f99b191 Mon Sep 17 00:00:00 2001
+From: Than McIntosh <[email-masked]>
+Date: Fri, 19 Jul 2019 13:13:54 +0000
+Subject: [PATCH] [NFC] include cstdint/string prior to using uint8_t/string
+
+Summary: include proper header prior to use of uint8_t typedef
+and std::string.
+
+Subscribers: llvm-commits
+
+Reviewers: cherry
+
+Tags: #llvm
+
+Differential Revision: https://reviews.llvm.org/D64937
+
+llvm-svn: 366572
+---
+ llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/llvm/Demangle/MicrosoftDemangleNodes.h b/include/llvm/Demangle/MicrosoftDemangleNodes.h
+index da9d9d5bfdc0c..3d47471f0ef0e 100644
+--- a/include/llvm/Demangle/MicrosoftDemangleNodes.h
++++ b/include/llvm/Demangle/MicrosoftDemangleNodes.h
+@@ -16,6 +16,8 @@
+ #include "llvm/Demangle/DemangleConfig.h"
+ #include "llvm/Demangle/StringView.h"
+ #include <array>
++#include <cstdint>
++#include <string>
+ 
+ namespace llvm {
+ namespace itanium_demangle {
-- 
2.36.1