Subject: [bug#73413] [PATCH 2/3] gnu: cling: Update to 1.1.

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 22 Sep 2024 01:32:26 +0900

* gnu/packages/llvm.scm (llvm-cling-base): New variable
(llvm-cling): Use it.  Update to version 16-20240621-02.
[source]: Delete patches.
(clang-cling-runtime): Base on clang-runtime-16.
[phases]: Delete change-directory phase.
(clang-cling): Base on clang-16.
[phases]: Delete change-directory and delete-static-libraries phases (the
later would cause CMake to fail due to baking the static targets in).
(cling): Update to 1.1.
[source]: Delete patches.
[arguments] <#:tests?>: Reference upstream discussion in comment.
[phases] <patch-paths>: Adjust file name of clang lib directory.
<set-CLANG>: New phase.
[native-inputs]: Add clang-cling, used by the test suite.
* gnu/packages/patches/clang-cling-13-libc-search-path.patch
* gnu/packages/patches/clang-cling-13-remove-crypt-interceptors.patch
* gnu/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch
* gnu/packages/patches/cling-use-shared-library.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): De-register deleted files.

Change-Id: Ia8b58188ad9de2795a52289bd46ed15a8e722bfa
---

 gnu/local.mk                                  |   4 -
 gnu/packages/llvm.scm                         |  63 +++---
 .../clang-cling-13-libc-search-path.patch     |  96 --------
 ...g-cling-13-remove-crypt-interceptors.patch | 214 ------------------
 ...g-cling-runtime-13-glibc-2.36-compat.patch |  50 ----
 .../patches/cling-use-shared-library.patch    | 107 ---------
 6 files changed, 28 insertions(+), 506 deletions(-)
 delete mode 100644 gnu/packages/patches/clang-cling-13-libc-search-path.patch
 delete mode 100644 gnu/packages/patches/clang-cling-13-remove-crypt-interceptors.patch
 delete mode 100644 gnu/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch
 delete mode 100644 gnu/packages/patches/cling-use-shared-library.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a092122d22..0a21831a17 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1070,9 +1070,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/clang-17.0-libc-search-path.patch	\
   %D%/packages/patches/clang-17.0-link-dsymutil-latomic.patch	\
   %D%/packages/patches/clang-18.0-libc-search-path.patch	\
-  %D%/packages/patches/clang-cling-13-libc-search-path.patch	\
-  %D%/packages/patches/clang-cling-13-remove-crypt-interceptors.patch	\
-  %D%/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch	\
   %D%/packages/patches/clang-runtime-asan-build-fixes.patch	\
   %D%/packages/patches/clang-runtime-esan-build-fixes.patch	\
   %D%/packages/patches/clang-runtime-13-glibc-2.36-compat.patch	\
@@ -1086,7 +1083,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/clasp-hide-event-ids.patch		\
   %D%/packages/patches/classpath-aarch64-support.patch		\
   %D%/packages/patches/classpath-miscompilation.patch		\
-  %D%/packages/patches/cling-use-shared-library.patch		\
   %D%/packages/patches/clitest-grep-compat.patch		\
   %D%/packages/patches/clog-fix-shared-build.patch		\
   %D%/packages/patches/clucene-pkgconfig.patch			\
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 91fe9e7882..bdd805c59f 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -67,6 +67,7 @@ (define-module (gnu packages llvm)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages libffi)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm-meta)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages mpi)
@@ -86,6 +87,11 @@ (define-module (gnu packages llvm)
   #:export (make-lld-wrapper
             system->llvm-target))
 
