Repository: spack/spack

Issue:
Installation issue: Julia 1.9
### Steps to reproduce the issue

```console
$ spack spec -I julia
Input spec
--------------------------------
 -   julia

Concretized
--------------------------------
 -   julia@1.9.0%gcc@13.1.0+openlibm+precompile build_system=makefile arch=linux-centos8-x86_64_v3
[+]      ^curl@8.0.1%gcc@13.1.0~gssapi~ldap+libidn2~librtmp~libssh+libssh2+nghttp2 build_system=autotools libs=shared,static tls=mbedtls,openssl arch=linux-centos8-x86_64_v3
[+]          ^libidn2@2.3.4%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^libunistring@1.1%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]                  ^libiconv@1.17%gcc@13.1.0 build_system=autotools libs=shared,static arch=linux-centos8-x86_64_v3
[+]          ^openssl@1.1.1t%gcc@13.1.0~docs~shared build_system=generic certs=mozilla arch=linux-centos8-x86_64_v3
[+]              ^ca-certificates-mozilla@2023-01-10%gcc@13.1.0 build_system=generic arch=linux-centos8-x86_64_v3
[+]          ^pkgconf@1.9.5%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^dsfmt@2.2.5%gcc@13.1.0 build_system=makefile patches=b79624c arch=linux-centos8-x86_64_v3
[+]      ^gmp@6.2.1%gcc@13.1.0+cxx build_system=autotools libs=shared,static patches=69ad2e2 arch=linux-centos8-x86_64_v3
[+]          ^autoconf@2.69%gcc@13.1.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-centos8-x86_64_v3
[+]          ^automake@1.16.5%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^libtool@2.4.7%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^m4@1.4.19%gcc@13.1.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-centos8-x86_64_v3
[+]              ^diffutils@3.9%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^libsigsegv@2.14%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^libblastrampoline@5.8.0%gcc@13.1.0 build_system=makefile arch=linux-centos8-x86_64_v3
[+]      ^libgit2@1.5.0%gcc@13.1.0~curl~ipo+mmap+ssh build_system=cmake build_type=Release generator=make https=system arch=linux-centos8-x86_64_v3
[+]          ^cmake@3.26.3%gcc@13.1.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-centos8-x86_64_v3
[+]          ^gmake@4.4.1%gcc@13.1.0~guile build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^pcre@8.45%gcc@13.1.0+jit+multibyte+utf build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^libssh2@1.10.0%gcc@13.1.0~ipo+shared build_system=cmake build_type=Release crypto=mbedtls generator=make arch=linux-centos8-x86_64_v3
[+]          ^xz@5.4.1%gcc@13.1.0~pic build_system=autotools libs=shared,static arch=linux-centos8-x86_64_v3
[+]      ^libunwind@1.6.2%gcc@13.1.0~block_signals~conservative_checks~cxx_exceptions~debug~debug_frame+docs~pic+tests+weak_backtrace~xz~zlib build_system=autotools components=none libs=shared,static arch=linux-centos8-x86_64_v3
[+]      ^libuv-julia@1.44.2%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^libwhich@1.1.0%gcc@13.1.0 build_system=generic arch=linux-centos8-x86_64_v3
 -       ^llvm@14.0.6%gcc@13.1.0+clang+compiler-rt~cuda~flang+gold~internal_unwind~ipo+libcxx+libomptarget+link_llvm_dylib+lld+lldb+llvm_dylib~mlir+omp_as_runtime~omp_debug~omp_tsan+polly~python~split_dwarf~z3 build_system=cmake build_type=Release generator=ninja patches=25bc503,6379168,9f2bc98,d85ef51,f920173 shlib_symbol_version=JL_LLVM_14.0 targets=all,amdgpu,bpf,nvptx,webassembly version_suffix=jl arch=linux-centos8-x86_64_v3
[+]          ^binutils@2.40%gcc@13.1.0~gas+gold~gprofng+headers~interwork+ld~libiberty~lto~nls~pgo+plugins build_system=autotools compress_debug_sections=zlib libs=shared,static arch=linux-centos8-x86_64_v3
[+]              ^zstd@1.5.5%gcc@13.1.0+programs build_system=makefile compression=none libs=shared,static arch=linux-centos8-x86_64_v3
[+]          ^hwloc@2.9.1%gcc@13.1.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-centos8-x86_64_v3
[+]              ^libpciaccess@0.17%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]                  ^util-macros@1.19.3%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^libxml2@2.10.3%gcc@13.1.0~python build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^libedit@3.1-20210216%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^libffi@3.4.4%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^ncurses@6.4%gcc@13.1.0~symlinks+termlib abi=none build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^ninja@1.11.1%gcc@13.1.0+re2c build_system=generic arch=linux-centos8-x86_64_v3
[+]              ^re2c@2.2%gcc@13.1.0 build_system=generic arch=linux-centos8-x86_64_v3
[+]          ^perl-data-dumper@2.173%gcc@13.1.0 build_system=perl arch=linux-centos8-x86_64_v3
[+]          ^python@3.10.10%gcc@13.1.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-centos8-x86_64_v3
[+]              ^expat@2.5.0%gcc@13.1.0+libbsd build_system=autotools arch=linux-centos8-x86_64_v3
[+]                  ^libbsd@0.11.7%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]                      ^libmd@1.0.4%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^gettext@0.21.1%gcc@13.1.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-centos8-x86_64_v3
[+]                  ^tar@1.34%gcc@13.1.0 build_system=autotools zip=pigz arch=linux-centos8-x86_64_v3
[+]                      ^pigz@2.7%gcc@13.1.0 build_system=makefile arch=linux-centos8-x86_64_v3
[+]              ^libxcrypt@4.4.33%gcc@13.1.0~obsolete_api build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^readline@8.2%gcc@13.1.0 build_system=autotools patches=bbf97f1 arch=linux-centos8-x86_64_v3
[+]              ^sqlite@3.40.1%gcc@13.1.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-centos8-x86_64_v3
[+]              ^util-linux-uuid@2.38.1%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^mbedtls@2.28.2%gcc@13.1.0+pic build_system=makefile build_type=Release libs=shared,static arch=linux-centos8-x86_64_v3
[+]      ^mpfr@4.2.0%gcc@13.1.0 build_system=autotools libs=shared,static arch=linux-centos8-x86_64_v3
[+]          ^autoconf-archive@2023.02.20%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]          ^texinfo@7.0.3%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^nghttp2@1.48.0%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^openblas@0.3.23%gcc@13.1.0~bignuma~consistent_fpcsr+fortran+ilp64+locking+pic+shared build_system=makefile symbol_suffix=64_ threads=none arch=linux-centos8-x86_64_v3
[+]      ^openlibm@0.8.1%gcc@13.1.0 build_system=makefile arch=linux-centos8-x86_64_v3
[+]      ^p7zip@17.05%gcc@13.1.0 build_system=makefile arch=linux-centos8-x86_64_v3
[+]      ^patchelf@0.17.2%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^pcre2@10.42%gcc@13.1.0~jit+multibyte build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^perl@5.36.0%gcc@13.1.0+cpanm+open+shared+threads build_system=generic arch=linux-centos8-x86_64_v3
[+]          ^berkeley-db@18.1.40%gcc@13.1.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-centos8-x86_64_v3
[+]          ^bzip2@1.0.8%gcc@13.1.0~debug~pic+shared build_system=generic arch=linux-centos8-x86_64_v3
[+]          ^gdbm@1.23%gcc@13.1.0 build_system=autotools arch=linux-centos8-x86_64_v3
[+]      ^suite-sparse@5.13.0%gcc@13.1.0~cuda~graphblas~openmp+pic build_system=generic arch=linux-centos8-x86_64_v3
[+]          ^metis@5.1.0%gcc@13.1.0~gdb~int64~ipo~real64+shared build_system=cmake build_type=Release generator=make patches=4991da9,93a7903,b1225da arch=linux-centos8-x86_64_v3
[+]      ^utf8proc@2.8.0%gcc@13.1.0~ipo~shared build_system=cmake build_type=Release generator=make arch=linux-centos8-x86_64_v3
[+]      ^zlib@1.2.13%gcc@13.1.0+optimize+pic+shared build_system=makefile arch=linux-centos8-x86_64_v3
```

### Error message

julia@1.9 does not build because patching llvm@14.0.6 fails:

<details><summary>Error message</summary>

<pre>
==> Installing llvm-14.0.6-sw2n46k34kqzrqnzzem3rqp26ukl4rvx
==> No binary for llvm-14.0.6-sw2n46k34kqzrqnzzem3rqp26ukl4rvx found: installing from source
==> Using cached archive: $SPACK/var/spack/cache/_source-cache/archive/98/98f15f842700bdb7220a166c8d2739a03a72e775b67031205078f39dd756a055.tar.gz
==> Using cached archive: $SPACK/var/spack/cache/_source-cache/archive/9f/9f2bc98e876e85a3edb158064aae782281ea7099e4c34e83ac456609cb7acd10
==> Using cached archive: $SPACK/var/spack/cache/_source-cache/archive/25/25bc503f7855229620e56e76161cf4654945aef0be493a2d8d9e94a088157b7c
1 out of 2 hunks FAILED -- saving rejects to file lld/MachO/ICF.cpp.rej
File lld/test/MachO/Inputs/eh-frame-x86_64-r.o: git binary diffs are not supported.
File lld/test/MachO/Inputs/eh-frame-arm64-r.o: git binary diffs are not supported.
==> Patch https://github.com/JuliaLang/llvm-project/compare/f28c006a5895fc0e329fe15fead81e37457cb1d1...5c82f5309b10fab0adf6a94969e0dddffdb3dbce.patch failed.
==> Error: ProcessError: Command exited with status 1:
    '/usr/bin/patch' '-s' '-p' '1' '-i' '$SPACK_STAGE/spack-stage-ge44kvve/f28c006a5895fc0e329fe15fead81e37457cb1d1...5c82f5309b10fab0adf6a94969e0dddffdb3dbce.patch' '-d' '.'