+;; Lazily resolve the gcc-toolchain to avoid a circular dependency.
+(define gcc-toolchain*
+  (delay (module-ref (resolve-interface '(gnu packages commencement))
+                     'gcc-toolchain)))
+
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
                                                  gnu-triplet->nix-system)
@@ -2281,15 +2287,15 @@ (define-public llvm-julia
     (properties `((hidden? . #t)
                   ,@(package-properties llvm-13)))))
 
+(define llvm-cling-base llvm-16)
+
 (define llvm-cling
-  ;; To determine which version of LLVM a given release of Cling should use,
-  ;; consult the
-  ;; https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt
-  ;; file.
-  (let ((base llvm-15))                 ;for a DYLIB build
+  (let ((base llvm-cling-base))
     (package/inherit base
       (name "llvm-cling")
-      (version "13-20240318-01")
+      ;; Use the latest tag for the major LLVM version currently targeted by
+      ;; Cling (often mentioned in Cling's release notes).
+      (version "16-20240621-02")
       (source
        (origin
          (inherit (package-source base))
@@ -2300,14 +2306,10 @@ (define llvm-cling
          (file-name (git-file-name "llvm-cling" version))
          (sha256
           (base32
-           "1zh6yp8px9hla7v9i67a6anbph140f8ixxbsz65aj7fizksjs1h3"))
-         (patches (search-patches
-                   "clang-cling-13-libc-search-path.patch"
-                   "clang-cling-runtime-13-glibc-2.36-compat.patch"
-                   "clang-cling-13-remove-crypt-interceptors.patch")))))))
+           "05libb4mc385n8sq0bilalvidwzzrcyiqsfkn7j179kkx66a8rzy")))))))
 
 (define clang-cling-runtime
-  (let ((base clang-runtime-13))
+  (let ((base clang-runtime-16))
     (package/inherit base
       (name "clang-cling-runtime")
       (version (package-version llvm-cling))
@@ -2316,9 +2318,6 @@ (define clang-cling-runtime
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases '%standard-phases)
           #~(modify-phases #$phases
-              (add-after 'unpack 'change-directory
-                (lambda _
-                  (chdir "compiler-rt")))
               (add-after 'install 'delete-static-libraries
                 ;; This reduces the size from 22 MiB to 4 MiB.
                 (lambda _
@@ -2327,22 +2326,11 @@ (define clang-cling-runtime
                 (replace "llvm" llvm-cling))))))
 
 (define clang-cling
-  (let ((base clang-13))
+  (let ((base clang-16))
     (package/inherit base
       (name "clang-cling")
       (version (package-version llvm-cling))
       (source (package-source llvm-cling))
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:phases phases '%standard-phases)
-          #~(modify-phases #$phases
-              (add-after 'unpack 'change-directory
-                (lambda _
-                  (chdir "clang")))
-              (add-after 'install 'delete-static-libraries
-                ;; This reduces the size by half, from 220 MiB to 112 MiB.
-                (lambda _
-                  (for-each delete-file (find-files #$output "\\.a$"))))))))
       (propagated-inputs
        (modify-inputs (package-propagated-inputs base)
          (replace "llvm" llvm-cling)
@@ -2351,7 +2339,7 @@ (define clang-cling
 (define-public cling
   (package
     (name "cling")
-    (version "1.0")
+    (version "1.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -2360,15 +2348,14 @@ (define-public cling
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "17n66wf5yg1xjc94d6yb8g2gydjz0b8cj4a2pn6xrygdvhh09vv1"))
-              ;; Patch submitted upstream here:
-              ;; https://github.com/root-project/cling/pull/433.
-              (patches (search-patches "cling-use-shared-library.patch"))))
+                "13ghbqjppvbmkhjgfk9xggxh17xpmx18ghdqgkkg9a3mh19hf69h"))))
     (build-system cmake-build-system)
     (arguments
      (list
       #:build-type "Release"            ;keep the build as lean as possible
-      #:tests? #f                       ;FIXME: 78 tests fail (out of ~200)
+      ;; FIXME: 79 tests fail, out of ~200 (see:
+      ;; https://github.com/root-project/cling/issues/534)
+      #:tests? #f
       #:test-target "check-cling"
       #:configure-flags
       #~(list (string-append "-DCLING_CXX_PATH="
@@ -2405,7 +2392,7 @@ (define-public cling
                                 #$(first
                                    (take (string-split
                                           (package-version clang-cling) #\-)
-                                         1)) ".0.0" ;e.g. 13.0.0
+                                         1)) ;e.g. 16.0.6 -> 16
                                 "\");")))
               ;; Check for the 'lit' command for the tests, not 'lit.py'
               ;; (see: https://github.com/root-project/cling/issues/432).
@@ -2418,6 +2405,12 @@ (define-public cling
               (substitute* "test/lit.cfg"
                 (("config.llvm_tools_dir \\+ '")
                  "config.cling_obj_root + '/bin"))))
+          (add-before 'check 'set-CLANG
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              ;; Otherwise, lit fails with "fatal: couldn't find 'clang'
+              ;; program, try setting CLANG in your environment".
+              (setenv "CLANG" (search-input-file (or native-inputs inputs)
+                                                 "bin/clang"))))
           (add-after 'install 'delete-static-libraries
             ;; This reduces the size from 17 MiB to 5.4 MiB.
             (lambda _
@@ -2441,7 +2434,7 @@ (define-public cling
               (substitute* (string-append #$output "/bin/cling")
                 (("\"\\$0\"")
                  "\"${0##*/}\"")))))))
-    (native-inputs (list python python-lit))
+    (native-inputs (list clang-cling python python-lit))
     (inputs (list clang-cling (force gcc-toolchain*) llvm-cling libxcrypt))
     (home-page "https://root.cern/cling/")
     (synopsis "Interactive C++ interpreter")
diff --git a/gnu/packages/patches/clang-cling-13-libc-search-path.patch b/gnu/packages/patches/clang-cling-13-libc-search-path.patch
deleted file mode 100644
index c7d22eaaa3..0000000000
--- a/gnu/packages/patches/clang-cling-13-libc-search-path.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-Clang attempts to guess file names based on the OS and distro (yes!),
-but unfortunately, that doesn't work for us.
-
-This patch makes it easy to insert libc's $libdir so that Clang passes the
-correct absolute file name of crt1.o etc. to 'ld'.  It also disables all
-the distro-specific stuff and removes the hard-coded FHS directory names
-to make sure Clang also works on foreign distros.
-
-diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
-index ee4fe841..f0313bbe 100644
---- a/clang/lib/Driver/Distro.cpp
-+++ b/clang/lib/Driver/Distro.cpp
-@@ -93,6 +93,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
- }
- 
- static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
-+  // The compiler should always behave the same, even when used via Guix on a
-+  // foreign distro.
-+  return Distro::UnknownDistro;
-+
-   Distro::DistroType Version = Distro::UnknownDistro;
- 
-   // Newer freedesktop.org's compilant systemd-based systems
-diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
-index d14776c5..88bc3ccd 100644
---- a/clang/lib/Driver/ToolChains/Cuda.cpp
-+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
-@@ -119,6 +119,9 @@ CudaInstallationDetector::CudaInstallationDetector(
-     const Driver &D, const llvm::Triple &HostTriple,
-     const llvm::opt::ArgList &Args)
-     : D(D) {
-+  // Don't look for CUDA in /usr.
-+  return;
-+
-   struct Candidate {
-     std::string Path;
-     bool StrictChecking;
-diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
---- a/clang/lib/Driver/ToolChains/Linux.cpp
-+++ b/clang/lib/Driver/ToolChains/Linux.cpp
-@@ -186,6 +186,10 @@
- 
-   Generic_GCC::PushPPaths(PPaths);
- 
-+  // Comment out the distro-specific tweaks so that they don't bite when
-+  // using Guix on a foreign distro.
-+#if 0
-+
-   Distro Distro(D.getVFS(), Triple);
- 
-   if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
-@@ -251,6 +255,7 @@
- 
-   if (IsAndroid || Distro.IsOpenSUSE())
-     ExtraOpts.push_back("--enable-new-dtags");
-+#endif
- 
-   // The selection of paths to try here is designed to match the patterns which
-   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
-@@ -264,6 +269,7 @@
- 
-   Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
- 
-+#if 0
-   addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
-   addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
- 
-@@ -295,9 +301,11 @@
-     addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
-     addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
-   }
-+#endif
- 
-   Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
- 
-+#if 0
-   // Similar to the logic for GCC above, if we are currently running Clang
-   // inside of the requested system root, add its parent library path to those
-   // searched.
-@@ -305,9 +313,14 @@
-   // directory ('Dir' below) or the ResourceDir.
-   if (StringRef(D.Dir).startswith(SysRoot))
-     addPathIfExists(D, D.Dir + "/../lib", Paths);
-+#endif
-+
-+  // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
-+  // and friends can be found.
-+  addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
- 
--  addPathIfExists(D, SysRoot + "/lib", Paths);
--  addPathIfExists(D, SysRoot + "/usr/lib", Paths);
-+  // Add GCC's lib/ directory so libstdc++.so can be found.
-+  addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
- }
- 
- ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
diff --git a/gnu/packages/patches/clang-cling-13-remove-crypt-interceptors.patch b/gnu/packages/patches/clang-cling-13-remove-crypt-interceptors.patch
deleted file mode 100644
index 23de47bb18..0000000000
--- a/gnu/packages/patches/clang-cling-13-remove-crypt-interceptors.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From d7bead833631486e337e541e692d9b4a1ca14edd Mon Sep 17 00:00:00 2001
-From: Fangrui Song <[email-masked]>
-Date: Fri, 28 Apr 2023 09:59:17 -0700
-Subject: [PATCH] [sanitizer] Remove crypt and crypt_r interceptors
-
-From Florian Weimer's D144073
-
-> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation.
->
-> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets.
-
-Let's remove crypt and crypt_r interceptors (D68431) to fix issues with
-newer glibc.
-
-For older glibc, msan will not know that an uninstrumented crypt_r call
-initializes `data`, so there is a risk for false positives. However, with some
-codebase survey, I think crypt_r uses are very few and the call sites typically
-have a `memset(&data, 0, sizeof(data));` anyway.
-
-Fix https://github.com/google/sanitizers/issues/1365
-Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432
-
-Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka
-
-Differential Revision: https://reviews.llvm.org/D149403
----
- .../sanitizer_common_interceptors.inc         | 37 -------------------
- .../sanitizer_platform_interceptors.h         |  2 -
- .../sanitizer_platform_limits_posix.cpp       |  8 ----
- .../sanitizer_platform_limits_posix.h         |  1 -
- .../TestCases/Linux/crypt_r.cpp               | 36 ------------------
- .../TestCases/Posix/crypt.cpp                 | 32 ----------------
- 6 files changed, 116 deletions(-)
- delete mode 100644 compiler-rt/test/sanitizer_common/TestCases/Linux/crypt_r.cpp
- delete mode 100644 compiler-rt/test/sanitizer_common/TestCases/Posix/crypt.cpp
-
-diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
-index b30c91f06cfeb0..490a8b12d8b17d 100644
---- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
-@@ -10086,41 +10086,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) {
- #define INIT_GETRANDOM
- #endif
- 
--#if SANITIZER_INTERCEPT_CRYPT
--INTERCEPTOR(char *, crypt, char *key, char *salt) {
--  void *ctx;
--  COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt);
--  COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
--  COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
--  char *res = REAL(crypt)(key, salt);
--  if (res != nullptr)
--    COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
--  return res;
--}
--#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt);
--#else
--#define INIT_CRYPT
--#endif
--
--#if SANITIZER_INTERCEPT_CRYPT_R
--INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) {
--  void *ctx;
--  COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data);
--  COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
--  COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
--  char *res = REAL(crypt_r)(key, salt, data);
--  if (res != nullptr) {
--    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data,
--                                   __sanitizer::struct_crypt_data_sz);
--    COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
--  }
--  return res;
--}
--#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r);
--#else
--#define INIT_CRYPT_R
--#endif
--
- #if SANITIZER_INTERCEPT_GETENTROPY
- INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) {
-   void *ctx;
-@@ -10698,8 +10663,6 @@ static void InitializeCommonInterceptors() {
-   INIT_GETUSERSHELL;
-   INIT_SL_INIT;
-   INIT_GETRANDOM;
--  INIT_CRYPT;
--  INIT_CRYPT_R;
-   INIT_GETENTROPY;
-   INIT_QSORT;
-   INIT_QSORT_R;
-diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
-index eb39fabfd59839..c82ab5c2105621 100644
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -569,8 +569,6 @@
- #define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD
- #define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID)
- #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
--#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID)
--#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID)
- 
- #define SANITIZER_INTERCEPT_GETRANDOM \
-   ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
-diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-index a04eed7aa5a6e..6d61d276d77e3 100644
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -142,5 +142,4 @@
- #include <linux/serial.h>
- #include <sys/msg.h>
- #include <sys/ipc.h>
--#include <crypt.h>
- #endif  // SANITIZER_ANDROID
-@@ -243,7 +244,6 @@
-   unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
-   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
-   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
--  unsigned struct_crypt_data_sz = sizeof(struct crypt_data);
- #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
- 
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
-index e6f298c26e1fb6..58244c9944a03a 100644
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
-@@ -309,7 +309,6 @@ extern unsigned struct_msqid_ds_sz;
- extern unsigned struct_mq_attr_sz;
- extern unsigned struct_timex_sz;
- extern unsigned struct_statvfs_sz;
--extern unsigned struct_crypt_data_sz;
- #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
- 
- struct __sanitizer_iovec {
-diff --git a/test/sanitizer_common/TestCases/Linux/crypt_r.cpp b/test/sanitizer_common/TestCases/Linux/crypt_r.cpp
-deleted file mode 100644
-index 69bfb46aa5f171..00000000000000
---- a/compiler-rt/test/sanitizer_common/TestCases/Linux/crypt_r.cpp
-+++ /dev/null
-@@ -1,36 +0,0 @@
--// RUN: %clangxx -O0 -g %s -lcrypt -o %t && %run %t
--
--// crypt.h is missing from Android.
--// UNSUPPORTED: android
--
--#include <assert.h>
--#include <unistd.h>
--#include <cstring>
--#include <crypt.h>
--
--int main(int argc, char **argv) {
--  {
--    crypt_data cd;
--    cd.initialized = 0;
--    char *p = crypt_r("abcdef", "xz", &cd);
--    volatile size_t z = strlen(p);
--  }
--  {
--    crypt_data cd;
--    cd.initialized = 0;
--    char *p = crypt_r("abcdef", "$1$", &cd);
--    volatile size_t z = strlen(p);
--  }
--  {
--    crypt_data cd;
--    cd.initialized = 0;
--    char *p = crypt_r("abcdef", "$5$", &cd);
--    volatile size_t z = strlen(p);
--  }
--  {
--    crypt_data cd;
--    cd.initialized = 0;
--    char *p = crypt_r("abcdef", "$6$", &cd);
--    volatile size_t z = strlen(p);
--  }
--}
-diff --git a/test/sanitizer_common/TestCases/Posix/crypt.cpp b/test/sanitizer_common/TestCases/Posix/crypt.cpp
-deleted file mode 100644
-index 3a8faaa1ae7682..00000000000000
---- a/compiler-rt/test/sanitizer_common/TestCases/Posix/crypt.cpp
-+++ /dev/null
-@@ -1,32 +0,0 @@
--// RUN: %clangxx -O0 -g %s -o %t -lcrypt && %run %t
--
--// crypt() is missing from Android and -lcrypt from darwin.
--// UNSUPPORTED: android, darwin
--
--#include <assert.h>
--#include <unistd.h>
--#include <cstring>
--#if __has_include(<crypt.h>)
--#include <crypt.h>
--#endif
--
--int
--main (int argc, char** argv)
--{
--  {
--    char *p = crypt("abcdef", "xz");
--    volatile size_t z = strlen(p);
--  }
--  {
--    char *p = crypt("abcdef", "$1$");
--    volatile size_t z = strlen(p);
--  }
--  {
--    char *p = crypt("abcdef", "$5$");
--    volatile size_t z = strlen(p);
--  }
--  {
--    char *p = crypt("abcdef", "$6$");
--    volatile size_t z = strlen(p);
--  }
--}
diff --git a/gnu/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch b/gnu/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch
deleted file mode 100644
index 79b36f1383..0000000000
--- a/gnu/packages/patches/clang-cling-runtime-13-glibc-2.36-compat.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-This commit is from upstream and is included in the llvm-15 release
-
-commit b379129c4beb3f26223288627a1291739f33af02
-Author: Fangrui Song <[email-masked]>
-Date:   Mon Jul 11 11:38:28 2022 -0700
-
-    [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
-    
-    It is generally not a good idea to mix usage of glibc headers and Linux UAPI
-    headers (https://sourceware.org/glibc/wiki/Synchronizing_Headers). In glibc
-    since 7eae6a91e9b1670330c9f15730082c91c0b1d570 (milestone: 2.36), sys/mount.h
-    defines `fsconfig_command` which conflicts with linux/mount.h:
-    
-        .../usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
-    
-    Remove #include <linux/fs.h> which pulls in linux/mount.h. Expand its 4 macros manually.
-    
-    Fix https://github.com/llvm/llvm-project/issues/56421
-    
-    Reviewed By: #sanitizers, vitalybuka, zatrazz
-    
-    Differential Revision: https://reviews.llvm.org/D129471
-
-diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-index 4bd425435d56..81740bf4ab39 100644
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -73,7 +73,6 @@
- #include <sys/vt.h>
- #include <linux/cdrom.h>
- #include <linux/fd.h>
--#include <linux/fs.h>
- #include <linux/hdreg.h>
- #include <linux/input.h>
- #include <linux/ioctl.h>
-@@ -876,10 +875,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
-   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
- #endif
--  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
--  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
--  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
--  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
-+  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
-+  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
-+  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
-+  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
-   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
-   unsigned IOCTL_GIO_FONT = GIO_FONT;
-   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
diff --git a/gnu/packages/patches/cling-use-shared-library.patch b/gnu/packages/patches/cling-use-shared-library.patch
deleted file mode 100644
index 415f542add..0000000000
--- a/gnu/packages/patches/cling-use-shared-library.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Upstream status: https://github.com/root-project/root/pull/15563
-
-diff --git a/interpreter/cling/CMakeLists.txt b/interpreter/cling/CMakeLists.txt
-index 9775b07f10..7028042096 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -13,81 +13,22 @@ endif(WIN32)
- if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-   project(Cling)
- 
--  # Rely on llvm-config.
--  set(CONFIG_OUTPUT)
--  find_program(LLVM_CONFIG "llvm-config")
--  if(LLVM_CONFIG)
--    message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
--    set(CONFIG_COMMAND ${LLVM_CONFIG}
--      "--assertion-mode"
--      "--bindir"
--      "--libdir"
--      "--includedir"
--      "--prefix")
--    execute_process(
--      COMMAND ${CONFIG_COMMAND}
--      RESULT_VARIABLE HAD_ERROR
--      OUTPUT_VARIABLE CONFIG_OUTPUT
--    )
--    if(NOT HAD_ERROR)
--      string(REGEX REPLACE
--        "[ \t]*[\r\n]+[ \t]*" ";"
--        CONFIG_OUTPUT ${CONFIG_OUTPUT})
--    else()
--      string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
--      message(STATUS "${CONFIG_COMMAND_STR}")
--      message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
--    endif()
--  else()
--    message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
--  endif()
-+  # See <https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project>.
-+  find_package(LLVM REQUIRED CONFIG)
-+  message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
-+  message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
- 
--  list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
--  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
--  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
--  list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
--  list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
--
--  if(NOT MSVC_IDE)
--    set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
--      CACHE BOOL "Enable assertions")
--    # Assertions should follow llvm-config's.
--    mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
--  endif()
-+  separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
-+  add_definitions(${LLVM_DEFINITIONS_LIST})
- 
--  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
--  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
--  set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
--  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
-+  find_package(Clang REQUIRED CONFIG)
-+  message(STATUS "Found supported version: Clang ${CLANG_PACKAGE_VERSION}")
-+  message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
- 
-   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
-     NO_DEFAULT_PATH)
- 
--  set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
--  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
--  if(EXISTS ${LLVMCONFIG_FILE})
--    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
--    include(${LLVMCONFIG_FILE})
--  else()
--    message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
--  endif()
--
--  # They are used as destination of target generators.
--  set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
--  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
--  if(WIN32 OR CYGWIN)
--    # DLL platform -- put DLLs into bin.
--    set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
--  else()
--    set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
--  endif()
--
--  option(LLVM_INSTALL_TOOLCHAIN_ONLY
--    "Only include toolchain files in the 'install' target." OFF)
--
--  option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
--    "Set to ON to force using an old, unsupported host toolchain." OFF)
--
-+  list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
-   include(AddLLVM)
-   include(TableGen)
-   include(HandleLLVMOptions)
-@@ -99,7 +40,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-     set(LLVM_INCLUDE_TESTS ON)
-   endif()
- 
--  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
-+  include_directories("${LLVM_INCLUDE_DIRS}")
-   link_directories("${LLVM_LIBRARY_DIR}")
- 
-   set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
-- 
2.46.0