</pre></details>

### Information on your system

* **Spack:** 0.21.0.dev0
* **Python:** 3.6.8
* **Platform:** linux-centos8-zen3
* **Concretizer:** clingo

### Additional information

cc @giordano @haampie @vchuravy

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
How did this work before?

@vchuravy I guess we can push a commit to revert the change to the binary file and use the `.diff` file instead of the `.patch` here.
I'm not sure how fatal the binary part is. One hunk of `lld/MachO/ICF.cpp` does not apply, does the `.diff` version fix that?
> does the .diff version fix that?

As far as I understand, the patch file has the individual patches of all commits in the range, while the diff file would be the cumulative diff of the range, so that if we revert the offending hunk (which comes from a backported commit in llvm 15) that should disappear 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/julia/package.py b/var/spack/repos/builtin/packages/julia/package.py
--- a/var/spack/repos/builtin/packages/julia/package.py
+++ b/var/spack/repos/builtin/packages/julia/package.py
@@ -138,8 +138,8 @@ class Julia(MakefilePackage):
         "llvm",
         when="^llvm@14.0.6",
         patches=patch(
-            "https://github.com/JuliaLang/llvm-project/compare/f28c006a5895fc0e329fe15fead81e37457cb1d1...5c82f5309b10fab0adf6a94969e0dddffdb3dbce.patch",
-            sha256="9f2bc98e876e85a3edb158064aae782281ea7099e4c34e83ac456609cb7acd10",
+            "https://github.com/JuliaLang/llvm-project/compare/f28c006a5895fc0e329fe15fead81e37457cb1d1...381043941d2c7a5157a011510b6d0386c171aae7.diff",
+            sha256="f3def26930832532bbcd861d41b31ae03db993bc2b3510f89ef831a30bd3e099",
         ),
     )
 


Test patch: