[arch-commits] Commit in julia/repos (16 files)

Antonio Rojas arojas at gemini.archlinux.org
Wed Jun 22 16:49:18 UTC 2022


    Date: Wednesday, June 22, 2022 @ 16:49:18
  Author: arojas
Revision: 1238981

archrelease: copy trunk to community-staging-x86_64

Added:
  julia/repos/community-staging-x86_64/
  julia/repos/community-staging-x86_64/074d761f.patch
    (from rev 1238980, julia/trunk/074d761f.patch)
  julia/repos/community-staging-x86_64/144ebbaf.patch
    (from rev 1238980, julia/trunk/144ebbaf.patch)
  julia/repos/community-staging-x86_64/63303980.patch
    (from rev 1238980, julia/trunk/63303980.patch)
  julia/repos/community-staging-x86_64/PKGBUILD
    (from rev 1238980, julia/trunk/PKGBUILD)
  julia/repos/community-staging-x86_64/ed9851b0.patch
    (from rev 1238980, julia/trunk/ed9851b0.patch)
  julia/repos/community-staging-x86_64/f8c918b0.patch
    (from rev 1238980, julia/trunk/f8c918b0.patch)
  julia/repos/community-staging-x86_64/julia-gcc-12.patch
    (from rev 1238980, julia/trunk/julia-gcc-12.patch)
  julia/repos/community-staging-x86_64/julia-hardcoded-libs.patch
    (from rev 1238980, julia/trunk/julia-hardcoded-libs.patch)
  julia/repos/community-staging-x86_64/julia-libblastrampoline-4.patch
    (from rev 1238980, julia/trunk/julia-libblastrampoline-4.patch)
  julia/repos/community-staging-x86_64/julia-libgit-1.2.patch
    (from rev 1238980, julia/trunk/julia-libgit-1.2.patch)
  julia/repos/community-staging-x86_64/julia-libgit-1.4.patch
    (from rev 1238980, julia/trunk/julia-libgit-1.4.patch)
  julia/repos/community-staging-x86_64/julia-libunwind-1.6.patch
    (from rev 1238980, julia/trunk/julia-libunwind-1.6.patch)
  julia/repos/community-staging-x86_64/julia-system-cblas.patch
    (from rev 1238980, julia/trunk/julia-system-cblas.patch)
  julia/repos/community-staging-x86_64/keys/
  julia/repos/community-staging-x86_64/make-install-no-build.patch
    (from rev 1238980, julia/trunk/make-install-no-build.patch)

---------------------------------+
 074d761f.patch                  |   62 +
 144ebbaf.patch                  | 1181 ++++++++++++++++++++++++++++++++++++++
 63303980.patch                  |  683 +++++++++++++++++++++
 PKGBUILD                        |  166 +++++
 ed9851b0.patch                  |   96 +++
 f8c918b0.patch                  |  236 +++++++
 julia-gcc-12.patch              |  521 ++++++++++++++++
 julia-hardcoded-libs.patch      |   69 ++
 julia-libblastrampoline-4.patch |   15 
 julia-libgit-1.2.patch          |  213 ++++++
 julia-libgit-1.4.patch          |   40 +
 julia-libunwind-1.6.patch       |   20 
 julia-system-cblas.patch        |  133 ++++
 make-install-no-build.patch     |   14 
 14 files changed, 3449 insertions(+)

Copied: julia/repos/community-staging-x86_64/074d761f.patch (from rev 1238980, julia/trunk/074d761f.patch)
===================================================================
--- community-staging-x86_64/074d761f.patch	                        (rev 0)
+++ community-staging-x86_64/074d761f.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,62 @@
+From 074d761f00c41fc55f6fab0cb4c6969a9c09e27b Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Fri, 18 Feb 2022 14:37:41 -0500
+Subject: [PATCH] fix some missing includes
+
+---
+ src/llvm-alloc-helpers.cpp    | 2 ++
+ src/llvm-demote-float16.cpp   | 1 +
+ src/llvm-late-gc-lowering.cpp | 1 +
+ src/llvm-lower-handlers.cpp   | 1 +
+ src/llvm-remove-ni.cpp        | 1 +
+ 5 files changed, 6 insertions(+)
+
+diff --git a/src/llvm-demote-float16.cpp b/src/llvm-demote-float16.cpp
+index 25c93252558bb..46126c0ec06e3 100644
+--- a/src/llvm-demote-float16.cpp
++++ b/src/llvm-demote-float16.cpp
+@@ -19,6 +19,8 @@
+ #include "support/dtypes.h"
+ #include "passes.h"
+ 
++#include <llvm/Pass.h>
++#include <llvm/IR/IntrinsicInst.h>
+ #include <llvm/IR/IRBuilder.h>
+ #include <llvm/IR/LegacyPassManager.h>
+ #include <llvm/IR/PassManager.h>
+diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
+index 6069c7f2e2869..e0163b14a0189 100644
+--- a/src/llvm-late-gc-lowering.cpp
++++ b/src/llvm-late-gc-lowering.cpp
+@@ -34,6 +34,7 @@
+ #include "julia_internal.h"
+ #include "julia_assert.h"
+ #include "llvm-pass-helpers.h"
++#include <map>
+ 
+ #define DEBUG_TYPE "late_lower_gcroot"
+ 
+diff --git a/src/llvm-lower-handlers.cpp b/src/llvm-lower-handlers.cpp
+index 324c591f77be8..045056805bddd 100644
+--- a/src/llvm-lower-handlers.cpp
++++ b/src/llvm-lower-handlers.cpp
+@@ -22,6 +22,7 @@
+ 
+ #include "julia.h"
+ #include "julia_assert.h"
++#include <map>
+ 
+ #define DEBUG_TYPE "lower_handlers"
+ #undef DEBUG
+diff --git a/src/llvm-remove-ni.cpp b/src/llvm-remove-ni.cpp
+index 50a6041c017e0..13680064211c7 100644
+--- a/src/llvm-remove-ni.cpp
++++ b/src/llvm-remove-ni.cpp
+@@ -3,6 +3,7 @@
+ #include "llvm-version.h"
+ #include "passes.h"
+ 
++#include <llvm/Pass.h>
+ #include <llvm/IR/Module.h>
+ #include <llvm/IR/PassManager.h>
+ #include <llvm/IR/LegacyPassManager.h>

Copied: julia/repos/community-staging-x86_64/144ebbaf.patch (from rev 1238980, julia/trunk/144ebbaf.patch)
===================================================================
--- community-staging-x86_64/144ebbaf.patch	                        (rev 0)
+++ community-staging-x86_64/144ebbaf.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,1181 @@
+From 144ebbaf7ad0594986bd9a6d08aae57246643de9 Mon Sep 17 00:00:00 2001
+From: David Nadlinger <code at klickverbot.at>
+Date: Wed, 5 Jan 2022 03:25:54 +0100
+Subject: [PATCH] Support LLVM 14 (upstream Git main) (#43628)
+
+Compiles against llvm/llvm-project#2ec3ca747732, with some of
+our unmerged local patches from 13.x still required.
+
+Unfortunately, there is quite a bit of fallout from the various
+attribute API renames. I chose to introduce some function shims
+to separate out all the preprocessor #if clutter.
+---
+ src/aotcompile.cpp                 |   4 +
+ src/ccall.cpp                      |  40 ++++-----
+ src/cgutils.cpp                    |  49 +++++------
+ src/codegen.cpp                    |  83 ++++++++++---------
+ src/codegen_shared.h               | 128 ++++++++++++++++++++++++++++-
+ src/disasm.cpp                     |   8 ++
+ src/intrinsics.cpp                 |  14 ++--
+ src/jitlayers.cpp                  |   8 +-
+ src/llvm-alloc-opt.cpp             |  14 ++--
+ src/llvm-final-gc-lowering.cpp     |  16 ++--
+ src/llvm-gc-invariant-verifier.cpp |   2 +-
+ src/llvm-julia-licm.cpp            |   2 +-
+ src/llvm-late-gc-lowering.cpp      |  20 ++---
+ src/llvm-pass-helpers.cpp          |   8 +-
+ src/llvm-ptls.cpp                  |   4 +-
+ src/llvm-remove-addrspaces.cpp     |  16 +++-
+ 16 files changed, 287 insertions(+), 129 deletions(-)
+
+diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
+index f96894f93c17d..7284d0bf7f0a7 100644
+--- a/src/aotcompile.cpp
++++ b/src/aotcompile.cpp
+@@ -8,7 +8,11 @@
+ 
+ // target support
+ #include <llvm/ADT/Triple.h>
++#if JL_LLVM_VERSION >= 140000
++#include <llvm/MC/TargetRegistry.h>
++#else
+ #include <llvm/Support/TargetRegistry.h>
++#endif
+ #include <llvm/Target/TargetMachine.h>
+ #include <llvm/IR/DataLayout.h>
+ #include <llvm/Analysis/TargetTransformInfo.h>
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index f6d3dd5e8b1f9..c51385e647790 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -223,8 +223,7 @@ static GlobalVariable *emit_plt_thunk(
+     // NoReturn function can trigger LLVM verifier error when declared as
+     // MustTail since other passes might replace the `ret` with
+     // `unreachable` (LLVM should probably accept `unreachable`).
+-    if (attrs.hasAttribute(AttributeList::FunctionIndex,
+-                           Attribute::NoReturn)) {
++    if (hasFnAttr(attrs, Attribute::NoReturn)) {
+         irbuilder.CreateUnreachable();
+     }
+     else {
+@@ -272,7 +271,7 @@ static Value *emit_plt(
+                 functype, attrs, cc, f_lib, f_name, libptrgv, llvmgv, runtime_lib);
+     }
+     GlobalVariable *got = prepare_global_in(jl_Module, sharedgot);
+-    LoadInst *got_val = ctx.builder.CreateAlignedLoad(got, Align(sizeof(void*)));
++    LoadInst *got_val = ctx.builder.CreateAlignedLoad(got->getType()->getElementType(), got, Align(sizeof(void*)));
+     // See comment in `runtime_sym_lookup` above. This in principle needs a
+     // consume ordering too. This is even less likely to cause issues though
+     // since the only thing we do to this loaded pointer is to call it
+@@ -404,7 +403,7 @@ static Value *llvm_type_rewrite(
+         to = emit_bitcast(ctx, from, target_type->getPointerTo());
+     }
+     ctx.builder.CreateAlignedStore(v, from, Align(align));
+-    return ctx.builder.CreateAlignedLoad(to, Align(align));
++    return ctx.builder.CreateAlignedLoad(target_type, to, Align(align));
+ }
+ 
+ // --- argument passing and scratch space utilities ---
+@@ -422,8 +421,7 @@ static Value *runtime_apply_type_env(jl_codectx_t &ctx, jl_value_t *ty)
+                 ConstantInt::get(T_size, sizeof(jl_svec_t) / sizeof(jl_value_t*)))
+     };
+     auto call = ctx.builder.CreateCall(prepare_call(jlapplytype_func), makeArrayRef(args));
+-    call->addAttribute(AttributeList::ReturnIndex,
+-                       Attribute::getWithAlignment(jl_LLVMContext, Align(16)));
++    addRetAttr(call, Attribute::getWithAlignment(jl_LLVMContext, Align(16)));
+     return call;
+ }
+ 
+@@ -1125,16 +1123,13 @@ std::string generate_func_sig(const char *fname)
+         const auto &as = paramattrs.at(i);
+         if (!as.hasAttributes())
+             continue;
+-        attributes = attributes.addAttributes(jl_LLVMContext, i + 1, as);
++        attributes = addAttributesAtIndex(attributes, jl_LLVMContext, i + 1, as);
+     }
+     // If return value is boxed it must be non-null.
+     if (retboxed)
+-        attributes = attributes.addAttribute(jl_LLVMContext, AttributeList::ReturnIndex,
+-                                             Attribute::NonNull);
++        attributes = addRetAttribute(attributes, jl_LLVMContext, Attribute::NonNull);
+     if (rt == jl_bottom_type) {
+-        attributes = attributes.addAttribute(jl_LLVMContext,
+-                                             AttributeList::FunctionIndex,
+-                                             Attribute::NoReturn);
++        attributes = addFnAttribute(attributes, jl_LLVMContext, Attribute::NoReturn);
+     }
+     return "";
+ }
+@@ -1487,8 +1482,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+         JL_GC_POP();
+         Value *ptask_i16 = emit_bitcast(ctx, get_current_task(ctx), T_pint16);
+         const int tid_offset = offsetof(jl_task_t, tid);
+-        Value *ptid = ctx.builder.CreateInBoundsGEP(ptask_i16, ConstantInt::get(T_size, tid_offset / sizeof(int16_t)));
+-        LoadInst *tid = ctx.builder.CreateAlignedLoad(ptid, Align(sizeof(int16_t)));
++        Value *ptid = ctx.builder.CreateInBoundsGEP(T_int16, ptask_i16, ConstantInt::get(T_size, tid_offset / sizeof(int16_t)));
++        LoadInst *tid = ctx.builder.CreateAlignedLoad(T_int16, ptid, Align(sizeof(int16_t)));
+         tbaa_decorate(tbaa_gcframe, tid);
+         return mark_or_box_ccall_result(ctx, tid, retboxed, rt, unionall, static_rt);
+     }
+@@ -1500,8 +1495,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+         JL_GC_POP();
+         Value *ptls_i32 = emit_bitcast(ctx, get_current_ptls(ctx), T_pint32);
+         const int finh_offset = offsetof(jl_tls_states_t, finalizers_inhibited);
+-        Value *pfinh = ctx.builder.CreateInBoundsGEP(ptls_i32, ConstantInt::get(T_size, finh_offset / 4));
+-        LoadInst *finh = ctx.builder.CreateAlignedLoad(pfinh, Align(sizeof(int32_t)));
++        Value *pfinh = ctx.builder.CreateInBoundsGEP(T_int32, ptls_i32, ConstantInt::get(T_size, finh_offset / 4));
++        LoadInst *finh = ctx.builder.CreateAlignedLoad(T_int32, pfinh, Align(sizeof(int32_t)));
+         Value *newval;
+         if (is_libjulia_func(jl_gc_disable_finalizers_internal)) {
+             newval = ctx.builder.CreateAdd(finh, ConstantInt::get(T_int32, 1));
+@@ -1527,7 +1522,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+         JL_GC_POP();
+         Value *ptls_pv = emit_bitcast(ctx, get_current_ptls(ctx), T_ppjlvalue);
+         const int nt_offset = offsetof(jl_tls_states_t, next_task);
+-        Value *pnt = ctx.builder.CreateInBoundsGEP(ptls_pv, ConstantInt::get(T_size, nt_offset / sizeof(void*)));
++        Value *pnt = ctx.builder.CreateInBoundsGEP(T_pjlvalue, ptls_pv, ConstantInt::get(T_size, nt_offset / sizeof(void*)));
+         ctx.builder.CreateStore(emit_pointer_from_objref(ctx, boxed(ctx, argv[0])), pnt);
+         return ghostValue(jl_nothing_type);
+     }
+@@ -1537,7 +1532,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+         JL_GC_POP();
+         ctx.builder.CreateCall(prepare_call(gcroot_flush_func));
+         Value *pdefer_sig = emit_defer_signal(ctx);
+-        Value *defer_sig = ctx.builder.CreateLoad(pdefer_sig);
++        Value *defer_sig = ctx.builder.CreateLoad(T_sigatomic, pdefer_sig);
+         defer_sig = ctx.builder.CreateAdd(defer_sig, ConstantInt::get(T_sigatomic, 1));
+         ctx.builder.CreateStore(defer_sig, pdefer_sig);
+         emit_signal_fence(ctx);
+@@ -1549,7 +1544,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+         JL_GC_POP();
+         ctx.builder.CreateCall(prepare_call(gcroot_flush_func));
+         Value *pdefer_sig = emit_defer_signal(ctx);
+-        Value *defer_sig = ctx.builder.CreateLoad(pdefer_sig);
++        Value *defer_sig = ctx.builder.CreateLoad(T_sigatomic, pdefer_sig);
+         emit_signal_fence(ctx);
+         error_unless(ctx,
+                 ctx.builder.CreateICmpNE(defer_sig, ConstantInt::get(T_sigatomic, 0)),
+@@ -1566,6 +1561,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+                 checkBB, contBB);
+         ctx.builder.SetInsertPoint(checkBB);
+         ctx.builder.CreateLoad(
++                T_size,
+                 ctx.builder.CreateConstInBoundsGEP1_32(T_size, get_current_signal_page(ctx), -1),
+                 true);
+         ctx.builder.CreateBr(contBB);
+@@ -1725,8 +1721,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
+             JL_GC_POP();
+             const int hash_offset = offsetof(jl_sym_t, hash);
+             Value *ph1 = emit_bitcast(ctx, decay_derived(ctx, boxed(ctx, val)), T_psize);
+-            Value *ph2 = ctx.builder.CreateInBoundsGEP(ph1, ConstantInt::get(T_size, hash_offset / sizeof(size_t)));
+-            LoadInst *hashval = ctx.builder.CreateAlignedLoad(ph2, Align(sizeof(size_t)));
++            Value *ph2 = ctx.builder.CreateInBoundsGEP(T_size, ph1, ConstantInt::get(T_size, hash_offset / sizeof(size_t)));
++            LoadInst *hashval = ctx.builder.CreateAlignedLoad(T_size, ph2, Align(sizeof(size_t)));
+             tbaa_decorate(tbaa_const, hashval);
+             return mark_or_box_ccall_result(ctx, hashval, retboxed, rt, unionall, static_rt);
+         }
+@@ -1951,7 +1947,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
+             // something alloca'd above is SSA
+             if (static_rt)
+                 return mark_julia_slot(result, rt, NULL, tbaa_stack);
+-            result = ctx.builder.CreateLoad(result);
++            result = ctx.builder.CreateLoad(cast<PointerType>(result->getType())->getElementType(), result);
+         }
+     }
+     else {
+diff --git a/src/cgutils.cpp b/src/cgutils.cpp
+index 007827ebe7b7e..9bff5634382c4 100644
+--- a/src/cgutils.cpp
++++ b/src/cgutils.cpp
+@@ -795,19 +795,21 @@ static Value *emit_nthptr_addr(jl_codectx_t &ctx, Value *v, Value *idx)
+             idx);
+ }
+ 
+-static LoadInst *emit_nthptr_recast(jl_codectx_t &ctx, Value *v, Value *idx, MDNode *tbaa, Type *ptype)
++static LoadInst *emit_nthptr_recast(jl_codectx_t &ctx, Value *v, Value *idx, MDNode *tbaa, Type *type)
+ {
+-    // p = (jl_value_t**)v; *(ptype)&p[n]
++    // p = (jl_value_t**)v; *(type*)&p[n]
+     Value *vptr = emit_nthptr_addr(ctx, v, idx);
+-    return cast<LoadInst>(tbaa_decorate(tbaa, ctx.builder.CreateLoad(emit_bitcast(ctx, vptr, ptype))));
++    return cast<LoadInst>(tbaa_decorate(tbaa, ctx.builder.CreateLoad(type,
++        emit_bitcast(ctx, vptr, PointerType::get(type, 0)))));
+ }
+ 
+-static LoadInst *emit_nthptr_recast(jl_codectx_t &ctx, Value *v, ssize_t n, MDNode *tbaa, Type *ptype)
++static LoadInst *emit_nthptr_recast(jl_codectx_t &ctx, Value *v, ssize_t n, MDNode *tbaa, Type *type)
+ {
+-    // p = (jl_value_t**)v; *(ptype)&p[n]
++    // p = (jl_value_t**)v; *(type*)&p[n]
+     Value *vptr = emit_nthptr_addr(ctx, v, n);
+-    return cast<LoadInst>(tbaa_decorate(tbaa, ctx.builder.CreateLoad(emit_bitcast(ctx, vptr, ptype))));
+-}
++    return cast<LoadInst>(tbaa_decorate(tbaa, ctx.builder.CreateLoad(type,
++        emit_bitcast(ctx, vptr, PointerType::get(type, 0)))));
++ }
+ 
+ static Value *boxed(jl_codectx_t &ctx, const jl_cgval_t &v);
+ 
+@@ -1506,7 +1508,7 @@ static jl_cgval_t typed_load(jl_codectx_t &ctx, Value *ptr, Value *idx_0based, j
+             alignment = sizeof(void*);
+         else if (!alignment)
+             alignment = julia_alignment(jltype);
+-        LoadInst *load = ctx.builder.CreateAlignedLoad(data, Align(alignment), false);
++        LoadInst *load = ctx.builder.CreateAlignedLoad(elty, data, Align(alignment), false);
+         load->setOrdering(Order);
+         if (aliasscope)
+             load->setMetadata("alias.scope", aliasscope);
+@@ -1519,7 +1521,7 @@ static jl_cgval_t typed_load(jl_codectx_t &ctx, Value *ptr, Value *idx_0based, j
+             instr = ctx.builder.CreateTrunc(instr, realelty);
+         if (intcast) {
+             ctx.builder.CreateStore(instr, ctx.builder.CreateBitCast(intcast, instr->getType()->getPointerTo()));
+-            instr = ctx.builder.CreateLoad(intcast);
++            instr = ctx.builder.CreateLoad(intcast->getAllocatedType(), intcast);
+         }
+         if (maybe_null_if_boxed) {
+             Value *first_ptr = isboxed ? instr : extract_first_ptr(ctx, instr);
+@@ -1586,7 +1588,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
+             return emit_new_struct(ctx, (jl_value_t*)rettyp, 2, argv);
+         }
+     }
+-    Value *intcast = nullptr;
++    AllocaInst *intcast = nullptr;
+     if (!isboxed && Order != AtomicOrdering::NotAtomic && !elty->isIntOrPtrTy()) {
+         const DataLayout &DL = jl_data_layout;
+         unsigned nb = DL.getTypeSizeInBits(elty);
+@@ -1736,7 +1738,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
+             if (intcast) {
+                 ctx.builder.CreateStore(realCompare, ctx.builder.CreateBitCast(intcast, realCompare->getType()->getPointerTo()));
+                 if (maybe_null_if_boxed)
+-                    realCompare = ctx.builder.CreateLoad(intcast);
++                    realCompare = ctx.builder.CreateLoad(intcast->getAllocatedType(), intcast);
+             }
+             if (maybe_null_if_boxed) {
+                 Value *first_ptr = isboxed ? Compare : extract_first_ptr(ctx, Compare);
+@@ -1816,7 +1818,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
+                     ctx.builder.CreateStore(realinstr, ctx.builder.CreateBitCast(intcast, realinstr->getType()->getPointerTo()));
+                     oldval = mark_julia_slot(intcast, jltype, NULL, tbaa_stack);
+                     if (maybe_null_if_boxed)
+-                        realinstr = ctx.builder.CreateLoad(intcast);
++                        realinstr = ctx.builder.CreateLoad(intcast->getAllocatedType(), intcast);
+                 }
+                 else {
+                     oldval = mark_julia_type(ctx, realinstr, isboxed, jltype);
+@@ -1876,7 +1878,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
+             instr = ctx.builder.Insert(CastInst::Create(Instruction::Trunc, instr, realelty));
+         if (intcast) {
+             ctx.builder.CreateStore(instr, ctx.builder.CreateBitCast(intcast, instr->getType()->getPointerTo()));
+-            instr = ctx.builder.CreateLoad(intcast);
++            instr = ctx.builder.CreateLoad(intcast->getAllocatedType(), intcast);
+         }
+         if (maybe_null_if_boxed) {
+             Value *first_ptr = isboxed ? instr : extract_first_ptr(ctx, instr);
+@@ -1949,18 +1951,18 @@ static void emit_memcpy_llvm(jl_codectx_t &ctx, Value *dst, MDNode *tbaa_dst, Va
+             dstty = dstel->getPointerTo();
+         }
+ 
+-        bool direct = false;
++        llvm::Type *directel = nullptr;
+         if (srcel->isSized() && srcel->isSingleValueType() && DL.getTypeStoreSize(srcel) == sz) {
+-            direct = true;
++            directel = srcel;
+             dst = emit_bitcast(ctx, dst, srcty);
+         }
+         else if (dstel->isSized() && dstel->isSingleValueType() &&
+                  DL.getTypeStoreSize(dstel) == sz) {
+-            direct = true;
++            directel = dstel;
+             src = emit_bitcast(ctx, src, dstty);
+         }
+-        if (direct) {
+-            auto val = tbaa_decorate(tbaa_src, ctx.builder.CreateAlignedLoad(src, Align(align), is_volatile));
++        if (directel) {
++            auto val = tbaa_decorate(tbaa_src, ctx.builder.CreateAlignedLoad(directel, src, Align(align), is_volatile));
+             tbaa_decorate(tbaa_dst, ctx.builder.CreateAlignedStore(val, dst, Align(align), is_volatile));
+             return;
+         }
+@@ -2430,7 +2432,7 @@ static Value *emit_arraysize(jl_codectx_t &ctx, const jl_cgval_t &tinfo, Value *
+     auto load = emit_nthptr_recast(ctx,
+             t,
+             ctx.builder.CreateAdd(dim, ConstantInt::get(dim->getType(), o)),
+-            tbaa, T_psize);
++            tbaa, T_size);
+     MDBuilder MDB(jl_LLVMContext);
+     auto rng = MDB.createRange(V_size0, ConstantInt::get(T_size, arraytype_maxsize(tinfo.typ)));
+     load->setMetadata(LLVMContext::MD_range, rng);
+@@ -2466,7 +2468,7 @@ static Value *emit_arraylen_prim(jl_codectx_t &ctx, const jl_cgval_t &tinfo)
+     Value *addr = ctx.builder.CreateStructGEP(jl_array_llvmt,
+             emit_bitcast(ctx, decay_derived(ctx, t), jl_parray_llvmt),
+             1); //index (not offset) of length field in jl_parray_llvmt
+-    LoadInst *len = ctx.builder.CreateAlignedLoad(addr, Align(sizeof(size_t)));
++    LoadInst *len = ctx.builder.CreateAlignedLoad(T_size, addr, Align(sizeof(size_t)));
+     len->setOrdering(AtomicOrdering::NotAtomic);
+     MDBuilder MDB(jl_LLVMContext);
+     auto rng = MDB.createRange(V_size0, ConstantInt::get(T_size, arraytype_maxsize(tinfo.typ)));
+@@ -2519,7 +2521,8 @@ static Value *emit_arrayptr_internal(jl_codectx_t &ctx, const jl_cgval_t &tinfo,
+                 PointerType::get(PPT->getElementType(), AS),
+                 PT->getAddressSpace()));
+     }
+-    LoadInst *LI = ctx.builder.CreateAlignedLoad(addr, Align(sizeof(char*)));
++    LoadInst *LI = ctx.builder.CreateAlignedLoad(
++        cast<PointerType>(addr->getType())->getElementType(), addr, Align(sizeof(char*)));
+     LI->setOrdering(AtomicOrdering::NotAtomic);
+     LI->setMetadata(LLVMContext::MD_nonnull, MDNode::get(jl_LLVMContext, None));
+     tbaa_decorate(tbaa, LI);
+@@ -2828,9 +2831,9 @@ static Value *as_value(jl_codectx_t &ctx, Type *to, const jl_cgval_t &v)
+ static Value *load_i8box(jl_codectx_t &ctx, Value *v, jl_datatype_t *ty)
+ {
+     auto jvar = ty == jl_int8_type ? jlboxed_int8_cache : jlboxed_uint8_cache;
+-    Constant *gv = prepare_global_in(jl_Module, jvar);
++    GlobalVariable *gv = prepare_global_in(jl_Module, jvar);
+     Value *idx[] = {ConstantInt::get(T_int32, 0), ctx.builder.CreateZExt(v, T_int32)};
+-    auto slot = ctx.builder.CreateInBoundsGEP(gv, idx);
++    auto slot = ctx.builder.CreateInBoundsGEP(gv->getType()->getElementType(), gv, idx);
+     return tbaa_decorate(tbaa_const, maybe_mark_load_dereferenceable(
+             ctx.builder.CreateAlignedLoad(T_pjlvalue, slot, Align(sizeof(void*))), false,
+             (jl_value_t*)ty));
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index ba933b60e554d..18e95fc169c8d 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -30,7 +30,11 @@
+ 
+ // target machine computation
+ #include <llvm/CodeGen/TargetSubtargetInfo.h>
++#if JL_LLVM_VERSION >= 140000
++#include <llvm/MC/TargetRegistry.h>
++#else
+ #include <llvm/Support/TargetRegistry.h>
++#endif
+ #include <llvm/Target/TargetOptions.h>
+ #include <llvm/Support/Host.h>
+ #include <llvm/Support/TargetSelect.h>
+@@ -867,11 +871,6 @@ extern "C" {
+         jl_rettype_inferred, NULL };
+ }
+ 
+-template<typename T>
+-static void add_return_attr(T *f, Attribute::AttrKind Kind)
+-{
+-    f->addAttribute(AttributeList::ReturnIndex, Kind);
+-}
+ 
+ static MDNode *best_tbaa(jl_value_t *jt) {
+     jt = jl_unwrap_unionall(jt);
+@@ -1822,7 +1821,7 @@ static void visitLine(jl_codectx_t &ctx, uint64_t *ptr, Value *addend, const cha
+     Value *pv = ConstantExpr::getIntToPtr(
+         ConstantInt::get(T_size, (uintptr_t)ptr),
+         T_pint64);
+-    Value *v = ctx.builder.CreateLoad(pv, true, name);
++    Value *v = ctx.builder.CreateLoad(T_int64, pv, true, name);
+     v = ctx.builder.CreateAdd(v, addend);
+     ctx.builder.CreateStore(v, pv, true); // volatile, not atomic, so this might be an underestimate,
+                                           // but it's faster this way
+@@ -2961,7 +2960,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
+                         Value *idx = emit_unbox(ctx, T_size, fld, (jl_value_t*)jl_long_type);
+                         idx = emit_bounds_check(ctx, va_ary, NULL, idx, valen, boundscheck);
+                         idx = ctx.builder.CreateAdd(idx, ConstantInt::get(T_size, ctx.nReqArgs));
+-                        Instruction *v = ctx.builder.CreateAlignedLoad(T_prjlvalue, ctx.builder.CreateInBoundsGEP(ctx.argArray, idx), Align(sizeof(void*)));
++                        Instruction *v = ctx.builder.CreateAlignedLoad(T_prjlvalue, ctx.builder.CreateInBoundsGEP(T_prjlvalue, ctx.argArray, idx), Align(sizeof(void*)));
+                         // if we know the result type of this load, we will mark that information here too
+                         tbaa_decorate(tbaa_value, maybe_mark_load_dereferenceable(v, false, rt));
+                         *ret = mark_julia_type(ctx, v, /*boxed*/ true, rt);
+@@ -3278,7 +3277,7 @@ static CallInst *emit_jlcall(jl_codectx_t &ctx, Function *theFptr, Value *theF,
+     CallInst *result = ctx.builder.CreateCall(FTy,
+         ctx.builder.CreateBitCast(theFptr, FTy->getPointerTo()),
+         theArgs);
+-    add_return_attr(result, Attribute::NonNull);
++    addRetAttr(result, Attribute::NonNull);
+     result->setCallingConv(cc);
+     return result;
+ }
+@@ -3409,7 +3408,7 @@ static jl_cgval_t emit_call_specfun_boxed(jl_codectx_t &ctx, jl_value_t *jlretty
+ {
+     auto theFptr = cast<Function>(
+         jl_Module->getOrInsertFunction(specFunctionObject, jl_func_sig).getCallee());
+-    add_return_attr(theFptr, Attribute::NonNull);
++    addRetAttr(theFptr, Attribute::NonNull);
+     theFptr->addFnAttr(Thunk);
+     Value *ret = emit_jlcall(ctx, theFptr, nullptr, argv, nargs, JLCALL_F_CC);
+     return update_julia_type(ctx, mark_julia_type(ctx, ret, true, jlretty), inferred_retty);
+@@ -4285,7 +4284,8 @@ static void emit_stmtpos(jl_codectx_t &ctx, jl_value_t *expr, int ssaval_result)
+     else {
+         if (!jl_is_method(ctx.linfo->def.method) && !ctx.is_opaque_closure) {
+             // TODO: inference is invalid if this has any effect (which it often does)
+-            Value *world = ctx.builder.CreateAlignedLoad(prepare_global_in(jl_Module, jlgetworld_global), Align(sizeof(size_t)));
++            LoadInst *world = ctx.builder.CreateAlignedLoad(T_size,
++                prepare_global_in(jl_Module, jlgetworld_global), Align(sizeof(size_t)));
+             // TODO: world->setOrdering(AtomicOrdering::Monotonic);
+             ctx.builder.CreateAlignedStore(world, ctx.world_age_field, Align(sizeof(size_t)));
+         }
+@@ -4659,7 +4659,7 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaval)
+ 
+             jl_cgval_t world_age = mark_julia_type(ctx,
+                 tbaa_decorate(tbaa_gcframe,
+-                    ctx.builder.CreateAlignedLoad(ctx.world_age_field, Align(sizeof(size_t)))),
++                    ctx.builder.CreateAlignedLoad(T_size, ctx.world_age_field, Align(sizeof(size_t)))),
+                     false,
+                     jl_long_type);
+ 
+@@ -4823,8 +4823,7 @@ static Value *get_current_signal_page(jl_codectx_t &ctx)
+     // return ctx.builder.CreateCall(prepare_call(reuse_signal_page_func));
+     auto ptls = get_current_ptls(ctx);
+     int nthfield = offsetof(jl_tls_states_t, safepoint) / sizeof(void *);
+-    return emit_nthptr_recast(ctx, ptls, nthfield, tbaa_const,
+-                              PointerType::get(T_psize, 0));
++    return emit_nthptr_recast(ctx, ptls, nthfield, tbaa_const, T_psize);
+ }
+ 
+ static Function *emit_tojlinvoke(jl_code_instance_t *codeinst, Module *M, jl_codegen_params_t &params)
+@@ -4927,7 +4926,7 @@ static void emit_cfunc_invalidate(
+         }
+         else {
+             gf_ret = emit_bitcast(ctx, gf_ret, gfrt->getPointerTo());
+-            ctx.builder.CreateRet(ctx.builder.CreateAlignedLoad(gf_ret, Align(julia_alignment(rettype))));
++            ctx.builder.CreateRet(ctx.builder.CreateAlignedLoad(gfrt, gf_ret, Align(julia_alignment(rettype))));
+         }
+         break;
+     }
+@@ -5033,7 +5032,13 @@ static Function* gen_cfun_wrapper(
+         // we are adding the extra nest parameter after sret arg.
+         std::vector<std::pair<unsigned, AttributeSet>> newAttributes;
+         newAttributes.reserve(attributes.getNumAttrSets() + 1);
++#if JL_LLVM_VERSION >= 140000
++        auto it = *attributes.indexes().begin();
++        const auto it_end = *attributes.indexes().end();
++#else
+         auto it = attributes.index_begin();
++        const auto it_end = attributes.index_end();
++#endif
+ 
+         // Skip past FunctionIndex
+         if (it == AttributeList::AttrIndex::FunctionIndex) {
+@@ -5042,7 +5047,7 @@ static Function* gen_cfun_wrapper(
+ 
+         // Move past ReturnValue and parameter return value
+         for (;it < AttributeList::AttrIndex::FirstArgIndex + sig.sret; ++it) {
+-            if (attributes.hasAttributes(it)) {
++            if (hasAttributesAtIndex(attributes, it)) {
+                 newAttributes.emplace_back(it, attributes.getAttributes(it));
+             }
+         }
+@@ -5054,17 +5059,17 @@ static Function* gen_cfun_wrapper(
+ 
+         // Shift forward the rest of the attributes
+         if (attributes.getNumAttrSets() > 0) { // without this check the loop range below is invalid
+-            for(;it < attributes.index_end(); ++it) {
+-                if (attributes.hasAttributes(it)) {
++            for(; it != it_end; ++it) {
++                if (hasAttributesAtIndex(attributes, it)) {
+                     newAttributes.emplace_back(it + 1, attributes.getAttributes(it));
+                 }
+             }
+         }
+ 
+         // Remember to add back FunctionIndex
+-        if (attributes.hasAttributes(AttributeList::AttrIndex::FunctionIndex)) {
++        if (hasAttributesAtIndex(attributes, AttributeList::AttrIndex::FunctionIndex)) {
+             newAttributes.emplace_back(AttributeList::AttrIndex::FunctionIndex,
+-                                       attributes.getAttributes(AttributeList::AttrIndex::FunctionIndex));
++                                       getFnAttrs(attributes));
+         }
+ 
+         // Create the new AttributeList
+@@ -5098,8 +5103,9 @@ static Function* gen_cfun_wrapper(
+     // TODO: in the future, try to initialize a full TLS context here
+     // for now, just use a dummy field to avoid a branch in this function
+     ctx.world_age_field = ctx.builder.CreateSelect(have_tls, ctx.world_age_field, dummy_world);
+-    Value *last_age = tbaa_decorate(tbaa_gcframe, ctx.builder.CreateAlignedLoad(ctx.world_age_field, Align(sizeof(size_t))));
+-    Value *world_v = ctx.builder.CreateAlignedLoad(prepare_global_in(jl_Module, jlgetworld_global), Align(sizeof(size_t)));
++    Value *last_age = tbaa_decorate(tbaa_gcframe, ctx.builder.CreateAlignedLoad(T_size, ctx.world_age_field, Align(sizeof(size_t))));
++    Value *world_v = ctx.builder.CreateAlignedLoad(T_size,
++        prepare_global_in(jl_Module, jlgetworld_global), Align(sizeof(size_t)));
+     // TODO: cast<LoadInst>(world_v)->setOrdering(AtomicOrdering::Monotonic);
+ 
+     Value *age_ok = NULL;
+@@ -5180,7 +5186,7 @@ static Function* gen_cfun_wrapper(
+                 }
+                 else {
+                     val = emit_bitcast(ctx, val, T->getPointerTo());
+-                    val = ctx.builder.CreateAlignedLoad(val, Align(1)); // make no alignment assumption about pointer from C
++                    val = ctx.builder.CreateAlignedLoad(T, val, Align(1)); // make no alignment assumption about pointer from C
+                     inputarg = mark_julia_type(ctx, val, false, jargty);
+                 }
+             }
+@@ -5241,7 +5247,7 @@ static Function* gen_cfun_wrapper(
+                 assert(jl_is_datatype(jargty));
+                 if (sig.byRefList.at(i)) {
+                     assert(cast<PointerType>(val->getType())->getElementType() == sig.fargt[i]);
+-                    val = ctx.builder.CreateAlignedLoad(val, Align(1)); // unknown alignment from C
++                    val = ctx.builder.CreateAlignedLoad(sig.fargt[i], val, Align(1)); // unknown alignment from C
+                 }
+                 else {
+                     bool issigned = jl_signed_type && jl_subtype(jargty_proper, (jl_value_t*)jl_signed_type);
+@@ -5298,7 +5304,7 @@ static Function* gen_cfun_wrapper(
+             else {
+                 assert(theFptr->getFunctionType() == jl_func_sig);
+             }
+-            add_return_attr(theFptr, Attribute::NonNull);
++            addRetAttr(theFptr, Attribute::NonNull);
+             theFptr->addFnAttr(Thunk);
+         }
+         BasicBlock *b_generic, *b_jlcall, *b_after;
+@@ -5721,7 +5727,7 @@ static Function *gen_invoke_wrapper(jl_method_instance_t *lam, jl_value_t *jlret
+         Module *M, jl_codegen_params_t &params)
+ {
+     Function *w = Function::Create(jl_func_sig, GlobalVariable::ExternalLinkage, funcName, M);
+-    add_return_attr(w, Attribute::NonNull);
++    addRetAttr(w, Attribute::NonNull);
+     w->addFnAttr(Thunk);
+     jl_init_function(w);
+     Function::arg_iterator AI = w->arg_begin();
+@@ -5795,7 +5801,7 @@ static Function *gen_invoke_wrapper(jl_method_instance_t *lam, jl_value_t *jlret
+         if (!isboxed) {
+             theArg = decay_derived(ctx, emit_bitcast(ctx, theArg, PointerType::get(lty, 0)));
+             if (!lty->isAggregateType()) // keep "aggregate" type values in place as pointers
+-                theArg = ctx.builder.CreateAlignedLoad(theArg, Align(julia_alignment(ty)));
++                theArg = ctx.builder.CreateAlignedLoad(lty, theArg, Align(julia_alignment(ty)));
+         }
+         assert(dyn_cast<UndefValue>(theArg) == NULL);
+         args[idx] = theArg;
+@@ -5905,22 +5911,22 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
+         (void)srt; // silence unused variable error
+ #else
+         Attribute sret = Attribute::getWithStructRetType(jl_LLVMContext, srt);
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, sret);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, sret);
+ #endif
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoAlias);
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoCapture);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoAlias);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoCapture);
+     }
+     if (props.cc == jl_returninfo_t::Union) {
+         unsigned argno = 1;
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoAlias);
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoCapture);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoAlias);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoCapture);
+     }
+ 
+     if (props.return_roots) {
+         fsig.push_back(ArrayType::get(T_prjlvalue, props.return_roots)->getPointerTo(0));
+         unsigned argno = fsig.size();
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoAlias);
+-        attributes = attributes.addAttribute(jl_LLVMContext, argno, Attribute::NoCapture);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoAlias);
++        attributes = addAttributeAtIndex(attributes, jl_LLVMContext, argno, Attribute::NoCapture);
+     }
+ 
+     for (size_t i = 0; i < jl_nparams(sig); i++) {
+@@ -5962,7 +5968,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, String
+         assert(f->getFunctionType() == ftype);
+     }
+     if (rt == T_prjlvalue)
+-        add_return_attr(f, Attribute::NonNull);
++        addRetAttr(f, Attribute::NonNull);
+     props.decl = f;
+     return props;
+ }
+@@ -6210,7 +6216,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
+                              GlobalVariable::ExternalLinkage,
+                              declarations.specFunctionObject, M);
+         jl_init_function(f);
+-        add_return_attr(f, Attribute::NonNull);
++        addRetAttr(f, Attribute::NonNull);
+         f->addFnAttr(Thunk);
+         // TODO: (if needsparams) add attributes: dereferenceable<sizeof(void*) * length(sp)>, readonly, nocapture
+         // TODO: add attributes: dereferenceable<sizeof(ft)>, readonly, nocapture - e.g. maybe_mark_argument_dereferenceable(Arg, argType);
+@@ -6233,8 +6239,8 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
+     }
+ 
+     if (returninfo.cc == jl_returninfo_t::Union) {
+-        f->addAttribute(1, Attribute::getWithDereferenceableBytes(jl_LLVMContext, returninfo.union_bytes));
+-        f->addAttribute(1, Attribute::getWithAlignment(jl_LLVMContext, Align(returninfo.union_align)));
++        addAttributeAtIndex(f, 1, Attribute::getWithDereferenceableBytes(jl_LLVMContext, returninfo.union_bytes));
++        addAttributeAtIndex(f, 1, Attribute::getWithAlignment(jl_LLVMContext, Align(returninfo.union_align)));
+     }
+ 
+ #ifdef JL_DEBUG_BUILD
+@@ -6388,7 +6394,8 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
+     Value *last_age = NULL;
+     emit_last_age_field(ctx);
+     if (toplevel || ctx.is_opaque_closure) {
+-        last_age = tbaa_decorate(tbaa_gcframe, ctx.builder.CreateAlignedLoad(ctx.world_age_field, Align(sizeof(size_t))));
++        last_age = tbaa_decorate(tbaa_gcframe, ctx.builder.CreateAlignedLoad(
++            T_size, ctx.world_age_field, Align(sizeof(size_t))));
+     }
+ 
+     // step 7. allocate local variables slots
+diff --git a/src/codegen_shared.h b/src/codegen_shared.h
+index 883d804a20911..906443cd43fe6 100644
+--- a/src/codegen_shared.h
++++ b/src/codegen_shared.h
+@@ -133,13 +133,14 @@ static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder
+ {
+     using namespace llvm;
+     auto T_ppjlvalue = JuliaType::get_ppjlvalue_ty(builder.getContext());
++    auto T_pjlvalue = JuliaType::get_pjlvalue_ty(builder.getContext());
+     auto T_size = builder.GetInsertBlock()->getModule()->getDataLayout().getIntPtrType(builder.getContext());
+     const int ptls_offset = offsetof(jl_task_t, ptls);
+     llvm::Value *pptls = builder.CreateInBoundsGEP(
+-        JuliaType::get_pjlvalue_ty(builder.getContext()), current_task,
++        T_pjlvalue, current_task,
+         ConstantInt::get(T_size, ptls_offset / sizeof(void *)),
+         "ptls_field");
+-    LoadInst *ptls_load = builder.CreateAlignedLoad(
++    LoadInst *ptls_load = builder.CreateAlignedLoad(T_pjlvalue,
+         emit_bitcast_with_builder(builder, pptls, T_ppjlvalue), Align(sizeof(void *)), "ptls_load");
+     // Note: Corresponding store (`t->ptls = ptls`) happens in `ctx_switch` of tasks.c.
+     tbaa_decorate(tbaa, ptls_load);
+@@ -148,3 +149,126 @@ static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder
+     builder.Insert(ptls);
+     return ptls;
+ }
++
++// Compatibility shims for LLVM attribute APIs that were renamed in LLVM 14.
++//
++// Once we no longer support LLVM < 14, these can be mechanically removed by
++// translating foo(Bar, …) into Bar->foo(…) resp. Bar.foo(…).
++namespace {
++using namespace llvm;
++
++inline void addFnAttr(CallInst *Target, Attribute::AttrKind Attr)
++{
++#if JL_LLVM_VERSION >= 140000
++    Target->addFnAttr(Attr);
++#else
++    Target->addAttribute(AttributeList::FunctionIndex, Attr);
++#endif
++}
++
++template<class T, class A>
++inline void addRetAttr(T *Target, A Attr)
++{
++#if JL_LLVM_VERSION >= 140000
++    Target->addRetAttr(Attr);
++#else
++    Target->addAttribute(AttributeList::ReturnIndex, Attr);
++#endif
++}
++
++inline void addAttributeAtIndex(Function *F, unsigned Index, Attribute Attr)
++{
++#if JL_LLVM_VERSION >= 140000
++    F->addAttributeAtIndex(Index, Attr);
++#else
++    F->addAttribute(Index, Attr);
++#endif
++}
++
++inline AttributeSet getFnAttrs(const AttributeList &Attrs)
++{
++#if JL_LLVM_VERSION >= 140000
++    return Attrs.getFnAttrs();
++#else
++    return Attrs.getFnAttributes();
++#endif
++}
++
++inline AttributeSet getRetAttrs(const AttributeList &Attrs)
++{
++#if JL_LLVM_VERSION >= 140000
++    return Attrs.getRetAttrs();
++#else
++    return Attrs.getRetAttributes();
++#endif
++}
++
++inline bool hasFnAttr(const AttributeList &L, Attribute::AttrKind Kind)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.hasFnAttr(Kind);
++#else
++    return L.hasAttribute(AttributeList::FunctionIndex, Kind);
++#endif
++}
++
++inline AttributeList addAttributeAtIndex(const AttributeList &L, LLVMContext &C,
++                                         unsigned Index, Attribute::AttrKind Kind)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.addAttributeAtIndex(C, Index, Kind);
++#else
++    return L.addAttribute(C, Index, Kind);
++#endif
++}
++
++inline AttributeList addAttributeAtIndex(const AttributeList &L, LLVMContext &C,
++                                         unsigned Index, Attribute Attr)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.addAttributeAtIndex(C, Index, Attr);
++#else
++    return L.addAttribute(C, Index, Attr);
++#endif
++}
++
++inline AttributeList addAttributesAtIndex(const AttributeList &L, LLVMContext &C,
++                                          unsigned Index, const AttrBuilder &Builder)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.addAttributesAtIndex(C, Index, Builder);
++#else
++    return L.addAttributes(C, Index, Builder);
++#endif
++}
++
++inline AttributeList addFnAttribute(const AttributeList &L, LLVMContext &C,
++                                    Attribute::AttrKind Kind)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.addFnAttribute(C, Kind);
++#else
++    return L.addAttribute(C, AttributeList::FunctionIndex, Kind);
++#endif
++}
++
++inline AttributeList addRetAttribute(const AttributeList &L, LLVMContext &C,
++                                     Attribute::AttrKind Kind)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.addRetAttribute(C, Kind);
++#else
++    return L.addAttribute(C, AttributeList::ReturnIndex, Kind);
++#endif
++}
++
++inline bool hasAttributesAtIndex(const AttributeList &L, unsigned Index)
++{
++#if JL_LLVM_VERSION >= 140000
++    return L.hasAttributesAtIndex(Index);
++#else
++    return L.hasAttributes(Index);
++#endif
++}
++
++}
+diff --git a/src/disasm.cpp b/src/disasm.cpp
+index 25e7841bde85a..35918fb204908 100644
+--- a/src/disasm.cpp
++++ b/src/disasm.cpp
+@@ -92,7 +92,11 @@
+ #include <llvm/Support/MemoryBuffer.h>
+ #include <llvm/Support/NativeFormatting.h>
+ #include <llvm/Support/SourceMgr.h>
++#if JL_LLVM_VERSION >= 140000
++#include <llvm/MC/TargetRegistry.h>
++#else
+ #include <llvm/Support/TargetRegistry.h>
++#endif
+ #include <llvm/Support/TargetSelect.h>
+ #include <llvm/Support/raw_ostream.h>
+ 
+@@ -912,7 +916,11 @@ static void jl_dump_asm_internal(
+                                          IP.release(),
+                                          std::move(CE), std::move(MAB),
+                                          /*ShowInst*/ false));
++#if JL_LLVM_VERSION >= 140000
++    Streamer->initSections(true, *STI);
++#else
+     Streamer->InitSections(true);
++#endif
+ 
+     // Make the MemoryObject wrapper
+     ArrayRef<uint8_t> memoryObject(const_cast<uint8_t*>((const uint8_t*)Fptr),Fsize);
+diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp
+index 6fe51cc8b6b22..7ed02818c3ee4 100644
+--- a/src/intrinsics.cpp
++++ b/src/intrinsics.cpp
+@@ -400,12 +400,12 @@ static Value *emit_unbox(jl_codectx_t &ctx, Type *to, const jl_cgval_t &x, jl_va
+                     (AllocType->isFloatingPointTy() || AllocType->isIntegerTy() || AllocType->isPointerTy()) &&
+                     (to->isFloatingPointTy() || to->isIntegerTy() || to->isPointerTy()) &&
+                     DL.getTypeSizeInBits(AllocType) == DL.getTypeSizeInBits(to)) {
+-                Instruction *load = ctx.builder.CreateAlignedLoad(p, Align(alignment));
++                Instruction *load = ctx.builder.CreateAlignedLoad(AllocType, p, Align(alignment));
+                 return emit_unboxed_coercion(ctx, to, tbaa_decorate(x.tbaa, load));
+             }
+         }
+         p = maybe_bitcast(ctx, p, ptype);
+-        Instruction *load = ctx.builder.CreateAlignedLoad(p, Align(alignment));
++        Instruction *load = ctx.builder.CreateAlignedLoad(to, p, Align(alignment));
+         return tbaa_decorate(x.tbaa, load);
+     }
+ }
+@@ -489,9 +489,11 @@ static jl_cgval_t generic_bitcast(jl_codectx_t &ctx, const jl_cgval_t *argv)
+         // but if the v.typ is not well known, use llvmt
+         if (isboxed)
+             vxt = llvmt;
++        auto storage_type = vxt == T_int1 ? T_int8 : vxt;
+         vx = tbaa_decorate(v.tbaa, ctx.builder.CreateLoad(
+-                    emit_bitcast(ctx, data_pointer(ctx, v),
+-                        vxt == T_int1 ? T_pint8 : vxt->getPointerTo())));
++            storage_type,
++            emit_bitcast(ctx, data_pointer(ctx, v),
++                storage_type->getPointerTo())));
+     }
+ 
+     vxt = vx->getType();
+@@ -595,7 +597,7 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv)
+ 
+     if (ety == (jl_value_t*)jl_any_type) {
+         Value *thePtr = emit_unbox(ctx, T_pprjlvalue, e, e.typ);
+-        LoadInst *load = ctx.builder.CreateAlignedLoad(ctx.builder.CreateInBoundsGEP(T_prjlvalue, thePtr, im1), Align(align_nb));
++        LoadInst *load = ctx.builder.CreateAlignedLoad(T_prjlvalue, ctx.builder.CreateInBoundsGEP(T_prjlvalue, thePtr, im1), Align(align_nb));
+         tbaa_decorate(tbaa_data, load);
+         return mark_julia_type(ctx, load, true, ety);
+     }
+@@ -726,7 +728,7 @@ static jl_cgval_t emit_atomic_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv)
+ 
+     if (ety == (jl_value_t*)jl_any_type) {
+         Value *thePtr = emit_unbox(ctx, T_pprjlvalue, e, e.typ);
+-        LoadInst *load = ctx.builder.CreateAlignedLoad(thePtr, Align(sizeof(jl_value_t*)));
++        LoadInst *load = ctx.builder.CreateAlignedLoad(T_prjlvalue, thePtr, Align(sizeof(jl_value_t*)));
+         tbaa_decorate(tbaa_data, load);
+         load->setOrdering(llvm_order);
+         return mark_julia_type(ctx, load, true, ety);
+diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
+index 3412f596ef4b7..f4acad8b56cad 100644
+--- a/src/jitlayers.cpp
++++ b/src/jitlayers.cpp
+@@ -16,7 +16,11 @@
+ #include <llvm/Support/DynamicLibrary.h>
+ #include <llvm/Support/FormattedStream.h>
+ #include <llvm/Support/SmallVectorMemoryBuffer.h>
++#if JL_LLVM_VERSION >= 140000
++#include <llvm/MC/TargetRegistry.h>
++#else
+ #include <llvm/Support/TargetRegistry.h>
++#endif
+ #include <llvm/Support/raw_ostream.h>
+ #include <llvm/Target/TargetMachine.h>
+ #include <llvm/Transforms/Utils/Cloning.h>
+@@ -578,7 +582,7 @@ CompilerResultT JuliaOJIT::CompilerT::operator()(Module &M)
+         raw_string_ostream OS(Buf);
+         logAllUnhandledErrors(Obj.takeError(), OS, "");
+         OS.flush();
+-        llvm::report_fatal_error("FATAL: Unable to compile LLVM Module: '" + Buf + "'\n"
++        llvm::report_fatal_error(llvm::Twine("FATAL: Unable to compile LLVM Module: '") + Buf + "'\n"
+                                  "The module's content was printed above. Please file a bug report");
+     }
+ 
+@@ -647,7 +651,7 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM, LLVMContext *LLVMCtx)
+     // tells DynamicLibrary to load the program, not a library.
+     std::string ErrorStr;
+     if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr, &ErrorStr))
+-        report_fatal_error("FATAL: unable to dlopen self\n" + ErrorStr);
++        report_fatal_error(llvm::Twine("FATAL: unable to dlopen self\n") + ErrorStr);
+ 
+     GlobalJD.addGenerator(
+       cantFail(orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(
+diff --git a/src/llvm-alloc-opt.cpp b/src/llvm-alloc-opt.cpp
+index d67c6ba0ee28c..09b6502f59652 100644
+--- a/src/llvm-alloc-opt.cpp
++++ b/src/llvm-alloc-opt.cpp
+@@ -44,7 +44,7 @@ static void removeGCPreserve(CallInst *call, Instruction *val)
+ {
+     auto replace = Constant::getNullValue(val->getType());
+     call->replaceUsesOfWith(val, replace);
+-    for (auto &arg: call->arg_operands()) {
++    for (auto &arg: call->args()) {
+         if (!isa<Constant>(arg.get())) {
+             return;
+         }
+@@ -416,7 +416,7 @@ ssize_t Optimizer::getGCAllocSize(Instruction *I)
+         return -1;
+     if (call->getCalledOperand() != pass.alloc_obj_func)
+         return -1;
+-    assert(call->getNumArgOperands() == 3);
++    assert(call->arg_size() == 3);
+     size_t sz = (size_t)cast<ConstantInt>(call->getArgOperand(1))->getZExtValue();
+     if (sz < IntegerType::MAX_INT_BITS / 8 && sz < INT32_MAX)
+         return sz;
+@@ -571,7 +571,7 @@ void Optimizer::checkInst(Instruction *I)
+             if (auto II = dyn_cast<IntrinsicInst>(call)) {
+                 if (auto id = II->getIntrinsicID()) {
+                     if (id == Intrinsic::memset) {
+-                        assert(call->getNumArgOperands() == 4);
++                        assert(call->arg_size() == 4);
+                         if (cur.offset == UINT32_MAX ||
+                             !isa<ConstantInt>(call->getArgOperand(2)) ||
+                             !isa<ConstantInt>(call->getArgOperand(1)) ||
+@@ -870,7 +870,7 @@ void Optimizer::insertLifetime(Value *ptr, Constant *sz, Instruction *orig)
+ void Optimizer::replaceIntrinsicUseWith(IntrinsicInst *call, Intrinsic::ID ID,
+                                         Instruction *orig_i, Instruction *new_i)
+ {
+-    auto nargs = call->getNumArgOperands();
++    auto nargs = call->arg_size();
+     SmallVector<Value*, 8> args(nargs);
+     SmallVector<Type*, 8> argTys(nargs);
+     for (unsigned i = 0; i < nargs; i++) {
+@@ -904,8 +904,8 @@ void Optimizer::replaceIntrinsicUseWith(IntrinsicInst *call, Intrinsic::ID ID,
+     auto newCall = CallInst::Create(newF, args, "", call);
+     newCall->setTailCallKind(call->getTailCallKind());
+     auto old_attrs = call->getAttributes();
+-    newCall->setAttributes(AttributeList::get(pass.getLLVMContext(), old_attrs.getFnAttributes(),
+-                                              old_attrs.getRetAttributes(), {}));
++    newCall->setAttributes(AttributeList::get(pass.getLLVMContext(), getFnAttrs(old_attrs),
++                                              getRetAttrs(old_attrs), {}));
+     newCall->setDebugLoc(call->getDebugLoc());
+     call->replaceAllUsesWith(newCall);
+     call->eraseFromParent();
+@@ -1422,7 +1422,7 @@ void Optimizer::splitOnStack(CallInst *orig_inst)
+             }
+             if (pass.gc_preserve_begin_func == callee) {
+                 SmallVector<Value*,8> operands;
+-                for (auto &arg: call->arg_operands()) {
++                for (auto &arg: call->args()) {
+                     if (arg.get() == orig_i || isa<Constant>(arg.get()))
+                         continue;
+                     operands.push_back(arg.get());
+diff --git a/src/llvm-final-gc-lowering.cpp b/src/llvm-final-gc-lowering.cpp
+index c55095daab300..2f1ae2be32080 100644
+--- a/src/llvm-final-gc-lowering.cpp
++++ b/src/llvm-final-gc-lowering.cpp
+@@ -64,7 +64,7 @@ struct FinalLowerGC: public FunctionPass, private JuliaPassContext {
+ 
+ Value *FinalLowerGC::lowerNewGCFrame(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 1);
++    assert(target->arg_size() == 1);
+     unsigned nRoots = cast<ConstantInt>(target->getArgOperand(0))->getLimitedValue(INT_MAX);
+ 
+     // Create the GC frame.
+@@ -96,7 +96,7 @@ Value *FinalLowerGC::lowerNewGCFrame(CallInst *target, Function &F)
+ 
+ void FinalLowerGC::lowerPushGCFrame(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 2);
++    assert(target->arg_size() == 2);
+     auto gcframe = target->getArgOperand(0);
+     unsigned nRoots = cast<ConstantInt>(target->getArgOperand(1))->getLimitedValue(INT_MAX);
+ 
+@@ -110,7 +110,7 @@ void FinalLowerGC::lowerPushGCFrame(CallInst *target, Function &F)
+                 Align(sizeof(void*)));
+     inst->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe);
+     inst = builder.CreateAlignedStore(
+-            builder.CreateAlignedLoad(pgcstack, Align(sizeof(void*))),
++            builder.CreateAlignedLoad(T_ppjlvalue, pgcstack, Align(sizeof(void*))),
+             builder.CreatePointerCast(
+                     builder.CreateConstInBoundsGEP1_32(T_prjlvalue, gcframe, 1),
+                     PointerType::get(T_ppjlvalue, 0)),
+@@ -124,14 +124,14 @@ void FinalLowerGC::lowerPushGCFrame(CallInst *target, Function &F)
+ 
+ void FinalLowerGC::lowerPopGCFrame(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 1);
++    assert(target->arg_size() == 1);
+     auto gcframe = target->getArgOperand(0);
+ 
+     IRBuilder<> builder(target->getContext());
+     builder.SetInsertPoint(target);
+     Instruction *gcpop =
+         cast<Instruction>(builder.CreateConstInBoundsGEP1_32(T_prjlvalue, gcframe, 1));
+-    Instruction *inst = builder.CreateAlignedLoad(gcpop, Align(sizeof(void*)));
++    Instruction *inst = builder.CreateAlignedLoad(T_prjlvalue, gcpop, Align(sizeof(void*)));
+     inst->setMetadata(LLVMContext::MD_tbaa, tbaa_gcframe);
+     inst = builder.CreateAlignedStore(
+         inst,
+@@ -143,7 +143,7 @@ void FinalLowerGC::lowerPopGCFrame(CallInst *target, Function &F)
+ 
+ Value *FinalLowerGC::lowerGetGCFrameSlot(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 2);
++    assert(target->arg_size() == 2);
+     auto gcframe = target->getArgOperand(0);
+     auto index = target->getArgOperand(1);
+ 
+@@ -162,14 +162,14 @@ Value *FinalLowerGC::lowerGetGCFrameSlot(CallInst *target, Function &F)
+ 
+ Value *FinalLowerGC::lowerQueueGCRoot(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 1);
++    assert(target->arg_size() == 1);
+     target->setCalledFunction(queueRootFunc);
+     return target;
+ }
+ 
+ Value *FinalLowerGC::lowerGCAllocBytes(CallInst *target, Function &F)
+ {
+-    assert(target->getNumArgOperands() == 2);
++    assert(target->arg_size() == 2);
+     auto sz = (size_t)cast<ConstantInt>(target->getArgOperand(1))->getZExtValue();
+     // This is strongly architecture and OS dependent
+     int osize;
+diff --git a/src/llvm-gc-invariant-verifier.cpp b/src/llvm-gc-invariant-verifier.cpp
+index bfdca51603890..4302f9021ec2c 100644
+--- a/src/llvm-gc-invariant-verifier.cpp
++++ b/src/llvm-gc-invariant-verifier.cpp
+@@ -168,7 +168,7 @@ void GCInvariantVerifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
+ void GCInvariantVerifier::visitCallInst(CallInst &CI) {
+     CallingConv::ID CC = CI.getCallingConv();
+     if (CC == JLCALL_F_CC || CC == JLCALL_F2_CC) {
+-        for (Value *Arg : CI.arg_operands()) {
++        for (Value *Arg : CI.args()) {
+             Type *Ty = Arg->getType();
+             Check(Ty->isPointerTy() && cast<PointerType>(Ty)->getAddressSpace() == AddressSpace::Tracked,
+                 "Invalid derived pointer in jlcall", &CI);
+diff --git a/src/llvm-julia-licm.cpp b/src/llvm-julia-licm.cpp
+index 91bdea4fea557..fa0e2e38b40a9 100644
+--- a/src/llvm-julia-licm.cpp
++++ b/src/llvm-julia-licm.cpp
+@@ -81,7 +81,7 @@ struct JuliaLICMPass : public LoopPass, public JuliaPassContext {
+                 // corresponding `end` can be moved to the loop exit.
+                 if (callee == gc_preserve_begin_func) {
+                     bool canhoist = true;
+-                    for (Use &U : call->arg_operands()) {
++                    for (Use &U : call->args()) {
+                         // Check if all arguments are generated outside the loop
+                         auto origin = dyn_cast<Instruction>(U.get());
+                         if (!origin)
+diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
+index e8fdb24138de8..2842b964a45a7 100644
+--- a/src/llvm-late-gc-lowering.cpp
++++ b/src/llvm-late-gc-lowering.cpp
+@@ -1521,7 +1521,7 @@ State LateLowerGCFrame::LocalScan(Function &F) {
+                 if (callee) {
+                     if (callee == gc_preserve_begin_func) {
+                         std::vector<int> args;
+-                        for (Use &U : CI->arg_operands()) {
++                        for (Use &U : CI->args()) {
+                             Value *V = U;
+                             if (isa<Constant>(V))
+                                 continue;
+@@ -1566,7 +1566,7 @@ State LateLowerGCFrame::LocalScan(Function &F) {
+                     continue;
+                 }
+                 std::vector<int> CalleeRoots;
+-                for (Use &U : CI->arg_operands()) {
++                for (Use &U : CI->args()) {
+                     // Find all callee rooted arguments.
+                     // Record them instead of simply remove them from live values here
+                     // since they can be useful during refinement
+@@ -2273,7 +2273,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+                 CI->replaceAllUsesWith(ASCI);
+                 UpdatePtrNumbering(CI, ASCI, S);
+             } else if (alloc_obj_func && callee == alloc_obj_func) {
+-                assert(CI->getNumArgOperands() == 3);
++                assert(CI->arg_size() == 3);
+ 
+                 // Initialize an IR builder.
+                 IRBuilder<> builder(CI);
+@@ -2346,7 +2346,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+                 // Update the pointer numbering.
+                 UpdatePtrNumbering(CI, newI, S);
+             } else if (typeof_func && callee == typeof_func) {
+-                assert(CI->getNumArgOperands() == 1);
++                assert(CI->arg_size() == 1);
+                 IRBuilder<> builder(CI);
+                 builder.SetCurrentDebugLocation(CI->getDebugLoc());
+                 auto tag = EmitLoadTag(builder, CI->getArgOperand(0));
+@@ -2359,7 +2359,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+             } else if (write_barrier_func && callee == write_barrier_func) {
+                 // The replacement for this requires creating new BasicBlocks
+                 // which messes up the loop. Queue all of them to be replaced later.
+-                assert(CI->getNumArgOperands() >= 1);
++                assert(CI->arg_size() >= 1);
+                 write_barriers.push_back(CI);
+                 ChangesMade = true;
+                 ++it;
+@@ -2367,7 +2367,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+             } else if (CC == JLCALL_F_CC ||
+                        CC == JLCALL_F2_CC) {
+                 assert(T_prjlvalue);
+-                size_t nargs = CI->getNumArgOperands();
++                size_t nargs = CI->arg_size();
+                 size_t nframeargs = nargs;
+                 if (CC == JLCALL_F_CC)
+                     nframeargs -= 1;
+@@ -2409,12 +2409,12 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+                 NewCall->setTailCallKind(CI->getTailCallKind());
+                 auto old_attrs = CI->getAttributes();
+                 NewCall->setAttributes(AttributeList::get(CI->getContext(),
+-                                                          old_attrs.getFnAttributes(),
+-                                                          old_attrs.getRetAttributes(), {}));
++                                                          getFnAttrs(old_attrs),
++                                                          getRetAttrs(old_attrs), {}));
+                 NewCall->copyMetadata(*CI);
+                 CI->replaceAllUsesWith(NewCall);
+                 UpdatePtrNumbering(CI, NewCall, S);
+-            } else if (CI->getNumArgOperands() == CI->getNumOperands()) {
++            } else if (CI->arg_size() == CI->getNumOperands()) {
+                 /* No operand bundle to lower */
+                 ++it;
+                 continue;
+@@ -2447,7 +2447,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+         auto mayTrigTerm = SplitBlockAndInsertIfThen(parOldMarked, CI, false);
+         builder.SetInsertPoint(mayTrigTerm);
+         Value *anyChldNotMarked = NULL;
+-        for (unsigned i = 1; i < CI->getNumArgOperands(); i++) {
++        for (unsigned i = 1; i < CI->arg_size(); i++) {
+             Value *child = CI->getArgOperand(i);
+             Value *chldBit = builder.CreateAnd(EmitLoadTag(builder, child), 1);
+             Value *chldNotMarked = builder.CreateICmpEQ(chldBit, ConstantInt::get(T_size, 0));
+diff --git a/src/llvm-pass-helpers.cpp b/src/llvm-pass-helpers.cpp
+index f6708ef65ab77..54f1420e3ae36 100644
+--- a/src/llvm-pass-helpers.cpp
++++ b/src/llvm-pass-helpers.cpp
+@@ -129,8 +129,8 @@ namespace jl_intrinsics {
+     // The allocation size is set to the first argument.
+     static Function *addGCAllocAttributes(Function *target, LLVMContext &context)
+     {
+-        target->addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias);
+-        target->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull);
++        addRetAttr(target, Attribute::NoAlias);
++        addRetAttr(target, Attribute::NonNull);
+         target->addFnAttr(Attribute::getWithAllocSizeArgs(context, 1, None)); // returns %1 bytes
+         return target;
+     }
+@@ -168,8 +168,8 @@ namespace jl_intrinsics {
+                 FunctionType::get(PointerType::get(context.T_prjlvalue, 0), {context.T_int32}, false),
+                 Function::ExternalLinkage,
+                 NEW_GC_FRAME_NAME);
+-            intrinsic->addAttribute(AttributeList::ReturnIndex, Attribute::NoAlias);
+-            intrinsic->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull);
++            addRetAttr(intrinsic, Attribute::NoAlias);
++            addRetAttr(intrinsic, Attribute::NonNull);
+ 
+             return intrinsic;
+         });
+diff --git a/src/llvm-ptls.cpp b/src/llvm-ptls.cpp
+index a573d41dae326..6f46af98d2ee4 100644
+--- a/src/llvm-ptls.cpp
++++ b/src/llvm-ptls.cpp
+@@ -67,8 +67,8 @@ struct LowerPTLS: public ModulePass {
+ 
+ void LowerPTLS::set_pgcstack_attrs(CallInst *pgcstack) const
+ {
+-    pgcstack->addAttribute(AttributeList::FunctionIndex, Attribute::ReadNone);
+-    pgcstack->addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind);
++    addFnAttr(pgcstack, Attribute::ReadNone);
++    addFnAttr(pgcstack, Attribute::NoUnwind);
+ }
+ 
+ Instruction *LowerPTLS::emit_pgcstack_tp(Value *offset, Instruction *insertBefore) const
+diff --git a/src/llvm-remove-addrspaces.cpp b/src/llvm-remove-addrspaces.cpp
+index 6908783288940..9b3631e264124 100644
+--- a/src/llvm-remove-addrspaces.cpp
++++ b/src/llvm-remove-addrspaces.cpp
+@@ -394,9 +394,19 @@ bool RemoveAddrspacesPass::runOnModule(Module &M)
+         for (unsigned i = 0; i < Attrs.getNumAttrSets(); ++i) {
+             for (Attribute::AttrKind TypedAttr :
+                  {Attribute::ByVal, Attribute::StructRet, Attribute::ByRef}) {
+-                if (Type *Ty = Attrs.getAttribute(i, TypedAttr).getValueAsType()) {
+-                    Attrs = Attrs.replaceAttributeType(C, i, TypedAttr,
+-                                                       TypeRemapper.remapType(Ty));
++#if JL_LLVM_VERSION >= 140000
++                auto Attr = Attrs.getAttributeAtIndex(i, TypedAttr);
++#else
++                auto Attr = Attrs.getAttribute(i, TypedAttr);
++#endif
++                if (Type *Ty = Attr.getValueAsType()) {
++#if JL_LLVM_VERSION >= 140000
++                    Attrs = Attrs.replaceAttributeTypeAtIndex(
++                        C, i, TypedAttr, TypeRemapper.remapType(Ty));
++#else
++                    Attrs = Attrs.replaceAttributeType(
++                        C, i, TypedAttr, TypeRemapper.remapType(Ty));
++#endif
+                     break;
+                 }
+             }

Copied: julia/repos/community-staging-x86_64/63303980.patch (from rev 1238980, julia/trunk/63303980.patch)
===================================================================
--- community-staging-x86_64/63303980.patch	                        (rev 0)
+++ community-staging-x86_64/63303980.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,683 @@
+From 111d0c8f78266a1ee7fa4ca2b4025748fc8d3dca Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Tue, 12 Oct 2021 11:56:19 -0400
+Subject: [PATCH 1/9] Add Type to ByVal attribute
+
+---
+ src/abi_aarch64.cpp |  2 +-
+ src/abi_arm.cpp     |  2 +-
+ src/abi_llvm.cpp    |  2 +-
+ src/abi_ppc64le.cpp |  6 +++++-
+ src/abi_win32.cpp   |  6 +++++-
+ src/abi_win64.cpp   |  9 +++++++--
+ src/abi_x86.cpp     |  8 ++++++--
+ src/abi_x86_64.cpp  | 11 ++++++++++-
+ src/ccall.cpp       |  4 ++--
+ 9 files changed, 38 insertions(+), 12 deletions(-)
+
+diff --git a/src/abi_aarch64.cpp b/src/abi_aarch64.cpp
+index 3e6b995f07b1..1a3f160329c6 100644
+--- a/src/abi_aarch64.cpp
++++ b/src/abi_aarch64.cpp
+@@ -187,7 +187,7 @@ Type *isHFAorHVA(jl_datatype_t *dt, size_t &nele, LLVMContext &ctx) const
+     return NULL;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     // B.2
+     //   If the argument type is an HFA or an HVA, then the argument is used
+diff --git a/src/abi_arm.cpp b/src/abi_arm.cpp
+index 032943abd45f..4987d07657ae 100644
+--- a/src/abi_arm.cpp
++++ b/src/abi_arm.cpp
+@@ -23,7 +23,7 @@
+ 
+ struct ABI_ARMLayout : AbiLayout {
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &abi, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &abi, LLVMContext &ctx, Type *Ty) override
+ {
+     return false;
+ }
+diff --git a/src/abi_llvm.cpp b/src/abi_llvm.cpp
+index f21edeadee03..181b05ef7997 100644
+--- a/src/abi_llvm.cpp
++++ b/src/abi_llvm.cpp
+@@ -45,7 +45,7 @@ bool use_sret(jl_datatype_t *ty, LLVMContext &ctx) override
+     return false;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     return false;
+ }
+diff --git a/src/abi_ppc64le.cpp b/src/abi_ppc64le.cpp
+index da1d8484a082..a35223c8dde3 100644
+--- a/src/abi_ppc64le.cpp
++++ b/src/abi_ppc64le.cpp
+@@ -101,12 +101,16 @@ bool use_sret(jl_datatype_t *dt, LLVMContext &ctx) override
+     return false;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     jl_datatype_t *ty0 = NULL;
+     bool hva = false;
+     if (jl_datatype_size(dt) > 64 && isHFA(dt, &ty0, &hva) > 8) {
++#if JL_LLVM_VERSION < 120000
+         ab.addAttribute(Attribute::ByVal);
++#else
++        ab.addByValAttr(Ty);
++#endif
+         return true;
+     }
+     return false;
+diff --git a/src/abi_win32.cpp b/src/abi_win32.cpp
+index a25fcaec9b82..fa1cfe222542 100644
+--- a/src/abi_win32.cpp
++++ b/src/abi_win32.cpp
+@@ -49,11 +49,15 @@ bool use_sret(jl_datatype_t *dt, LLVMContext &ctx) override
+     return true;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     // Use pass by reference for all structs
+     if (dt->layout->nfields > 0) {
++#if JL_LLVM_VERSION < 120000
+         ab.addAttribute(Attribute::ByVal);
++#else
++        ab.addByValAttr(Ty);
++#endif
+         return true;
+     }
+     return false;
+diff --git a/src/abi_win64.cpp b/src/abi_win64.cpp
+index 6f6d407cfc10..c87e3434f1c1 100644
+--- a/src/abi_win64.cpp
++++ b/src/abi_win64.cpp
+@@ -56,14 +56,19 @@ bool use_sret(jl_datatype_t *dt, LLVMContext &ctx) override
+     return true;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     nargs++;
+     size_t size = jl_datatype_size(dt);
+     if (win64_reg_size(size))
+         return false;
+-    if (nargs <= 4)
++    if (nargs <= 4) {
++#if JL_LLVM_VERSION < 120000
+         ab.addAttribute(Attribute::ByVal);
++#else
++        ab.addByValAttr(Ty);
++#endif
++    }
+     return true;
+ }
+ 
+diff --git a/src/abi_x86.cpp b/src/abi_x86.cpp
+index c68e657695f3..3c4617c5a3c1 100644
+--- a/src/abi_x86.cpp
++++ b/src/abi_x86.cpp
+@@ -67,12 +67,16 @@ bool use_sret(jl_datatype_t *dt, LLVMContext &ctx) override
+     return true;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     size_t size = jl_datatype_size(dt);
+     if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8))
+         return false;
+-    ab.addAttribute(Attribute::ByVal);
++#if JL_LLVM_VERSION < 120000
++        ab.addAttribute(Attribute::ByVal);
++#else
++        ab.addByValAttr(Ty);
++#endif
+     return true;
+ }
+ 
+diff --git a/src/abi_x86_64.cpp b/src/abi_x86_64.cpp
+index 898e98dfcc26..e5beffce39b0 100644
+--- a/src/abi_x86_64.cpp
++++ b/src/abi_x86_64.cpp
+@@ -178,11 +178,15 @@ bool use_sret(jl_datatype_t *dt, LLVMContext &ctx) override
+     return sret;
+ }
+ 
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx, Type *Ty) override
+ {
+     Classification cl = classify(dt);
+     if (cl.isMemory) {
++#if JL_LLVM_VERSION < 120000
+         ab.addAttribute(Attribute::ByVal);
++#else
++        ab.addByValAttr(Ty);
++#endif
+         return true;
+     }
+ 
+@@ -202,7 +206,12 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, LLVMContext &ctx) overrid
+     else if (jl_is_structtype(dt)) {
+         // spill to memory even though we would ordinarily pass
+         // it in registers
++#if JL_LLVM_VERSION < 120000
+         ab.addAttribute(Attribute::ByVal);
++#else
++        Type* Ty = preferred_llvm_type(dt, false, ctx);
++        ab.addByValAttr(Ty);
++#endif
+         return true;
+     }
+     return false;
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index 426abf6b7dcb..fb70e53e2814 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -288,7 +288,7 @@ class AbiLayout {
+ public:
+     virtual ~AbiLayout() {}
+     virtual bool use_sret(jl_datatype_t *ty, LLVMContext &ctx) = 0;
+-    virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&, LLVMContext &ctx) = 0;
++    virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&, LLVMContext &ctx, Type* llvm_t) = 0;
+     virtual Type *preferred_llvm_type(jl_datatype_t *ty, bool isret, LLVMContext &ctx) const = 0;
+ };
+ 
+@@ -1086,7 +1086,7 @@ std::string generate_func_sig(const char *fname)
+         }
+ 
+         // Whether or not LLVM wants us to emit a pointer to the data
+-        bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab, jl_LLVMContext);
++        bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab, jl_LLVMContext, t);
+ 
+         if (jl_is_cpointer_type(tti)) {
+             pat = t;
+
+From e7620d0e3c5b13a3e6ac21385784dc917c682969 Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Thu, 21 Oct 2021 20:32:39 -0400
+Subject: [PATCH 2/9] [LLVM/Win32] Force stack alignment on module
+
+---
+ src/aotcompile.cpp |  3 +++
+ src/ccall.cpp      |  3 +++
+ src/codegen.cpp    | 11 ++++++++++-
+ 3 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
+index e18b40240cb2..fc4dbe8decd3 100644
+--- a/src/aotcompile.cpp
++++ b/src/aotcompile.cpp
+@@ -550,6 +550,9 @@ void jl_dump_native_impl(void *native_code,
+     std::unique_ptr<Module> sysimage(new Module("sysimage", Context));
+     sysimage->setTargetTriple(data->M->getTargetTriple());
+     sysimage->setDataLayout(data->M->getDataLayout());
++#if JL_LLVM_VERSION >= 130000
++    sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
++#endif
+     data->M.reset(); // free memory for data->M
+ 
+     if (sysimg_data) {
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index fb70e53e2814..dd7626c918d0 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -891,6 +891,9 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
+     // copy module properties that should always match
+     Mod->setTargetTriple(jl_Module->getTargetTriple());
+     Mod->setDataLayout(jl_Module->getDataLayout());
++#if JL_LLVM_VERSION >= 130000
++    Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
++#endif
+ 
+     // verify the definition
+     Function *def = Mod->getFunction(ir_name);
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index 2ed36f21fa1e..fc2e27d29116 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -1707,6 +1707,14 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
+             llvm::DEBUG_METADATA_VERSION);
+     m->setDataLayout(jl_data_layout);
+     m->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
++
++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSION >= 130000
++    // tell Win32 to assume the stack is always 16-byte aligned,
++    // and to ensure that it is 16-byte aligned for out-going calls,
++    // to ensure compatibility with GCC codes
++    m->setOverrideStackAlignment(16);
++#endif
++
+ }
+ 
+ Module *jl_create_llvm_module(StringRef name)
+@@ -8033,10 +8041,11 @@ extern "C" void jl_init_llvm(void)
+ 
+     TargetOptions options = TargetOptions();
+     //options.PrintMachineCode = true; //Print machine code produced during JIT compiling
+-#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSION < 130000
+     // tell Win32 to assume the stack is always 16-byte aligned,
+     // and to ensure that it is 16-byte aligned for out-going calls,
+     // to ensure compatibility with GCC codes
++    // In LLVM 13 and onwards this has turned into a module option
+     options.StackAlignmentOverride = 16;
+ #endif
+ #ifdef JL_DEBUG_BUILD
+
+From 689e52cf3e83eff51a9928d19735bf635fa8c525 Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Fri, 22 Oct 2021 15:35:38 -0400
+Subject: [PATCH 3/9] StackProtector is now a module flag
+
+---
+ src/aotcompile.cpp | 1 +
+ src/ccall.cpp      | 1 +
+ src/codegen.cpp    | 6 ++++--
+ 3 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
+index fc4dbe8decd3..ad705e96b0da 100644
+--- a/src/aotcompile.cpp
++++ b/src/aotcompile.cpp
+@@ -551,6 +551,7 @@ void jl_dump_native_impl(void *native_code,
+     sysimage->setTargetTriple(data->M->getTargetTriple());
+     sysimage->setDataLayout(data->M->getDataLayout());
+ #if JL_LLVM_VERSION >= 130000
++    sysimage->setStackProtectorGuard(data->M->getStackProtectorGuard());
+     sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
+ #endif
+     data->M.reset(); // free memory for data->M
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index dd7626c918d0..647735edb37d 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -892,6 +892,7 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
+     Mod->setTargetTriple(jl_Module->getTargetTriple());
+     Mod->setDataLayout(jl_Module->getDataLayout());
+ #if JL_LLVM_VERSION >= 130000
++    Mod->setStackProtectorGuard(jl_Module->getStackProtectorGuard());
+     Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
+ #endif
+ 
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index fc2e27d29116..f55446e38c0d 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -1714,7 +1714,9 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
+     // to ensure compatibility with GCC codes
+     m->setOverrideStackAlignment(16);
+ #endif
+-
++#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION >= 130000
++    m->setStackProtectorGuard("global");
++#endif
+ }
+ 
+ Module *jl_create_llvm_module(StringRef name)
+@@ -8048,7 +8050,7 @@ extern "C" void jl_init_llvm(void)
+     // In LLVM 13 and onwards this has turned into a module option
+     options.StackAlignmentOverride = 16;
+ #endif
+-#ifdef JL_DEBUG_BUILD
++#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION < 130000
+     // LLVM defaults to tls stack guard, which causes issues with Julia's tls implementation
+     options.StackProtectorGuard = StackProtectorGuards::Global;
+ #endif
+
+From 45dee34f83ed4900173ed4c6d5632bd86d95b47d Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Sun, 24 Oct 2021 15:18:23 -0400
+Subject: [PATCH 4/9] Cleanup MachineObjectFileInfo handling in disassembly
+
+---
+ src/disasm.cpp | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/disasm.cpp b/src/disasm.cpp
+index 73b394b77d0b..25e7841bde85 100644
+--- a/src/disasm.cpp
++++ b/src/disasm.cpp
+@@ -860,21 +860,21 @@ static void jl_dump_asm_internal(
+     std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TheTriple.str()));
+     assert(MRI && "Unable to create target register info!");
+ 
+-    std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+-#if JL_LLVM_VERSION >= 130000
+-    MCSubtargetInfo *MSTI = TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features);
+-    assert(MSTI && "Unable to create subtarget info!");
++    std::unique_ptr<llvm::MCSubtargetInfo> STI(
++      TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
++    assert(STI && "Unable to create subtarget info!");
+ 
+-    MCContext Ctx(TheTriple, MAI.get(), MRI.get(), MSTI, &SrcMgr);
+-    MOFI->initMCObjectFileInfo(Ctx, /* PIC */ false, /* LargeCodeModel */ false);
++#if JL_LLVM_VERSION >= 130000
++    MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
++    std::unique_ptr<MCObjectFileInfo> MOFI(
++      TheTarget->createMCObjectFileInfo(Ctx, /*PIC=*/false, /*LargeCodeModel=*/ false));
++    Ctx.setObjectFileInfo(MOFI.get());
+ #else
++    std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+     MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
+     MOFI->InitMCObjectFileInfo(TheTriple, /* PIC */ false, Ctx);
+ #endif
+ 
+-    // Set up Subtarget and Disassembler
+-    std::unique_ptr<MCSubtargetInfo>
+-        STI(TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
+     std::unique_ptr<MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI, Ctx));
+     if (!DisAsm) {
+         rstream << "ERROR: no disassembler for target " << TheTriple.str();
+
+From 349870e4f190a406c6f338a33c9369299b7befea Mon Sep 17 00:00:00 2001
+From: Jameson Nash <vtjnash at gmail.com>
+Date: Mon, 15 Nov 2021 17:56:52 -0500
+Subject: [PATCH 6/9] [LateLowerGCFrame] handle undef values from a shuffle
+ vector mask
+
+The same as how we handle them if they were undef in the shuffle vector operand.
+---
+ src/llvm-late-gc-lowering.cpp | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
+index ed5fe7c43a59..b142aeaee373 100644
+--- a/src/llvm-late-gc-lowering.cpp
++++ b/src/llvm-late-gc-lowering.cpp
+@@ -616,7 +616,7 @@ std::vector<Value*> LateLowerGCFrame::MaybeExtractVector(State &S, Value *BaseVe
+     std::vector<Value*> V{Numbers.size()};
+     Value *V_rnull = ConstantPointerNull::get(cast<PointerType>(T_prjlvalue));
+     for (unsigned i = 0; i < V.size(); ++i) {
+-        if (Numbers[i] >= 0)
++        if (Numbers[i] >= 0) // ignores undef and poison values
+             V[i] = GetPtrForNumber(S, Numbers[i], InsertBefore);
+         else
+             V[i] = V_rnull;
+@@ -860,8 +860,9 @@ std::vector<int> LateLowerGCFrame::NumberAllBase(State &S, Value *CurrentV) {
+         std::vector<int> Numbers2 = NumberAll(S, SVI->getOperand(1));
+         auto Mask = SVI->getShuffleMask();
+         for (auto idx : Mask) {
+-            assert(idx != -1 && "Undef tracked value is invalid");
+-            if ((unsigned)idx < Numbers1.size()) {
++            if (idx == -1) {
++                Numbers.push_back(-1);
++            } else if ((unsigned)idx < Numbers1.size()) {
+                 Numbers.push_back(Numbers1.at(idx));
+             } else {
+                 Numbers.push_back(Numbers2.at(idx - Numbers1.size()));
+@@ -966,8 +967,9 @@ std::vector<int> LateLowerGCFrame::NumberAll(State &S, Value *V) {
+             Number = Numbers[CurrentV.second]; // only needed a subset of the values
+             Numbers.resize(tracked.count, Number);
+         }
+-        else
++        else {
+             assert(!isa<PointerType>(V->getType()));
++        }
+     }
+     if (CurrentV.first != V) {
+         if (isa<PointerType>(V->getType())) {
+
+From af07387c6c82f54c8b3fd1578e3a42f18ca9e7f4 Mon Sep 17 00:00:00 2001
+From: Jameson Nash <vtjnash at gmail.com>
+Date: Tue, 16 Nov 2021 13:49:05 -0500
+Subject: [PATCH 7/9] fix tbaa_make_child use errors in our llvm passes
+
+now caught by the verifier
+---
+ src/codegen.cpp                  |  6 +++---
+ src/codegen_shared.h             |  9 +++------
+ src/llvm-late-gc-lowering.cpp    |  2 +-
+ src/llvm-multiversioning.cpp     |  7 +------
+ src/llvm-pass-helpers.cpp        | 20 ++++++++++++--------
+ src/llvm-ptls.cpp                |  5 +----
+ test/llvmpasses/late-lower-gc.ll | 14 ++++++--------
+ 7 files changed, 27 insertions(+), 36 deletions(-)
+
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index f55446e38c0d..249a761d1ef0 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -144,7 +144,7 @@ extern JITEventListener *CreateJuliaJITEventListener();
+ bool imaging_mode = false;
+ 
+ // shared llvm state
+-JL_DLLEXPORT LLVMContext &jl_LLVMContext = *(new LLVMContext());
++static LLVMContext &jl_LLVMContext = *(new LLVMContext());
+ TargetMachine *jl_TargetMachine;
+ static DataLayout &jl_data_layout = *(new DataLayout(""));
+ #define jl_Module ctx.f->getParent()
+@@ -4790,7 +4790,7 @@ static Value *get_current_task(jl_codectx_t &ctx)
+ // Get PTLS through current task.
+ static Value *get_current_ptls(jl_codectx_t &ctx)
+ {
+-    return get_current_ptls_from_task(ctx.builder, get_current_task(ctx));
++    return get_current_ptls_from_task(ctx.builder, get_current_task(ctx), tbaa_gcframe);
+ }
+ 
+ // Store world age at the entry block of the function. This function should be
+@@ -7689,7 +7689,7 @@ void jl_compile_workqueue(
+ 
+ // --- initialization ---
+ 
+-std::pair<MDNode*,MDNode*> tbaa_make_child(const char *name, MDNode *parent=nullptr, bool isConstant=false)
++static std::pair<MDNode*,MDNode*> tbaa_make_child(const char *name, MDNode *parent=nullptr, bool isConstant=false)
+ {
+     MDBuilder mbuilder(jl_LLVMContext);
+     if (tbaa_root == nullptr) {
+diff --git a/src/codegen_shared.h b/src/codegen_shared.h
+index 93c913fd7a76..883d804a2091 100644
+--- a/src/codegen_shared.h
++++ b/src/codegen_shared.h
+@@ -99,9 +99,6 @@ static inline std::pair<llvm::MDNode*,llvm::MDNode*> tbaa_make_child_with_contex
+     return std::make_pair(n, scalar);
+ }
+ 
+-static inline llvm::MDNode *get_tbaa_gcframe(llvm::LLVMContext &ctxt) {
+-    return tbaa_make_child_with_context(ctxt, "jtbaa_gcframe").first;
+-}
+ static inline llvm::MDNode *get_tbaa_const(llvm::LLVMContext &ctxt) {
+     return tbaa_make_child_with_context(ctxt, "jtbaa_const", nullptr, true).first;
+ }
+@@ -132,7 +129,7 @@ static inline llvm::Value *emit_bitcast_with_builder(llvm::IRBuilder<> &builder,
+ }
+ 
+ // Get PTLS through current task.
+-static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder, llvm::Value *current_task)
++static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder, llvm::Value *current_task, llvm::MDNode *tbaa)
+ {
+     using namespace llvm;
+     auto T_ppjlvalue = JuliaType::get_ppjlvalue_ty(builder.getContext());
+@@ -145,9 +142,9 @@ static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder
+     LoadInst *ptls_load = builder.CreateAlignedLoad(
+         emit_bitcast_with_builder(builder, pptls, T_ppjlvalue), Align(sizeof(void *)), "ptls_load");
+     // Note: Corresponding store (`t->ptls = ptls`) happens in `ctx_switch` of tasks.c.
+-    tbaa_decorate(get_tbaa_gcframe(builder.getContext()), ptls_load);
++    tbaa_decorate(tbaa, ptls_load);
+     // Using `CastInst::Create` to get an `Instruction*` without explicit cast:
+     auto ptls = CastInst::Create(Instruction::BitCast, ptls_load, T_ppjlvalue, "ptls");
+     builder.Insert(ptls);
+     return ptls;
+-}
+\ No newline at end of file
++}
+diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
+index b142aeaee373..533ea8f5b145 100644
+--- a/src/llvm-late-gc-lowering.cpp
++++ b/src/llvm-late-gc-lowering.cpp
+@@ -2298,7 +2298,7 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+                 // Create a call to the `julia.gc_alloc_bytes` intrinsic, which is like
+                 // `julia.gc_alloc_obj` except it doesn't set the tag.
+                 auto allocBytesIntrinsic = getOrDeclare(jl_intrinsics::GCAllocBytes);
+-                auto ptlsLoad = get_current_ptls_from_task(builder, CI->getArgOperand(0));
++                auto ptlsLoad = get_current_ptls_from_task(builder, CI->getArgOperand(0), tbaa_gcframe);
+                 auto ptls = builder.CreateBitCast(ptlsLoad, Type::getInt8PtrTy(builder.getContext()));
+                 auto newI = builder.CreateCall(
+                     allocBytesIntrinsic,
+diff --git a/src/llvm-multiversioning.cpp b/src/llvm-multiversioning.cpp
+index 7cd50ac144c1..57e90a9aa805 100644
+--- a/src/llvm-multiversioning.cpp
++++ b/src/llvm-multiversioning.cpp
+@@ -40,8 +40,6 @@
+ 
+ using namespace llvm;
+ 
+-extern std::pair<MDNode*,MDNode*> tbaa_make_child(const char *name, MDNode *parent=nullptr,
+-                                                  bool isConstant=false);
+ 
+ namespace {
+ 
+@@ -346,7 +341,7 @@ CloneCtx::CloneCtx(MultiVersioning *pass, Module &M)
+       T_int32(Type::getInt32Ty(ctx)),
+       T_void(Type::getVoidTy(ctx)),
+       T_psize(PointerType::get(T_size, 0)),
+-      tbaa_const(tbaa_make_child("jtbaa_const", nullptr, true).first),
++      tbaa_const(tbaa_make_child_with_context(ctx, "jtbaa_const", nullptr, true).first),
+       pass(pass),
+       specs(jl_get_llvm_clone_targets()),
+       fvars(consume_gv<Function>(M, "jl_sysimg_fvars")),
+diff --git a/src/llvm-pass-helpers.cpp b/src/llvm-pass-helpers.cpp
+index 89263033ce56..f6708ef65ab7 100644
+--- a/src/llvm-pass-helpers.cpp
++++ b/src/llvm-pass-helpers.cpp
+@@ -19,27 +19,31 @@
+ 
+ using namespace llvm;
+ 
+-extern std::pair<MDNode*,MDNode*> tbaa_make_child(const char *name, MDNode *parent=nullptr, bool isConstant=false);
+-
+ JuliaPassContext::JuliaPassContext()
+     : T_size(nullptr), T_int8(nullptr), T_int32(nullptr),
+         T_pint8(nullptr), T_jlvalue(nullptr), T_prjlvalue(nullptr),
+         T_ppjlvalue(nullptr), T_pjlvalue(nullptr), T_pjlvalue_der(nullptr),
+-        T_ppjlvalue_der(nullptr), pgcstack_getter(nullptr), gc_flush_func(nullptr),
++        T_ppjlvalue_der(nullptr),
++
++        tbaa_gcframe(nullptr), tbaa_tag(nullptr),
++
++        pgcstack_getter(nullptr), gc_flush_func(nullptr),
+         gc_preserve_begin_func(nullptr), gc_preserve_end_func(nullptr),
+         pointer_from_objref_func(nullptr), alloc_obj_func(nullptr),
+         typeof_func(nullptr), write_barrier_func(nullptr), module(nullptr)
+ {
+-    tbaa_gcframe = tbaa_make_child("jtbaa_gcframe").first;
+-    MDNode *tbaa_data;
+-    MDNode *tbaa_data_scalar;
+-    std::tie(tbaa_data, tbaa_data_scalar) = tbaa_make_child("jtbaa_data");
+-    tbaa_tag = tbaa_make_child("jtbaa_tag", tbaa_data_scalar).first;
+ }
+ 
+ void JuliaPassContext::initFunctions(Module &M)
+ {
+     module = &M;
++    LLVMContext &llvmctx = M.getContext();
++
++    tbaa_gcframe = tbaa_make_child_with_context(llvmctx, "jtbaa_gcframe").first;
++    MDNode *tbaa_data;
++    MDNode *tbaa_data_scalar;
++    std::tie(tbaa_data, tbaa_data_scalar) = tbaa_make_child_with_context(llvmctx, "jtbaa_data");
++    tbaa_tag = tbaa_make_child_with_context(llvmctx, "jtbaa_tag", tbaa_data_scalar).first;
+ 
+     pgcstack_getter = M.getFunction("julia.get_pgcstack");
+     gc_flush_func = M.getFunction("julia.gcroot_flush");
+diff --git a/src/llvm-ptls.cpp b/src/llvm-ptls.cpp
+index c971774f23e6..a573d41dae32 100644
+--- a/src/llvm-ptls.cpp
++++ b/src/llvm-ptls.cpp
+@@ -32,9 +32,6 @@ using namespace llvm;
+ 
+ typedef Instruction TerminatorInst;
+ 
+-std::pair<MDNode*,MDNode*> tbaa_make_child(const char *name, MDNode *parent=nullptr,
+-                                           bool isConstant=false);
+-
+ namespace {
+ 
+ struct LowerPTLS: public ModulePass {
+@@ -264,7 +261,7 @@ bool LowerPTLS::runOnModule(Module &_M)
+         return false;
+ 
+     ctx = &M->getContext();
+-    tbaa_const = tbaa_make_child("jtbaa_const", nullptr, true).first;
++    tbaa_const = tbaa_make_child_with_context(*ctx, "jtbaa_const", nullptr, true).first;
+ 
+     T_int8 = Type::getInt8Ty(*ctx);
+     T_size = sizeof(size_t) == 8 ? Type::getInt64Ty(*ctx) : Type::getInt32Ty(*ctx);
+
+From 02cd72ee0cd79b629b0bd2d30d1a0512fd155f38 Mon Sep 17 00:00:00 2001
+From: Jameson Nash <jameson at juliacomputing.com>
+Date: Wed, 8 Dec 2021 11:30:34 -0500
+Subject: [PATCH 8/9] [JuliaJITEventListener] Use llvm::StringMap
+
+---
+ src/debuginfo.cpp | 15 +++++----------
+ 1 file changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/src/debuginfo.cpp b/src/debuginfo.cpp
+index 956559c17998..e7863d5aab34 100644
+--- a/src/debuginfo.cpp
++++ b/src/debuginfo.cpp
+@@ -177,13 +177,6 @@ struct revcomp {
+     { return lhs>rhs; }
+ };
+ 
+-struct strrefcomp {
+-    bool operator() (const StringRef& lhs, const StringRef& rhs) const
+-    {
+-        return lhs.compare(rhs) > 0;
+-    }
+-};
+-
+ class JuliaJITEventListener: public JITEventListener
+ {
+     std::map<size_t, ObjectInfo, revcomp> objectmap;
+@@ -234,11 +227,13 @@ class JuliaJITEventListener: public JITEventListener
+         SavedObject.second.release();
+ 
+         object::section_iterator EndSection = debugObj.section_end();
+-        std::map<StringRef, object::SectionRef, strrefcomp> loadedSections;
++        StringMap<object::SectionRef> loadedSections;
+         for (const object::SectionRef &lSection: Object.sections()) {
+             auto sName = lSection.getName();
+-            if (sName)
+-                loadedSections[*sName] = lSection;
++            if (sName) {
++                bool inserted = loadedSections.insert(std::make_pair(*sName, lSection)).second;
++                assert(inserted); (void)inserted;
++            }
+         }
+         auto getLoadAddress = [&] (const StringRef &sName) -> uint64_t {
+             auto search = loadedSections.find(sName);
+
+From 1c68695b493e6b7cde2327bf61b551d5e32e92d3 Mon Sep 17 00:00:00 2001
+From: Jameson Nash <jameson at juliacomputing.com>
+Date: Wed, 8 Dec 2021 11:35:53 -0500
+Subject: [PATCH 9/9] [EE] CompilerUsed instead of Used
+
+---
+ src/jitlayers.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
+index 886887f1d329..c6a3de4f4ad8 100644
+--- a/src/jitlayers.cpp
++++ b/src/jitlayers.cpp
+@@ -1045,7 +1045,7 @@ static void jl_add_to_ee(std::unique_ptr<Module> m)
+             ConstantAggregateZero::get(atype), "__catchjmp") };
+     gvs[0]->setSection(".text");
+     gvs[1]->setSection(".text");
+-    appendToUsed(*m, makeArrayRef((GlobalValue**)gvs, 2));
++    appendToCompilerUsed(*m, makeArrayRef((GlobalValue**)gvs, 2));
+ #endif
+     jl_jit_share_data(*m);
+     assert(jl_ExecutionEngine);

Copied: julia/repos/community-staging-x86_64/PKGBUILD (from rev 1238980, julia/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,166 @@
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+# Contributor: Alexander F. Rødseth <xyproto at archlinux.org>
+# Contributor: Eli Schwartz <eschwartz at archlinux.org>
+# Contributor: Lex Black <autumn-wind at web.de>
+# Contributor: Michael Jakl <jakl.michael at gmail.com>
+# Contributor: devmotion <nospam-archlinux.org at devmotion.de>
+# Contributor: Valentin Churavy <v.churavy at gmail.com>
+
+pkgname=julia
+epoch=2
+pkgver=1.7.3
+pkgrel=2
+arch=(x86_64)
+pkgdesc='High-level, high-performance, dynamic programming language'
+url='https://julialang.org/'
+license=(MIT)
+depends=(cblas fftw hicolor-icon-theme libgit2 libunwind libutf8proc openblas
+         suitesparse mbedtls openlibm pcre2 llvm-libs p7zip libblastrampoline)
+makedepends=(cmake gcc-fortran python llvm patchelf libwhich)
+optdepends=('gnuplot: If using the Gaston Package from julia')
+replaces=(julia-docs)
+source=(https://github.com/JuliaLang/julia/releases/download/v$pkgver/$pkgname-$pkgver-full.tar.gz{,.asc}
+        https://github.com/JuliaLang/julia/commit/677ce6d3.patch
+        https://github.com/JuliaLang/julia/commit/47f9139e.patch
+        https://github.com/JuliaLang/julia/commit/1eb063f1.patch
+        https://github.com/JuliaLang/julia/commit/99d4e655.patch
+        f8c918b0.patch
+        63303980.patch
+        ed9851b0.patch
+        144ebbaf.patch
+        074d761f.patch
+        julia-libgit-1.2.patch
+        julia-libgit-1.4.patch
+        julia-system-cblas.patch
+        julia-hardcoded-libs.patch
+        make-install-no-build.patch
+        julia-libunwind-1.6.patch
+        julia-libblastrampoline-4.patch
+        julia-gcc-12.patch)
+backup=(etc/julia/startup.jl)
+sha256sums=('4be529b0716de1ec48ba52e83a0fafd4be2269be9cc43074ad15ce788aeca093'
+            'SKIP'
+            'a5cd89ce78157362377df382ce5a4fbef14543b818beecc06dfd6d63c90334f2'
+            'bbaea5ed91577a4633625a339dc1fb48cb4d74893e69bafc993db2953078891c'
+            '9a176b411414825f1694d3fbe377fdc0d4937883a9926db0f531dbac7e75464a'
+            'c033fce112db85b02ebc1d3c8f8bac1240e0409ffdded7fd3322163834c41257'
+            'bc6c85cbbca489ef0b2876dbeb6ae493c11573e058507b8bcb9e01273bc3a38c'
+            '96303f5cb520e861c7fdc5eb6d64767b597ecf2057a0aa37250af546738da63e'
+            '3f6f17c3cd876b110b21fbf251fb940d015526a62f27084623a93d9efb396aab'
+            '0ca0236d819f8b21dc6b7fd8a4e6741f89d9507bcc401cfc69008d6bf2d33fcb'
+            'f38eee6270937843bb7cbcbdeb785bd9031189fb9d39a744206259160f5ee1ed'
+            '40e1f46415a7241c1258d2e9d01890455ac728879a5cc6bb1d8f57d6e1f7a69a'
+            'cfe498a090d0026b92f9db4ed65ac3818c2efa5ec83bcefed728d27abff73081'
+            '8f8c12853ce847f5d1b5a4a461ddec701decdb81dae7bb31d66560c1deaed97a'
+            '03043f005c133ac9af1d4dc113ea8b525ad3b393690625be77975f0e29dd6457'
+            '8be4605f92a009072ca7e843549c225fc4e959893498e7c4f8f79e861e63714d'
+            '3afa172e8b54ce48e77542677b2b7143199d444bfeed39be1644ce88b513a3d0'
+            '79cd957d0599a8ee1dbdf7f2ebd1a5bd85ab7e499584858e89a8d9609ba1ced4'
+            'b903859c262048057f873e4a39c4837382896d3059860465443823133a5a59da')
+validpgpkeys=('3673DF529D9049477F76B37566E3C7DC03D6E495') # Julia (Binary signing key) <buildbot at julialang.org>
+options=(!lto)
+
+prepare() {
+  cd $pkgname-$pkgver
+
+# fixes for LLVM 13
+  patch -p1 -i ../677ce6d3.patch
+  patch -p1 -i ../47f9139e.patch
+  patch -p1 -i ../1eb063f1.patch
+  patch -p1 -i ../f8c918b0.patch
+  patch -p1 -i ../63303980.patch
+  patch -p1 -i ../99d4e655.patch
+# Fixes for LLVM 14
+  patch -p1 -i ../ed9851b0.patch
+  patch -p1 -i ../144ebbaf.patch
+  patch -p1 -i ../074d761f.patch
+# libgit2 1.2 compatibility
+  patch -p1 -i ../julia-libgit-1.2.patch
+# libgit2 1.4 compatibility
+  patch -p1 -i ../julia-libgit-1.4.patch
+# libunwind 1.6 compatibility
+  patch -p1 -i ../julia-libunwind-1.6.patch
+# Add and use option to build with system cblas
+  patch -p1 -i ../julia-system-cblas.patch # Add and use option to build with system cblas
+# Don't hardcode library names
+  patch -p1 -i ../julia-hardcoded-libs.patch
+# Don't build again in install
+  patch -p1 -i ../make-install-no-build.patch
+# Fix test failure
+  sed -e 's|0.22314355f0 + 3.1415927f0im|0.22314355f0 - 3.1415927f0im|' -i stdlib/LinearAlgebra/test/lu.jl
+# Port to libblastrampoline 4 API
+  patch -p1 -i ../julia-libblastrampoline-4.patch
+# Fix failures with GCC 12 https://github.com/JuliaLang/julia/pull/45249
+  patch -p0 -i ../julia-gcc-12.patch
+}
+
+_buildopts="prefix=/usr \
+    bindir=/usr/bin \
+    sysconfdir=/etc \
+    libexecdir=/usr/lib \
+    USE_BINARYBUILDER=0 \
+    USE_SYSTEM_CSL=1 \
+    USE_SYSTEM_LLVM=1 \
+    USE_SYSTEM_LIBUNWIND=1 \
+    USE_SYSTEM_PCRE=1 \
+    USE_SYSTEM_BLAS=1 \
+    USE_SYSTEM_LAPACK=1 \
+    USE_SYSTEM_GMP=1 \
+    USE_SYSTEM_MPFR=1 \
+    USE_SYSTEM_LIBSUITESPARSE=1 \
+    USE_SYSTEM_LIBBLASTRAMPOLINE=1 \
+    USE_SYSTEM_LIBWHICH=1 \
+    USE_SYSTEM_DSFMT=0 \
+    USE_SYSTEM_LIBUV=0 \
+    USE_SYSTEM_UTF8PROC=1 \
+    USE_SYSTEM_LIBGIT2=1 \
+    USE_SYSTEM_LIBSSH2=1 \
+    USE_SYSTEM_MBEDTLS=1 \
+    USE_SYSTEM_CURL=1 \
+    USE_SYSTEM_PATCHELF=1 \
+    USE_SYSTEM_ZLIB=1 \
+    USE_SYSTEM_P7ZIP=1 \
+    USE_SYSTEM_OPENLIBM=1 \
+    MARCH=x86-64"
+
+build() {
+  cd $pkgname-$pkgver
+  make release VERBOSE=1 JLDFLAGS=${LDFLAGS} $_buildopts
+}
+
+check() {
+  cd $pkgname-$pkgver/test
+
+  # this is the make testall target, plus the --skip option from
+  # travis/appveyor/circleci (one test fails with DNS resolution errors)
+  # Also skip tests that check for a hardcoded version number
+  ../julia --check-bounds=yes --startup-file=no ./runtests.jl \
+    --skip Sockets \
+    --skip broadcast \
+    --skip Distributed \
+    --skip nghttp2_jll \
+    --skip GMP_jll \
+    --skip LibCURL \
+    --skip LibSSH2_jll \
+    --skip MbedTLS_jll \
+    --skip MPFR_jll \
+    --skip SuiteSparse_jll \
+    --skip PCRE2_jll \
+    --skip LibGit2_jll \
+    --skip Zlib_jll \
+    --skip MozillaCACerts_jll \
+    --skip NetworkOptions \
+    --skip Downloads
+  find ../stdlib \( -name \*.cov -o -name \*.mem \) -delete
+  rm -fr ../stdlib/Artifacts/test/artifacts
+}
+
+package() {
+  cd $pkgname-$pkgver
+  make DESTDIR="$pkgdir" install $_buildopts
+
+  ln -s /usr/lib/libopenblas.so "$pkgdir"/usr/lib/julia/libopenblas64_.so # Needed by some 3rd party packages
+
+  rm "$pkgdir"/usr/lib/julia/libccalltest.so.debug # Remove debug testing library
+  install -Dm644 LICENSE.md -t "$pkgdir"/usr/share/licenses/$pkgname
+}

Copied: julia/repos/community-staging-x86_64/ed9851b0.patch (from rev 1238980, julia/trunk/ed9851b0.patch)
===================================================================
--- community-staging-x86_64/ed9851b0.patch	                        (rev 0)
+++ community-staging-x86_64/ed9851b0.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,96 @@
+From ed9851b020f8b6c05d604e2dd60dc2f53a62af0d Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Fri, 18 Feb 2022 14:37:31 -0500
+Subject: [PATCH] AttrBuilder now takes LLVMContext
+
+---
+ src/ccall.cpp   | 46 +++++++++++++++++++++++++++++-----------------
+ src/cgutils.cpp |  4 ++++
+ src/codegen.cpp |  8 ++++++++
+ 3 files changed, 41 insertions(+), 17 deletions(-)
+
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index 332c057afa5c4..5f260d9178ffa 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -1020,7 +1020,11 @@ std::string generate_func_sig(const char *fname)
+             abi->use_sret(jl_voidpointer_type, jl_LLVMContext);
+         }
+         else if (abi->use_sret((jl_datatype_t*)rt, jl_LLVMContext)) {
++#if JL_LLVM_VERSION >= 140000
++            AttrBuilder retattrs(lrt->getContext());
++#else
+             AttrBuilder retattrs = AttrBuilder();
++#endif
+ #if !defined(_OS_WINDOWS_) // llvm used to use the old mingw ABI, skipping this marking works around that difference
+ #if JL_LLVM_VERSION < 120000
+             retattrs.addAttribute(Attribute::StructRet);
+@@ -1042,7 +1046,11 @@ std::string generate_func_sig(const char *fname)
+     }
+ 
+     for (size_t i = 0; i < nccallargs; ++i) {
++#if JL_LLVM_VERSION >= 140000
++        AttrBuilder ab(lrt->getContext());
++#else
+         AttrBuilder ab;
++#endif
+         jl_value_t *tti = jl_svecref(at, i);
+         Type *t = NULL;
+         bool isboxed;
+@@ -1120,7 +1128,11 @@ std::string generate_func_sig(const char *fname)
+         fargt.push_back(t);
+         fargt_isboxed.push_back(isboxed);
+         fargt_sig.push_back(pat);
+-        paramattrs.push_back(AttributeSet::get(jl_LLVMContext, ab));
++#if JL_LLVM_VERSION >= 140000
++        paramattrs.push_back(AttrBuilder(lrt->getContext(), AttributeSet::get(jl_LLVMContext, ab)));
++#else
++        paramattrs.push_back(AttributeSet::get(jl_LLVMContext, ab));
++#endif
+     }
+ 
+     for (size_t i = 0; i < nccallargs + sret; ++i) {
+diff --git a/src/cgutils.cpp b/src/cgutils.cpp
+index b219498315905..e04abe8c06e03 100644
+--- a/src/cgutils.cpp
++++ b/src/cgutils.cpp
+@@ -340,7 +340,11 @@ static unsigned julia_alignment(jl_value_t *jt)
+ 
+ static inline void maybe_mark_argument_dereferenceable(Argument *A, jl_value_t *jt)
+ {
++#if JL_LLVM_VERSION >= 140000
++    AttrBuilder B(A->getContext());
++#else
+     AttrBuilder B;
++#endif
+     B.addAttribute(Attribute::NonNull);
+     // The `dereferencable` below does not imply `nonnull` for non addrspace(0) pointers.
+     size_t size = dereferenceable_size(jt);
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index be6d8e2f66325..83946391e40c8 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -1952,7 +1952,11 @@ static void jl_init_function(Function *F)
+     // upon entry to any function. This achieves compatibility
+     // with both MinGW-GCC (which assumes an 16-byte-aligned stack) and
+     // i686 Windows (which uses a 4-byte-aligned stack)
++#if JL_LLVM_VERSION >= 140000
++    AttrBuilder attr(F->getContext());
++#else
+     AttrBuilder attr;
++#endif
+     attr.addStackAlignmentAttr(16);
+     F->addAttributes(AttributeList::FunctionIndex, attr);
+ #endif
+@@ -5311,7 +5315,11 @@ static Function* gen_cfun_wrapper(
+         }
+ 
+         // Add the new nest attribute
++#if JL_LLVM_VERSION >= 140000
++        AttrBuilder attrBuilder(M->getContext());
++#else
+         AttrBuilder attrBuilder;
++#endif
+         attrBuilder.addAttribute(Attribute::Nest);
+         newAttributes.emplace_back(it, AttributeSet::get(M->getContext(), attrBuilder));
+ 

Copied: julia/repos/community-staging-x86_64/f8c918b0.patch (from rev 1238980, julia/trunk/f8c918b0.patch)
===================================================================
--- community-staging-x86_64/f8c918b0.patch	                        (rev 0)
+++ community-staging-x86_64/f8c918b0.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,236 @@
+From f8c918b00f7c62e204d324a827e2ee2ef05bb66a Mon Sep 17 00:00:00 2001
+From: pchintalapudi <34727397+pchintalapudi at users.noreply.github.com>
+Date: Wed, 10 Nov 2021 17:56:26 -0500
+Subject: [PATCH] Move PTLS load emission from codegen to late-gc-lowering
+ (#42572)
+
+* Move PTLS load emission from codegen to late-gc-lowering
+
+* Address PR comments
+
+* Fix tests and move TBAA node generation to codegen_shared
+
+* Add check for null metadata node
+
+Co-authored-by: Prem Chintalapudi <premc at csail.mit.edu>
+---
+ src/Makefile                         |  2 +-
+ src/cgutils.cpp                      | 12 +---
+ src/codegen.cpp                      | 18 +-----
+ src/codegen_shared.h                 | 83 +++++++++++++++++++++++++++
+ src/llvm-late-gc-lowering.cpp        |  4 +-
+ test/llvmpasses/alloc-opt-gcframe.jl | 86 +++++++++++++---------------
+ test/llvmpasses/late-lower-gc.ll     | 58 +++++++++++--------
+ 7 files changed, 167 insertions(+), 96 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 17e70fe6d01f..1494fe3be40a 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -293,7 +293,7 @@ $(build_shlibdir)/libllvmcalltest.$(SHLIB_EXT): $(SRCDIR)/codegen_shared.h $(BUI
+ $(BUILDDIR)/llvm-alloc-opt.o $(BUILDDIR)/llvm-alloc-opt.dbg.obj: $(SRCDIR)/codegen_shared.h
+ $(BUILDDIR)/llvm-final-gc-lowering.o $(BUILDDIR)/llvm-final-gc-lowering.dbg.obj: $(SRCDIR)/llvm-pass-helpers.h
+ $(BUILDDIR)/llvm-gc-invariant-verifier.o $(BUILDDIR)/llvm-gc-invariant-verifier.dbg.obj: $(SRCDIR)/codegen_shared.h
+-$(BUILDDIR)/llvm-late-gc-lowering.o $(BUILDDIR)/llvm-late-gc-lowering.dbg.obj: $(SRCDIR)/llvm-pass-helpers.h
++$(BUILDDIR)/llvm-late-gc-lowering.o $(BUILDDIR)/llvm-late-gc-lowering.dbg.obj: $(SRCDIR)/llvm-pass-helpers.h $(SRCDIR)/codegen_shared.h
+ $(BUILDDIR)/llvm-multiversioning.o $(BUILDDIR)/llvm-multiversioning.dbg.obj: $(SRCDIR)/codegen_shared.h
+ $(BUILDDIR)/llvm-pass-helpers.o $(BUILDDIR)/llvm-pass-helpers.dbg.obj: $(SRCDIR)/llvm-pass-helpers.h $(SRCDIR)/codegen_shared.h
+ $(BUILDDIR)/llvm-ptls.o $(BUILDDIR)/llvm-ptls.dbg.obj: $(SRCDIR)/codegen_shared.h
+diff --git a/src/cgutils.cpp b/src/cgutils.cpp
+index a1fef5279a6b..219b42dae75a 100644
+--- a/src/cgutils.cpp
++++ b/src/cgutils.cpp
+@@ -2,14 +2,6 @@
+ 
+ // utility procedures used in code generation
+ 
+-static Instruction *tbaa_decorate(MDNode *md, Instruction *inst)
+-{
+-    inst->setMetadata(llvm::LLVMContext::MD_tbaa, md);
+-    if (isa<LoadInst>(inst) && md == tbaa_const)
+-        inst->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(md->getContext(), None));
+-    return inst;
+-}
+-
+ static Value *track_pjlvalue(jl_codectx_t &ctx, Value *V)
+ {
+     assert(V->getType() == T_pjlvalue);
+@@ -3218,9 +3210,9 @@ static void emit_cpointercheck(jl_codectx_t &ctx, const jl_cgval_t &x, const std
+ // allocation for known size object
+ static Value *emit_allocobj(jl_codectx_t &ctx, size_t static_size, Value *jt)
+ {
+-    Value *ptls_ptr = emit_bitcast(ctx, get_current_ptls(ctx), T_pint8);
++    Value *current_task = get_current_task(ctx);
+     Function *F = prepare_call(jl_alloc_obj_func);
+-    auto call = ctx.builder.CreateCall(F, {ptls_ptr, ConstantInt::get(T_size, static_size), maybe_decay_untracked(ctx, jt)});
++    auto call = ctx.builder.CreateCall(F, {current_task, ConstantInt::get(T_size, static_size), maybe_decay_untracked(ctx, jt)});
+     call->setAttributes(F->getAttributes());
+     return call;
+ }
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index 6ab179bb5446..3e0457972caf 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -634,7 +634,7 @@ static const auto jlegalx_func = new JuliaFunction{
+ static const auto jl_alloc_obj_func = new JuliaFunction{
+     "julia.gc_alloc_obj",
+     [](LLVMContext &C) { return FunctionType::get(T_prjlvalue,
+-                {T_pint8, T_size, T_prjlvalue}, false); },
++                {T_ppjlvalue, T_size, T_prjlvalue}, false); },
+     [](LLVMContext &C) { return AttributeList::get(C,
+             AttributeSet::get(C, makeArrayRef({Attribute::getWithAllocSizeArgs(C, 1, None)})), // returns %1 bytes
+             Attributes(C, {Attribute::NoAlias, Attribute::NonNull}),
+@@ -1131,7 +1131,7 @@ static jl_cgval_t emit_invoke(jl_codectx_t &ctx, const jl_cgval_t &lival, const
+ 
+ static Value *literal_pointer_val(jl_codectx_t &ctx, jl_value_t *p);
+ static GlobalVariable *prepare_global_in(Module *M, GlobalVariable *G);
+-static Instruction *tbaa_decorate(MDNode *md, Instruction *inst);
++Instruction *tbaa_decorate(MDNode *md, Instruction *inst);
+ 
+ static GlobalVariable *prepare_global_in(Module *M, JuliaVariable *G)
+ {
+@@ -4792,19 +4792,7 @@ static Value *get_current_task(jl_codectx_t &ctx)
+ // Get PTLS through current task.
+ static Value *get_current_ptls(jl_codectx_t &ctx)
+ {
+-    const int ptls_offset = offsetof(jl_task_t, ptls);
+-    Value *pptls = ctx.builder.CreateInBoundsGEP(
+-        T_pjlvalue, get_current_task(ctx),
+-        ConstantInt::get(T_size, ptls_offset / sizeof(void *)),
+-        "ptls_field");
+-    LoadInst *ptls_load = ctx.builder.CreateAlignedLoad(
+-        emit_bitcast(ctx, pptls, T_ppjlvalue), Align(sizeof(void *)), "ptls_load");
+-    // Note: Corresponding store (`t->ptls = ptls`) happens in `ctx_switch` of tasks.c.
+-    tbaa_decorate(tbaa_gcframe, ptls_load);
+-    // Using `CastInst::Create` to get an `Instruction*` without explicit cast:
+-    auto ptls = CastInst::Create(Instruction::BitCast, ptls_load, T_ppjlvalue, "ptls");
+-    ctx.builder.Insert(ptls);
+-    return ptls;
++    return get_current_ptls_from_task(ctx.builder, get_current_task(ctx));
+ }
+ 
+ // Store world age at the entry block of the function. This function should be
+diff --git a/src/codegen_shared.h b/src/codegen_shared.h
+index ca876b9b0310..93c913fd7a76 100644
+--- a/src/codegen_shared.h
++++ b/src/codegen_shared.h
+@@ -5,6 +5,8 @@
+ #include <llvm/Support/Debug.h>
+ #include <llvm/IR/DebugLoc.h>
+ #include <llvm/IR/IRBuilder.h>
++#include <llvm/IR/MDBuilder.h>
++#include "julia.h"
+ 
+ enum AddressSpace {
+     Generic = 0,
+@@ -19,6 +21,24 @@ enum AddressSpace {
+     LastSpecial = Loaded,
+ };
+ 
++namespace JuliaType {
++    static inline llvm::StructType* get_jlvalue_ty(llvm::LLVMContext &C) {
++        return llvm::StructType::get(C);
++    }
++
++    static inline llvm::PointerType* get_pjlvalue_ty(llvm::LLVMContext &C) {
++        return llvm::PointerType::get(get_jlvalue_ty(C), 0);
++    }
++
++    static inline llvm::PointerType* get_prjlvalue_ty(llvm::LLVMContext &C) {
++        return llvm::PointerType::get(get_jlvalue_ty(C), AddressSpace::Tracked);
++    }
++
++    static inline llvm::PointerType* get_ppjlvalue_ty(llvm::LLVMContext &C) {
++        return llvm::PointerType::get(get_pjlvalue_ty(C), 0);
++    }
++}
++
+ // JLCALL with API arguments ([extra], arg0, arg1, arg2, ...) has the following ABI calling conventions defined:
+ #define JLCALL_F_CC (CallingConv::ID)37     // (jl_value_t *arg0, jl_value_t **argv, uint32_t nargv)
+ #define JLCALL_F2_CC (CallingConv::ID)38    // (jl_value_t *arg0, jl_value_t **argv, uint32_t nargv, jl_value_t *extra)
+@@ -68,3 +88,66 @@ static inline void llvm_dump(llvm::DebugLoc *dbg)
+     dbg->print(llvm::dbgs());
+     llvm::dbgs() << "\n";
+ }
++
++static inline std::pair<llvm::MDNode*,llvm::MDNode*> tbaa_make_child_with_context(llvm::LLVMContext &ctxt, const char *name, llvm::MDNode *parent=nullptr, bool isConstant=false)
++{
++    llvm::MDBuilder mbuilder(ctxt);
++    llvm::MDNode *jtbaa = mbuilder.createTBAARoot("jtbaa");
++    llvm::MDNode *tbaa_root = mbuilder.createTBAAScalarTypeNode("jtbaa", jtbaa);
++    llvm::MDNode *scalar = mbuilder.createTBAAScalarTypeNode(name, parent ? parent : tbaa_root);
++    llvm::MDNode *n = mbuilder.createTBAAStructTagNode(scalar, scalar, 0, isConstant);
++    return std::make_pair(n, scalar);
++}
++
++static inline llvm::MDNode *get_tbaa_gcframe(llvm::LLVMContext &ctxt) {
++    return tbaa_make_child_with_context(ctxt, "jtbaa_gcframe").first;
++}
++static inline llvm::MDNode *get_tbaa_const(llvm::LLVMContext &ctxt) {
++    return tbaa_make_child_with_context(ctxt, "jtbaa_const", nullptr, true).first;
++}
++
++static inline llvm::Instruction *tbaa_decorate(llvm::MDNode *md, llvm::Instruction *inst)
++{
++    inst->setMetadata(llvm::LLVMContext::MD_tbaa, md);
++    if (llvm::isa<llvm::LoadInst>(inst) && md && md == get_tbaa_const(md->getContext()))
++        inst->setMetadata(llvm::LLVMContext::MD_invariant_load, llvm::MDNode::get(md->getContext(), llvm::None));
++    return inst;
++}
++
++// bitcast a value, but preserve its address space when dealing with pointer types
++static inline llvm::Value *emit_bitcast_with_builder(llvm::IRBuilder<> &builder, llvm::Value *v, llvm::Type *jl_value)
++{
++    using namespace llvm;
++    if (isa<PointerType>(jl_value) &&
++        v->getType()->getPointerAddressSpace() != jl_value->getPointerAddressSpace()) {
++        // Cast to the proper address space
++        Type *jl_value_addr =
++                PointerType::get(cast<PointerType>(jl_value)->getElementType(),
++                                 v->getType()->getPointerAddressSpace());
++        return builder.CreateBitCast(v, jl_value_addr);
++    }
++    else {
++        return builder.CreateBitCast(v, jl_value);
++    }
++}
++
++// Get PTLS through current task.
++static inline llvm::Value *get_current_ptls_from_task(llvm::IRBuilder<> &builder, llvm::Value *current_task)
++{
++    using namespace llvm;
++    auto T_ppjlvalue = JuliaType::get_ppjlvalue_ty(builder.getContext());
++    auto T_size = builder.GetInsertBlock()->getModule()->getDataLayout().getIntPtrType(builder.getContext());
++    const int ptls_offset = offsetof(jl_task_t, ptls);
++    llvm::Value *pptls = builder.CreateInBoundsGEP(
++        JuliaType::get_pjlvalue_ty(builder.getContext()), current_task,
++        ConstantInt::get(T_size, ptls_offset / sizeof(void *)),
++        "ptls_field");
++    LoadInst *ptls_load = builder.CreateAlignedLoad(
++        emit_bitcast_with_builder(builder, pptls, T_ppjlvalue), Align(sizeof(void *)), "ptls_load");
++    // Note: Corresponding store (`t->ptls = ptls`) happens in `ctx_switch` of tasks.c.
++    tbaa_decorate(get_tbaa_gcframe(builder.getContext()), ptls_load);
++    // Using `CastInst::Create` to get an `Instruction*` without explicit cast:
++    auto ptls = CastInst::Create(Instruction::BitCast, ptls_load, T_ppjlvalue, "ptls");
++    builder.Insert(ptls);
++    return ptls;
++}
+\ No newline at end of file
+diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
+index b4e1f5009424..ed5fe7c43a59 100644
+--- a/src/llvm-late-gc-lowering.cpp
++++ b/src/llvm-late-gc-lowering.cpp
+@@ -2296,10 +2296,12 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
+                 // Create a call to the `julia.gc_alloc_bytes` intrinsic, which is like
+                 // `julia.gc_alloc_obj` except it doesn't set the tag.
+                 auto allocBytesIntrinsic = getOrDeclare(jl_intrinsics::GCAllocBytes);
++                auto ptlsLoad = get_current_ptls_from_task(builder, CI->getArgOperand(0));
++                auto ptls = builder.CreateBitCast(ptlsLoad, Type::getInt8PtrTy(builder.getContext()));
+                 auto newI = builder.CreateCall(
+                     allocBytesIntrinsic,
+                     {
+-                        CI->getArgOperand(0),
++                        ptls,
+                         builder.CreateIntCast(
+                             CI->getArgOperand(1),
+                             allocBytesIntrinsic->getFunctionType()->getParamType(1),

Copied: julia/repos/community-staging-x86_64/julia-gcc-12.patch (from rev 1238980, julia/trunk/julia-gcc-12.patch)
===================================================================
--- community-staging-x86_64/julia-gcc-12.patch	                        (rev 0)
+++ community-staging-x86_64/julia-gcc-12.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,521 @@
+--- src/llvm-demote-float16.cpp  2022-05-24 16:26:36.982535055 +0000
++++ src/llvm-demote-float16.cpp  2022-05-24 19:30:17.191673155 +0000
+@@ -27,6 +27,166 @@
+ 
+ namespace {
+ 
++inline AttributeSet getFnAttrs(const AttributeList &Attrs)
++{
++#if JL_LLVM_VERSION >= 140000
++    return Attrs.getFnAttrs();
++#else
++    return Attrs.getFnAttributes();
++#endif
++}
++
++inline AttributeSet getRetAttrs(const AttributeList &Attrs)
++{
++#if JL_LLVM_VERSION >= 140000
++    return Attrs.getRetAttrs();
++#else
++    return Attrs.getRetAttributes();
++#endif
++}
++
++static Instruction *replaceIntrinsicWith(IntrinsicInst *call, Type *RetTy, ArrayRef<Value*> args)
++{
++    Intrinsic::ID ID = call->getIntrinsicID();
++    assert(ID);
++    auto oldfType = call->getFunctionType();
++    auto nargs = oldfType->getNumParams();
++    assert(args.size() > nargs);
++    SmallVector<Type*, 8> argTys(nargs);
++    for (unsigned i = 0; i < nargs; i++)
++        argTys[i] = args[i]->getType();
++    auto newfType = FunctionType::get(RetTy, argTys, oldfType->isVarArg());
++
++    // Accumulate an array of overloaded types for the given intrinsic
++    // and compute the new name mangling schema
++    SmallVector<Type*, 4> overloadTys;
++    {
++        SmallVector<Intrinsic::IITDescriptor, 8> Table;
++        getIntrinsicInfoTableEntries(ID, Table);
++        ArrayRef<Intrinsic::IITDescriptor> TableRef = Table;
++        auto res = Intrinsic::matchIntrinsicSignature(newfType, TableRef, overloadTys);
++        assert(res == Intrinsic::MatchIntrinsicTypes_Match);
++        (void)res;
++        bool matchvararg = !Intrinsic::matchIntrinsicVarArg(newfType->isVarArg(), TableRef);
++        assert(matchvararg);
++        (void)matchvararg;
++    }
++    auto newF = Intrinsic::getDeclaration(call->getModule(), ID, overloadTys);
++    assert(newF->getFunctionType() == newfType);
++    newF->setCallingConv(call->getCallingConv());
++    assert(args.back() == call->getCalledFunction());
++    auto newCall = CallInst::Create(newF, args.drop_back(), "", call);
++    newCall->setTailCallKind(call->getTailCallKind());
++    auto old_attrs = call->getAttributes();
++    newCall->setAttributes(AttributeList::get(call->getContext(), getFnAttrs(old_attrs),
++                                              getRetAttrs(old_attrs), {})); // drop parameter attributes
++    return newCall;
++}
++
++
++static Value* CreateFPCast(Instruction::CastOps opcode, Value *V, Type *DestTy, IRBuilder<> &builder)
++{
++
++    Type *SrcTy = V->getType();
++    Type *RetTy = DestTy;
++    if (auto *VC = dyn_cast<Constant>(V)) {
++        // The input IR often has things of the form
++        //   fcmp olt half %0, 0xH7C00
++        // and we would like to avoid turning that constant into a call here
++        // if we can simply constant fold it to the new type.
++        VC = ConstantExpr::getCast(opcode, VC, DestTy, true);
++        if (VC)
++            return VC;
++    }
++    assert(SrcTy->isVectorTy() == DestTy->isVectorTy());
++    if (SrcTy->isVectorTy()) {
++        unsigned NumElems = cast<FixedVectorType>(SrcTy)->getNumElements();
++        assert(cast<FixedVectorType>(DestTy)->getNumElements() == NumElems && "Mismatched cast");
++        Value *NewV = UndefValue::get(DestTy);
++        RetTy = RetTy->getScalarType();
++        for (unsigned i = 0; i < NumElems; ++i) {
++            Value *I = builder.getInt32(i);
++            Value *Vi = builder.CreateExtractElement(V, I);
++            Vi = CreateFPCast(opcode, Vi, RetTy, builder);
++            NewV = builder.CreateInsertElement(NewV, Vi, I);
++        }
++        return NewV;
++    }
++    auto &M = *builder.GetInsertBlock()->getModule();
++    auto &ctx = M.getContext();
++    // Pick the Function to call in the Julia runtime
++    StringRef Name;
++    switch (opcode) {
++    case Instruction::FPExt:
++        // this is exact, so we only need one conversion
++        assert(SrcTy->isHalfTy());
++        Name = "julia__gnu_h2f_ieee";
++        RetTy = Type::getFloatTy(ctx);
++        break;
++    case Instruction::FPTrunc:
++        assert(DestTy->isHalfTy());
++        if (SrcTy->isFloatTy())
++            Name = "julia__gnu_f2h_ieee";
++        else if (SrcTy->isDoubleTy())
++            Name = "julia__truncdfhf2";
++        break;
++    // All F16 fit exactly in Int32 (-65504 to 65504)
++    case Instruction::FPToSI: JL_FALLTHROUGH;
++    case Instruction::FPToUI:
++        assert(SrcTy->isHalfTy());
++        Name = "julia__gnu_h2f_ieee";
++        RetTy = Type::getFloatTy(ctx);
++        break;
++    case Instruction::SIToFP: JL_FALLTHROUGH;
++    case Instruction::UIToFP:
++        assert(DestTy->isHalfTy());
++        Name = "julia__gnu_f2h_ieee";
++        SrcTy = Type::getFloatTy(ctx);
++        break;
++    default:
++        errs() << Instruction::getOpcodeName(opcode) << ' ';
++        V->getType()->print(errs());
++        errs() << " to ";
++        DestTy->print(errs());
++        errs() << " is an ";
++        llvm_unreachable("invalid cast");
++    }
++    if (Name.empty()) {
++        errs() << Instruction::getOpcodeName(opcode) << ' ';
++        V->getType()->print(errs());
++        errs() << " to ";
++        DestTy->print(errs());
++        errs() << " is an ";
++        llvm_unreachable("illegal cast");
++    }
++    // Coerce the source to the required size and type
++    auto T_int16 = Type::getInt16Ty(ctx);
++    if (SrcTy->isHalfTy())
++        SrcTy = T_int16;
++    if (opcode == Instruction::SIToFP)
++        V = builder.CreateSIToFP(V, SrcTy);
++    else if (opcode == Instruction::UIToFP)
++        V = builder.CreateUIToFP(V, SrcTy);
++    else
++        V = builder.CreateBitCast(V, SrcTy);
++    // Call our intrinsic
++    if (RetTy->isHalfTy())
++        RetTy = T_int16;
++    auto FT = FunctionType::get(RetTy, {SrcTy}, false);
++    FunctionCallee F = M.getOrInsertFunction(Name, FT);
++    Value *I = builder.CreateCall(F, {V});
++    // Coerce the result to the expected type
++    if (opcode == Instruction::FPToSI)
++        I = builder.CreateFPToSI(I, DestTy);
++    else if (opcode == Instruction::FPToUI)
++        I = builder.CreateFPToUI(I, DestTy);
++    else if (opcode == Instruction::FPExt)
++        I = builder.CreateFPCast(I, DestTy);
++    else
++        I = builder.CreateBitCast(I, DestTy);
++    return I;
++}
++
+ struct DemoteFloat16Pass : public FunctionPass {
+     static char ID;
+     DemoteFloat16Pass() : FunctionPass(ID){};
+@@ -35,15 +195,40 @@
+     bool runOnFunction(Function &F) override;
+ };
+ 
++Type *_getWithNewType(Type *VTyp, Type *EltTy) {
++  if (auto *VTy = dyn_cast<VectorType>(VTyp))
++    return VectorType::get(EltTy, VTy->getElementCount());
++  return EltTy;
++}
++
++
+ bool DemoteFloat16Pass::runOnFunction(Function &F)
+ {
+     auto &ctx = F.getContext();
+-    auto T_float16 = Type::getHalfTy(ctx);
+     auto T_float32 = Type::getFloatTy(ctx);
+ 
+     SmallVector<Instruction *, 0> erase;
+     for (auto &BB : F) {
+         for (auto &I : BB) {
++            // extend Float16 operands to Float32
++            bool Float16 = I.getType()->getScalarType()->isHalfTy();
++            for (size_t i = 0; !Float16 && i < I.getNumOperands(); i++) {
++                Value *Op = I.getOperand(i);
++                if (Op->getType()->getScalarType()->isHalfTy())
++                    Float16 = true;
++            }
++            if (!Float16)
++                continue;
++
++            if (auto CI = dyn_cast<CastInst>(&I)) {
++                if (CI->getOpcode() != Instruction::BitCast) { // aka !CI->isNoopCast(DL)
++                    IRBuilder<> builder(&I);
++                    Value *NewI = CreateFPCast(CI->getOpcode(), I.getOperand(0), I.getType(), builder);
++                    I.replaceAllUsesWith(NewI);
++                    erase.push_back(&I);
++                }
++                continue;
++            }
+             switch (I.getOpcode()) {
+             case Instruction::FNeg:
+             case Instruction::FAdd:
+@@ -54,6 +239,9 @@
+             case Instruction::FCmp:
+                 break;
+             default:
++                if (auto intrinsic = dyn_cast<IntrinsicInst>(&I))
++                    if (intrinsic->getIntrinsicID())
++                        break;
+                 continue;
+             }
+ 
+@@ -65,61 +253,68 @@
+             IRBuilder<> builder(&I);
+ 
+             // extend Float16 operands to Float32
+-            bool OperandsChanged = false;
++            // XXX: Calls to llvm.fma.f16 may need to go to f64 to be correct?
+             SmallVector<Value *, 2> Operands(I.getNumOperands());
+             for (size_t i = 0; i < I.getNumOperands(); i++) {
+                 Value *Op = I.getOperand(i);
+-                if (Op->getType() == T_float16) {
+-                    Op = builder.CreateFPExt(Op, T_float32);
+-                    OperandsChanged = true;
++                if (Op->getType()->getScalarType()->isHalfTy()) {
++                    Op = CreateFPCast(Instruction::FPExt, Op, _getWithNewType(Op->getType(), T_float32), builder);
+                 }
+                 Operands[i] = (Op);
+             }
+ 
+             // recreate the instruction if any operands changed,
+             // truncating the result back to Float16
+-            if (OperandsChanged) {
+-                Value *NewI;
+-                switch (I.getOpcode()) {
+-                case Instruction::FNeg:
+-                    assert(Operands.size() == 1);
+-                    NewI = builder.CreateFNeg(Operands[0]);
+-                    break;
+-                case Instruction::FAdd:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFAdd(Operands[0], Operands[1]);
+-                    break;
+-                case Instruction::FSub:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFSub(Operands[0], Operands[1]);
+-                    break;
+-                case Instruction::FMul:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFMul(Operands[0], Operands[1]);
+-                    break;
+-                case Instruction::FDiv:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFDiv(Operands[0], Operands[1]);
+-                    break;
+-                case Instruction::FRem:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFRem(Operands[0], Operands[1]);
+-                    break;
+-                case Instruction::FCmp:
+-                    assert(Operands.size() == 2);
+-                    NewI = builder.CreateFCmp(cast<FCmpInst>(&I)->getPredicate(),
+-                                              Operands[0], Operands[1]);
++            Value *NewI;
++            switch (I.getOpcode()) {
++            case Instruction::FNeg:
++                assert(Operands.size() == 1);
++                NewI = builder.CreateFNeg(Operands[0]);
++                break;
++            case Instruction::FAdd:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFAdd(Operands[0], Operands[1]);
++                break;
++            case Instruction::FSub:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFSub(Operands[0], Operands[1]);
++                break;
++            case Instruction::FMul:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFMul(Operands[0], Operands[1]);
++                break;
++            case Instruction::FDiv:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFDiv(Operands[0], Operands[1]);
++                break;
++            case Instruction::FRem:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFRem(Operands[0], Operands[1]);
++                break;
++            case Instruction::FCmp:
++                assert(Operands.size() == 2);
++                NewI = builder.CreateFCmp(cast<FCmpInst>(&I)->getPredicate(),
++                                          Operands[0], Operands[1]);
++                break;
++            default:
++                if (auto intrinsic = dyn_cast<IntrinsicInst>(&I)) {
++                    // XXX: this is not correct in general
++                    // some obvious failures include llvm.convert.to.fp16.*, llvm.vp.*to*, llvm.experimental.constrained.*to*, llvm.masked.*
++                    Type *RetTy = I.getType();
++                    if (RetTy->getScalarType()->isHalfTy())
++                        RetTy = _getWithNewType(RetTy, T_float32);
++                    NewI = replaceIntrinsicWith(intrinsic, RetTy, Operands);
+                     break;
+-                default:
+-                    abort();
+                 }
+-                cast<Instruction>(NewI)->copyMetadata(I);
+-                cast<Instruction>(NewI)->copyFastMathFlags(&I);
+-                if (NewI->getType() != I.getType())
+-                    NewI = builder.CreateFPTrunc(NewI, I.getType());
+-                I.replaceAllUsesWith(NewI);
+-                erase.push_back(&I);
++                abort();
++            }
++            cast<Instruction>(NewI)->copyMetadata(I);
++            cast<Instruction>(NewI)->copyFastMathFlags(&I);
++            if (NewI->getType() != I.getType()) {
++                NewI = CreateFPCast(Instruction::FPTrunc, NewI, I.getType(), builder);
+             }
++            I.replaceAllUsesWith(NewI);
++            erase.push_back(&I);
+         }
+     }
+ 
+
+--- src/runtime_intrinsics.c  2022-05-24 16:27:19.292819527 +0000
++++ src/runtime_intrinsics.c  2022-05-24 16:44:16.062717753 +0000
+@@ -338,9 +338,9 @@
+     }
+ 
+ #define fp_select(a, func) \
+-    sizeof(a) == sizeof(float) ? func##f((float)a) : func(a)
++    sizeof(a) <= sizeof(float) ? func##f((float)a) : func(a)
+ #define fp_select2(a, b, func) \
+-    sizeof(a) == sizeof(float) ? func##f(a, b) : func(a, b)
++    sizeof(a) <= sizeof(float) ? func##f(a, b) : func(a, b)
+ 
+ // fast-function generators //
+ 
+@@ -384,11 +384,11 @@
+ static inline void name(unsigned osize, void *pa, void *pr) JL_NOTSAFEPOINT \
+ { \
+     uint16_t a = *(uint16_t*)pa; \
+-    float A = __gnu_h2f_ieee(a); \
++    float A = julia__gnu_h2f_ieee(a); \
+     if (osize == 16) { \
+         float R; \
+         OP(&R, A); \
+-        *(uint16_t*)pr = __gnu_f2h_ieee(R); \
++        *(uint16_t*)pr = julia__gnu_f2h_ieee(R); \
+     } else { \
+         OP((uint16_t*)pr, A); \
+     } \
+@@ -412,11 +412,11 @@
+ { \
+     uint16_t a = *(uint16_t*)pa; \
+     uint16_t b = *(uint16_t*)pb; \
+-    float A = __gnu_h2f_ieee(a); \
+-    float B = __gnu_h2f_ieee(b); \
++    float A = julia__gnu_h2f_ieee(a); \
++    float B = julia__gnu_h2f_ieee(b); \
+     runtime_nbits = 16; \
+     float R = OP(A, B); \
+-    *(uint16_t*)pr = __gnu_f2h_ieee(R); \
++    *(uint16_t*)pr = julia__gnu_f2h_ieee(R); \
+ }
+ 
+ // float or integer inputs, bool output
+@@ -437,8 +437,8 @@
+ { \
+     uint16_t a = *(uint16_t*)pa; \
+     uint16_t b = *(uint16_t*)pb; \
+-    float A = __gnu_h2f_ieee(a); \
+-    float B = __gnu_h2f_ieee(b); \
++    float A = julia__gnu_h2f_ieee(a); \
++    float B = julia__gnu_h2f_ieee(b); \
+     runtime_nbits = 16; \
+     return OP(A, B); \
+ }
+@@ -478,12 +478,12 @@
+     uint16_t a = *(uint16_t*)pa; \
+     uint16_t b = *(uint16_t*)pb; \
+     uint16_t c = *(uint16_t*)pc; \
+-    float A = __gnu_h2f_ieee(a); \
+-    float B = __gnu_h2f_ieee(b); \
+-    float C = __gnu_h2f_ieee(c); \
++    float A = julia__gnu_h2f_ieee(a); \
++    float B = julia__gnu_h2f_ieee(b); \
++    float C = julia__gnu_h2f_ieee(c); \
+     runtime_nbits = 16; \
+     float R = OP(A, B, C); \
+-    *(uint16_t*)pr = __gnu_f2h_ieee(R); \
++    *(uint16_t*)pr = julia__gnu_f2h_ieee(R); \
+ }
+ 
+ 
+@@ -1001,7 +1001,7 @@
+ fpiseq_n(float, 32)
+ fpiseq_n(double, 64)
+ #define fpiseq(a,b) \
+-    sizeof(a) == sizeof(float) ? fpiseq32(a, b) : fpiseq64(a, b)
++    sizeof(a) <= sizeof(float) ? fpiseq32(a, b) : fpiseq64(a, b)
+ 
+ bool_fintrinsic(eq,eq_float)
+ bool_fintrinsic(ne,ne_float)
+@@ -1050,7 +1050,7 @@
+         if (!(osize < 8 * sizeof(a))) \
+             jl_error("fptrunc: output bitsize must be < input bitsize"); \
+         else if (osize == 16) \
+-            *(uint16_t*)pr = __gnu_f2h_ieee(a); \
++            *(uint16_t*)pr = julia__gnu_f2h_ieee(a); \
+         else if (osize == 32) \
+             *(float*)pr = a; \
+         else if (osize == 64) \
+
+--- src/julia_internal.h  2022-05-24 16:26:09.953046957 +0000
++++ src/julia_internal.h  2022-05-24 16:28:59.610039708 +0000
+@@ -1427,8 +1427,9 @@
+   #define JL_GC_ASSERT_LIVE(x) (void)(x)
+ #endif
+ 
+-float __gnu_h2f_ieee(uint16_t param) JL_NOTSAFEPOINT;
+-uint16_t __gnu_f2h_ieee(float param) JL_NOTSAFEPOINT;
++JL_DLLEXPORT float julia__gnu_h2f_ieee(uint16_t param) JL_NOTSAFEPOINT;
++JL_DLLEXPORT uint16_t julia__gnu_f2h_ieee(float param) JL_NOTSAFEPOINT;
++JL_DLLEXPORT uint16_t julia__truncdfhf2(double param) JL_NOTSAFEPOINT;
+ 
+ #ifdef __cplusplus
+ }
+
+--- src/intrinsics.cpp  2022-05-24 17:18:23.008583654 +0000
++++ src/intrinsics.cpp  2022-05-24 19:56:09.991480454 +0000
+@@ -1633,24 +1633,17 @@
+     return h;
+ }
+ 
+-#if !defined(_OS_DARWIN_)   // xcode already links compiler-rt
+-
+-extern "C" JL_DLLEXPORT float __gnu_h2f_ieee(uint16_t param)
+-{
+-    return half_to_float(param);
+-}
+-
+-extern "C" JL_DLLEXPORT float __extendhfsf2(uint16_t param)
++extern "C" JL_DLLEXPORT float julia__gnu_h2f_ieee(uint16_t param)
+ {
+     return half_to_float(param);
+ }
+ 
+-extern "C" JL_DLLEXPORT uint16_t __gnu_f2h_ieee(float param)
++extern "C" JL_DLLEXPORT uint16_t julia__gnu_f2h_ieee(float param)
+ {
+     return float_to_half(param);
+ }
+ 
+-extern "C" JL_DLLEXPORT uint16_t __truncdfhf2(double param)
++extern "C" JL_DLLEXPORT uint16_t julia__truncdfhf2(double param)
+ {
+     float res = (float)param;
+     uint32_t resi;
+@@ -1671,5 +1664,3 @@
+     }
+     return float_to_half(res);
+ }
+-
+-#endif
+
+--- src/julia.expmap  2022-05-24 16:25:48.787865159 +0000
++++ src/julia.expmap  2022-05-24 16:28:39.517014539 +0000
+@@ -42,12 +42,6 @@
+     environ;
+     __progname;
+ 
+-    /* compiler run-time intrinsics */
+-    __gnu_h2f_ieee;
+-    __extendhfsf2;
+-    __gnu_f2h_ieee;
+-    __truncdfhf2;
+-
+   local:
+     *;
+ };
+
+--- src/APInt-C.cpp  2022-05-24 16:25:05.957426445 +0000
++++ src/APInt-C.cpp  2022-05-24 16:28:27.792411828 +0000
+@@ -316,7 +316,7 @@
+ void LLVMFPtoInt(unsigned numbits, void *pa, unsigned onumbits, integerPart *pr, bool isSigned, bool *isExact) {
+     double Val;
+     if (numbits == 16)
+-        Val = __gnu_h2f_ieee(*(uint16_t*)pa);
++        Val = julia__gnu_h2f_ieee(*(uint16_t*)pa);
+     else if (numbits == 32)
+         Val = *(float*)pa;
+     else if (numbits == 64)
+@@ -391,7 +391,7 @@
+         val = a.roundToDouble(true);
+     }
+     if (onumbits == 16)
+-        *(uint16_t*)pr = __gnu_f2h_ieee(val);
++        *(uint16_t*)pr = julia__gnu_f2h_ieee(val);
+     else if (onumbits == 32)
+         *(float*)pr = val;
+     else if (onumbits == 64)
+@@ -408,7 +408,7 @@
+         val = a.roundToDouble(false);
+     }
+     if (onumbits == 16)
+-        *(uint16_t*)pr = __gnu_f2h_ieee(val);
++        *(uint16_t*)pr = julia__gnu_f2h_ieee(val);
+     else if (onumbits == 32)
+         *(float*)pr = val;
+     else if (onumbits == 64)

Copied: julia/repos/community-staging-x86_64/julia-hardcoded-libs.patch (from rev 1238980, julia/trunk/julia-hardcoded-libs.patch)
===================================================================
--- community-staging-x86_64/julia-hardcoded-libs.patch	                        (rev 0)
+++ community-staging-x86_64/julia-hardcoded-libs.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,69 @@
+diff --git a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
+index a7ca666b23..b84a42f4e7 100644
+--- a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
++++ b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
+@@ -31,9 +31,9 @@ elseif Sys.isapple()
+     const libmbedtls = "@rpath/libmbedtls.13.dylib"
+     const libmbedx509 = "@rpath/libmbedx509.1.dylib"
+ else
+-    const libmbedcrypto = "libmbedcrypto.so.5"
+-    const libmbedtls = "libmbedtls.so.13"
+-    const libmbedx509 = "libmbedx509.so.1"
++    const libmbedcrypto = "libmbedcrypto.so"
++    const libmbedtls = "libmbedtls.so"
++    const libmbedx509 = "libmbedx509.so"
+ end
+ 
+ function __init__()
+diff --git a/stdlib/libLLVM_jll/src/libLLVM_jll.jl b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
+index fa45e754e5..b51812e3a8 100644
+--- a/stdlib/libLLVM_jll/src/libLLVM_jll.jl
++++ b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
+@@ -23,7 +23,7 @@ if Sys.iswindows()
+ elseif Sys.isapple()
+     const libLLVM = "@rpath/libLLVM.dylib"
+ else
+-    const libLLVM = "libLLVM-12jl.so"
++    const libLLVM = "libLLVM.so"
+ end
+ 
+ function __init__()
+diff --git a/stdlib/nghttp2_jll/src/nghttp2_jll.jl b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
+index 8b98c76ac5..77ad9e3800 100644
+--- a/stdlib/nghttp2_jll/src/nghttp2_jll.jl
++++ b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
+@@ -22,7 +22,7 @@ if Sys.iswindows()
+ elseif Sys.isapple()
+     const libnghttp2 = "@rpath/libnghttp2.14.dylib"
+ else
+-    const libnghttp2 = "libnghttp2.so.14"
++    const libnghttp2 = "libnghttp2.so"
+ end
+ 
+ function __init__()
+diff --git a/stdlib/LibGit2_jll/src/LibGit2_jll.jl b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
+index f0d4b5dda6..2ed3017b51 100644
+--- a/stdlib/LibGit2_jll/src/LibGit2_jll.jl
++++ b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
+@@ -23,7 +23,7 @@ if Sys.iswindows()
+ elseif Sys.isapple()
+     const libgit2 = "@rpath/libgit2.1.1.dylib"
+ else
+-    const libgit2 = "libgit2.so.1.1"
++    const libgit2 = "libgit2.so"
+ end
+ 
+ function __init__()
+diff --git a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
+index 215de8aed6..918d1ffdc2 100644
+--- a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
++++ b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
+@@ -22,7 +22,7 @@ if Sys.iswindows()
+ elseif Sys.isapple()
+     const libopenlibm = "@rpath/libopenlibm.3.dylib"
+ else
+-    const libopenlibm = "libopenlibm.so.3"
++    const libopenlibm = "libopenlibm.so"
+ end
+ 
+ function __init__()

Copied: julia/repos/community-staging-x86_64/julia-libblastrampoline-4.patch (from rev 1238980, julia/trunk/julia-libblastrampoline-4.patch)
===================================================================
--- community-staging-x86_64/julia-libblastrampoline-4.patch	                        (rev 0)
+++ community-staging-x86_64/julia-libblastrampoline-4.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,15 @@
+diff --git a/stdlib/LinearAlgebra/src/lbt.jl b/stdlib/LinearAlgebra/src/lbt.jl
+index 26b3a1210a3f..ea1ab25c9e1a 100644
+--- a/stdlib/LinearAlgebra/src/lbt.jl
++++ b/stdlib/LinearAlgebra/src/lbt.jl
+@@ -156,8 +156,8 @@ function lbt_set_num_threads(nthreads)
+     return ccall((:lbt_set_num_threads, libblastrampoline), Cvoid, (Int32,), nthreads)
+ end
+ 
+-function lbt_forward(path; clear::Bool = false, verbose::Bool = false)
+-    ccall((:lbt_forward, libblastrampoline), Int32, (Cstring, Int32, Int32), path, clear ? 1 : 0, verbose ? 1 : 0)
++function lbt_forward(path; clear::Bool = false, verbose::Bool = false, suffix_hint::Union{String,Nothing} = nothing)
++    ccall((:lbt_forward, libblastrampoline), Int32, (Cstring, Int32, Int32, Cstring), path, clear ? 1 : 0, verbose ? 1 : 0, something(suffix_hint, C_NULL))
+ end
+ 
+ function lbt_set_default_func(addr)

Copied: julia/repos/community-staging-x86_64/julia-libgit-1.2.patch (from rev 1238980, julia/trunk/julia-libgit-1.2.patch)
===================================================================
--- community-staging-x86_64/julia-libgit-1.2.patch	                        (rev 0)
+++ community-staging-x86_64/julia-libgit-1.2.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,213 @@
+diff --git a/deps/checksums/libgit2 b/deps/checksums/libgit2
+index 6d836e4a4501c..9b360b711ceb5 100644
+--- a/deps/checksums/libgit2
++++ b/deps/checksums/libgit2
+@@ -1,34 +1,34 @@
+-libgit2-7f4fa178629d559c037a1f72f79f79af9c1ef8ce.tar.gz/md5/c6a819fb0bf924df61e1595624a0988a
+-libgit2-7f4fa178629d559c037a1f72f79f79af9c1ef8ce.tar.gz/sha512/3de9c042115b309dae3b8e0008edf2e762addd90a7bdb54b3cf634811271ab9dbfea35656650eb53a3faec73caf33ed199fb885ec21f611c79d909d9f4fe48c5
+-LibGit2.v1.2.3+0.aarch64-apple-darwin.tar.gz/md5/0eb4d35fa6078de8da3dc79a420d5bc5
+-LibGit2.v1.2.3+0.aarch64-apple-darwin.tar.gz/sha512/aff23e9d56827be54d8f515489eed92d9cb4d9a1b69c12bbee44fa1343ebc906b38b082c11e6ecb227d256de5cba19b2f3a03c022b88809a33c225c34db08f7c
+-LibGit2.v1.2.3+0.aarch64-linux-gnu.tar.gz/md5/f2f31aa978e43aa68a0e73107067c7cd
+-LibGit2.v1.2.3+0.aarch64-linux-gnu.tar.gz/sha512/46f1ed9158cc00fc0ca71768e9a475d99597e4e63d806b061f08c2b5de40ecde61020f60ad4ff5a7377b52dfcd910c6610022fd95c1a08aa9af305489712786f
+-LibGit2.v1.2.3+0.aarch64-linux-musl.tar.gz/md5/aa1429e946185092bacda87fb5ff4ed2
+-LibGit2.v1.2.3+0.aarch64-linux-musl.tar.gz/sha512/2ab81db22c4ca9855a84835174cee249bc95c3a3158b72fe0c8d18da074ef7a7790bbd90ffb4ec5847ff23ef6098e7d9410ab765c27bdba8bafed5ab3820452a
+-LibGit2.v1.2.3+0.armv6l-linux-gnueabihf.tar.gz/md5/07bef4e0e69f1b1cfe870f554262bd3c
+-LibGit2.v1.2.3+0.armv6l-linux-gnueabihf.tar.gz/sha512/ccd424e5722e3319aa6dea25e088b7ab4ef30afbab57ba243c92db2cd9906d2b6110b866d4aee61bcd8a29e75fc6399b59109a1457d0fe4dd0e1d2c77aef3808
+-LibGit2.v1.2.3+0.armv6l-linux-musleabihf.tar.gz/md5/cb56cabe9e705e8ca81ea8f890498bc5
+-LibGit2.v1.2.3+0.armv6l-linux-musleabihf.tar.gz/sha512/45823b4f8fbd472fb508c0186baddb480f02356d193e493a541b064c92a919bbfad83df7ffa8b1631446c099e29cb109f4e1519246f9511ab81973ada9e2e22b
+-LibGit2.v1.2.3+0.armv7l-linux-gnueabihf.tar.gz/md5/ea80b5ca2fa469f5056d3716d173e15d
+-LibGit2.v1.2.3+0.armv7l-linux-gnueabihf.tar.gz/sha512/9040d8841dfcc26af42b409f776ce19bc232b7bf9679cd291c802d8e8186dd52d55bf085ca5bafdf1090a224c6fdf5bb42722434a8d771809d0bb083a768df90
+-LibGit2.v1.2.3+0.armv7l-linux-musleabihf.tar.gz/md5/be089f9e5986deca632f170b137879e3
+-LibGit2.v1.2.3+0.armv7l-linux-musleabihf.tar.gz/sha512/3266a3d40278324f4def5ff0823fce4859bc4eb065919500265ff962d01c7ebbcdfb8ba43b09d00a05ea2bb53a82984166442dfbc33ed6870a48b8af6cd26feb
+-LibGit2.v1.2.3+0.i686-linux-gnu.tar.gz/md5/27b9d4e956ce649d0c3c412e65662e4d
+-LibGit2.v1.2.3+0.i686-linux-gnu.tar.gz/sha512/85160f6950affbc8e161bf054ecdcf5cc09ecfac410765dae5f7ba35b3f2f5eb1a94f5b0299c1500ea6972be8dc2b9f0802a2f587c74aac4236c2c9c325fd573
+-LibGit2.v1.2.3+0.i686-linux-musl.tar.gz/md5/5f8f66ace7a0d564d36a93f6c60f2e9a
+-LibGit2.v1.2.3+0.i686-linux-musl.tar.gz/sha512/0438682a560ebdd13db1786748e5f08af327a6b9b9b8a4c70606696db4d311b45129ea67b960e14a4db948cbd741039afc3f4e9284adb209de168265b146d8eb
+-LibGit2.v1.2.3+0.i686-w64-mingw32.tar.gz/md5/b36dd8bffdc106c2f9cc6c8a694eed01
+-LibGit2.v1.2.3+0.i686-w64-mingw32.tar.gz/sha512/72d9230281b51f9530c3a33a139633b0e7199de3e001e1c265ac7d393ba5c6042b8fdc822b8a3bf661e113166459b2d61b8251dfdb68231bc3b7a3f10efc3bb6
+-LibGit2.v1.2.3+0.powerpc64le-linux-gnu.tar.gz/md5/6060a6bf226eae115b1af93937523104
+-LibGit2.v1.2.3+0.powerpc64le-linux-gnu.tar.gz/sha512/424e6b174c1cf19602fe0c2f01c432bc31e810a533093d990ef5e3bac46e23ff509437151f2932cf21b3bdd626c877689049fbe8891991256d8672dcc3339efc
+-LibGit2.v1.2.3+0.x86_64-apple-darwin.tar.gz/md5/10431767db6173db70cfd34a14223f3a
+-LibGit2.v1.2.3+0.x86_64-apple-darwin.tar.gz/sha512/8217b832ec98986465d89d3262cb2a9e409595978e39a5e21cc2c808576354515398a597c608258e74c7dc80cebb2563134ee6f903fd2ce371b4fdb953b07323
+-LibGit2.v1.2.3+0.x86_64-linux-gnu.tar.gz/md5/2e1d21253669ef438840662d661c0b4f
+-LibGit2.v1.2.3+0.x86_64-linux-gnu.tar.gz/sha512/c739d47165dff39800d4f3915c31d06dbe430f26730e00e04314fe813c4170d253f74cda6d8707c9240f3f0774b7e2ee9986c553a2892074756698b9eea6b7f1
+-LibGit2.v1.2.3+0.x86_64-linux-musl.tar.gz/md5/cf61d8502d04e9c561da341182c94aae
+-LibGit2.v1.2.3+0.x86_64-linux-musl.tar.gz/sha512/74aa67ab5a43fafcf6cb0a6389031e41d996f63b2a9b1fd6b0ff72159a10d199216fe1c4b882c6e7e052178db7d5213d7073ffc14ec648af19bea5eb55733e15
+-LibGit2.v1.2.3+0.x86_64-unknown-freebsd.tar.gz/md5/e1623fd3f8f564085d47ec650a40e724
+-LibGit2.v1.2.3+0.x86_64-unknown-freebsd.tar.gz/sha512/295d55b78b21ef1c2ba471c8b5618b168dd633e986db9e1ec3e9630e352446ab18e8fd0992010b6afdd922463bb285bc45885a8b35a502d574553fe61c1f7b9f
+-LibGit2.v1.2.3+0.x86_64-w64-mingw32.tar.gz/md5/c845901c4d9dc145f76469d45abad934
+-LibGit2.v1.2.3+0.x86_64-w64-mingw32.tar.gz/sha512/21951f3bc902f30b8cc75c3af233aa7fe8457e412e7758d556bf71de149c7f2325a5c4c204a7a462cc6a61b3dcb90f0d25e684ffd8617b0a1505a1d31cf2f69a
++LibGit2.v1.3.0+0.aarch64-apple-darwin.tar.gz/md5/af98f6fafe5678873b7f974c481c4238
++LibGit2.v1.3.0+0.aarch64-apple-darwin.tar.gz/sha512/1c3509d6b2e00ddfb282e4081a3994302b86cef2ff54c74e63000ec5319cf9f37b7685a14cad85f48a90e37afa507efa97881c27a4f4926fae1b74e96a4aed5a
++LibGit2.v1.3.0+0.aarch64-linux-gnu.tar.gz/md5/4884296753929a70f6f01b36bfec1f61
++LibGit2.v1.3.0+0.aarch64-linux-gnu.tar.gz/sha512/42babda48f23b672ac382780b450e314ee16929c523125246f7d66e11fd27208354fd4d4c7e663e2a6091de78612be0e825f8d1cd4eba595a056838df12fd213
++LibGit2.v1.3.0+0.aarch64-linux-musl.tar.gz/md5/c0b53bfdfa9d4b9e653a5470eccb40c6
++LibGit2.v1.3.0+0.aarch64-linux-musl.tar.gz/sha512/b3d79bbaeb26869066d6b7e228bc2712b67c5dc45badd317c3023eda86d82ac2b712a2126d4049f1074d0ed86ec9f80f9a2e7d6458d47c1d3c953a37a4b3ac0e
++LibGit2.v1.3.0+0.armv6l-linux-gnueabihf.tar.gz/md5/ac91abf4ce2ef1f25729d352c2bd3630
++LibGit2.v1.3.0+0.armv6l-linux-gnueabihf.tar.gz/sha512/c8297da990ead579e285e4347a99a824a81c147965a8394e034690b63e3e84f55f21d37f2754725dacc7836812698a06fb6101fe05b222cbe11d558742986e91
++LibGit2.v1.3.0+0.armv6l-linux-musleabihf.tar.gz/md5/eaf893aabde1ec021bbeda5150df6212
++LibGit2.v1.3.0+0.armv6l-linux-musleabihf.tar.gz/sha512/3bca29dd9bb724db74eae72a9bbeae777e315a616938d76144c2183c9bb9b1656c83de3e7c743c3cba8f2492f74a1cf4254c8942859211f1d6beb514e3532b18
++LibGit2.v1.3.0+0.armv7l-linux-gnueabihf.tar.gz/md5/fd6b13ae9129c6f082ab194782e33c01
++LibGit2.v1.3.0+0.armv7l-linux-gnueabihf.tar.gz/sha512/e236667bc0e3a929b625a410c55fffa0be3f71aef090c3c18c9806ff3c866a0f2dfc1afdcba34d7f0b81b0fd38fa3441b56f4343fedf66c5eead64f059c095d3
++LibGit2.v1.3.0+0.armv7l-linux-musleabihf.tar.gz/md5/9370e574abf25984dda0521b9b3d2df9
++LibGit2.v1.3.0+0.armv7l-linux-musleabihf.tar.gz/sha512/281c7f04d8560f5ef4c9902ace66f41b255e6868d83bbe37e61923371b0752a076f93f249abbd64e6d3849460c2c36dee9207303f0e0eb0ef5d37990aa7337df
++LibGit2.v1.3.0+0.i686-linux-gnu.tar.gz/md5/e0ecd37c7dd9709ddedf3eab8a4f2d47
++LibGit2.v1.3.0+0.i686-linux-gnu.tar.gz/sha512/04ff40e26df0f66413564f4189a031abf538dbea2cd41192164ab5e5361527b18d2a448ca7dacd9754a419d198dd816dd25bfecde4b2cfb1f497aa437a1784a3
++LibGit2.v1.3.0+0.i686-linux-musl.tar.gz/md5/4d98934e46f16eaa3afb597474639de6
++LibGit2.v1.3.0+0.i686-linux-musl.tar.gz/sha512/6d2fea7fe42d12642004f41d31d8ecf5213d0ce7cef3489c96583c9096d8b044b70dd3466bfc2ad901a7302fb8d320713a2ee4bb03702dd7487b0eb0b34966dc
++LibGit2.v1.3.0+0.i686-w64-mingw32.tar.gz/md5/29fc6f7d785aebaed7a916106efaf690
++LibGit2.v1.3.0+0.i686-w64-mingw32.tar.gz/sha512/ac29ef9b8d2d2b44a8d37bba4a40103fb174a55c3210b2b5c6d02baf7cf7f0bbea5acefc5c465ce931fc21275045ad0b39ada32b96795a74e4a46fb405c76398
++LibGit2.v1.3.0+0.powerpc64le-linux-gnu.tar.gz/md5/8b412e41808ff41418b35feab033c445
++LibGit2.v1.3.0+0.powerpc64le-linux-gnu.tar.gz/sha512/fecbcbe322e53a311aa28a6734ca6331438f14e030342efcab7d3f9f2b582c1c23b9d40ce63e1decb92d4d8620685d2e9ae7fadc55bf5db9169590f83327e2de
++LibGit2.v1.3.0+0.x86_64-apple-darwin.tar.gz/md5/033cb0d768a322dc6fc8f1fc58963f62
++LibGit2.v1.3.0+0.x86_64-apple-darwin.tar.gz/sha512/69d6c9e4b38257c89311cdf0a219a8497482c85a7a39c2c6d5819c5d9443d93f4978fbe08291313492f673e02ff4ae709fa4047c3ce015a806b4f22284c1c2cf
++LibGit2.v1.3.0+0.x86_64-linux-gnu.tar.gz/md5/bd7a36813ec371d2a39a98eced238294
++LibGit2.v1.3.0+0.x86_64-linux-gnu.tar.gz/sha512/b3a605a9cb7057f4c9652cd551922b4e11f65d74383a9c5b7a0234b7cf599e0a23cf79695e1db6c760dea194f76b59a347e38e14729b0bcc9b120812b63bb2c3
++LibGit2.v1.3.0+0.x86_64-linux-musl.tar.gz/md5/856ac3655c979881c6c0537f49907d18
++LibGit2.v1.3.0+0.x86_64-linux-musl.tar.gz/sha512/8cae2271bfa4a9dc6168fdd1d6133997756f56c60cd94525357f907109b41cb7d6594f7916557de03f1450b4bc694705f2f21d8426cb909c5678cee7f1477b88
++LibGit2.v1.3.0+0.x86_64-unknown-freebsd.tar.gz/md5/5c864ad058dd9c30340bb1c196d97b66
++LibGit2.v1.3.0+0.x86_64-unknown-freebsd.tar.gz/sha512/e2d3953ebe99743b0f6e62901b953e7c57030cfd5b1cc40d2bda85ed26573212c2e4748f2fdf46d88b75f584471a8b0b287c0a65ef83f502164e92624aaa091e
++LibGit2.v1.3.0+0.x86_64-w64-mingw32.tar.gz/md5/45d92f092eb1a319396dd7ebb36a2273
++LibGit2.v1.3.0+0.x86_64-w64-mingw32.tar.gz/sha512/0f219513972259f131fbc509eb035103a986bf1483f7cf9d0bfbca2802f5bbf23296a36a9f9d72e4d89a70f86acf781aec3d49df6aaf408da4f025f65d559cfa
++libgit2-b7bad55e4bb0a285b073ba5e02b01d3f522fc95d.tar.gz/md5/02582c680d006890def088ffaccea7d8
++libgit2-b7bad55e4bb0a285b073ba5e02b01d3f522fc95d.tar.gz/sha512/ee51c06c012503d66ba28d9c2fc9ad42af69f22fd1ae1be54642820ccd80c74e24d78eeec7fe5222daf2432930bcce163800502db1224571da852238c1970e36
+diff --git a/deps/libgit2.mk b/deps/libgit2.mk
+index 8f6ab58bc00da..5902cc68960ae 100644
+--- a/deps/libgit2.mk
++++ b/deps/libgit2.mk
+@@ -40,28 +40,14 @@ $(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied: $(LIBGIT2_SRC_PATH)/so
+ 		patch -p1 -f < $(SRCDIR)/patches/libgit2-agent-nonfatal.patch
+ 	echo 1 > $@
+ 
+-# This can be removed once a release with https://github.com/libgit2/libgit2/pull/5685 lands
+-$(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied
+-	cd $(LIBGIT2_SRC_PATH) && \
+-		patch -p1 -f < $(SRCDIR)/patches/libgit2-mbedtls-incdir.patch
+-	echo 1 > $@
+-
+-$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied
++$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied
+ 	cd $(LIBGIT2_SRC_PATH) && \
+ 		patch -p1 -f < $(SRCDIR)/patches/libgit2-hostkey.patch
+ 	echo 1 > $@
+ 
+-# This can be removed once a release with https://github.com/libgit2/libgit2/pull/5740 lands
+-$(LIBGIT2_SRC_PATH)/libgit2-continue-zlib.patch-applied: $(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied
+-	cd $(LIBGIT2_SRC_PATH) && \
+-		patch -p1 -f < $(SRCDIR)/patches/libgit2-continue-zlib.patch
+-	echo 1 > $@
+-
+ $(BUILDDIR)/$(LIBGIT2_SRC_DIR)/build-configured: \
+ 	$(LIBGIT2_SRC_PATH)/libgit2-agent-nonfatal.patch-applied \
+-	$(LIBGIT2_SRC_PATH)/libgit2-mbedtls-incdir.patch-applied \
+-	$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied \
+-	$(LIBGIT2_SRC_PATH)/libgit2-continue-zlib.patch-applied
++	$(LIBGIT2_SRC_PATH)/libgit2-hostkey.patch-applied
+ 
+ $(BUILDDIR)/$(LIBGIT2_SRC_DIR)/build-configured: $(LIBGIT2_SRC_PATH)/source-extracted
+ 	mkdir -p $(dir $@)
+diff --git a/deps/libgit2.version b/deps/libgit2.version
+index 7c7c34a4909e0..042f76bba673e 100644
+--- a/deps/libgit2.version
++++ b/deps/libgit2.version
+@@ -1,2 +1,2 @@
+-LIBGIT2_BRANCH=v1.1.0
+-LIBGIT2_SHA1=7f4fa178629d559c037a1f72f79f79af9c1ef8ce
++LIBGIT2_BRANCH=v1.3.0
++LIBGIT2_SHA1=b7bad55e4bb0a285b073ba5e02b01d3f522fc95d
+diff --git a/stdlib/LibGit2/src/callbacks.jl b/stdlib/LibGit2/src/callbacks.jl
+index 18de45a994420..5da032d3143e2 100644
+--- a/stdlib/LibGit2/src/callbacks.jl
++++ b/stdlib/LibGit2/src/callbacks.jl
+@@ -366,8 +366,8 @@ struct CertHostKey
+     sha1    :: NTuple{20,UInt8}
+     sha256  :: NTuple{32,UInt8}
+     type    :: Cint
++    hostkey :: Ptr{Cchar}
+     len     :: Csize_t
+-    data    :: NTuple{1024,UInt8}
+ end
+ 
+ function verify_host_error(message::AbstractString)
+@@ -433,14 +433,14 @@ function ssh_knownhost_check(
+     host  :: AbstractString,
+     cert  :: CertHostKey,
+ )
+-    key = collect(cert.data)[1:cert.len]
++    key = unsafe_wrap(Array, cert.hostkey, cert.len)
+     return ssh_knownhost_check(files, host, key)
+ end
+ 
+ function ssh_knownhost_check(
+     files :: AbstractVector{<:AbstractString},
+     host  :: AbstractString,
+-    key   :: Vector{UInt8},
++    key   :: Vector{Cchar},
+ )
+     if (m = match(r"^(.+):(\d+)$", host)) !== nothing
+         host = m.captures[1]
+@@ -476,7 +476,7 @@ function ssh_knownhost_check(
+             hosts  :: Ptr{Cvoid},
+             host   :: Cstring,
+             port   :: Cint,
+-            key    :: Ptr{UInt8},
++            key    :: Ptr{Cchar},
+             len    :: Csize_t,
+             mask   :: Cint,
+             C_NULL :: Ptr{Ptr{KnownHost}},
+diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
+index b68dbb7c0bf02..2d95596cb276d 100644
+--- a/stdlib/LibGit2/src/types.jl
++++ b/stdlib/LibGit2/src/types.jl
+@@ -230,6 +230,9 @@ Matches the [`git_remote_callbacks`](https://libgit2.org/libgit2/#HEAD/type/git_
+     push_update_reference::Ptr{Cvoid}  = C_NULL
+     push_negotiation::Ptr{Cvoid}       = C_NULL
+     transport::Ptr{Cvoid}              = C_NULL
++    @static if LibGit2.VERSION >= v"1.2.0"
++        remote_ready::Ptr{Cvoid}       = C_NULL
++    end
+     payload::Any                       = nothing
+     @static if LibGit2.VERSION >= v"0.99.0"
+         resolve_url::Ptr{Cvoid}        = C_NULL
+diff --git a/stdlib/LibGit2/test/libgit2.jl b/stdlib/LibGit2/test/libgit2.jl
+index 892fb8bb6f3fe..2357536e19b5c 100644
+--- a/stdlib/LibGit2/test/libgit2.jl
++++ b/stdlib/LibGit2/test/libgit2.jl
+@@ -2473,11 +2473,11 @@ mktempdir() do dir
+             CHECK_FAILURE  = LibGit2.Consts.LIBSSH2_KNOWNHOST_CHECK_FAILURE
+ 
+             # randomly generated hashes matching no hosts
+-            random_key = "\0\0\0\assh-rsa\0\0\0\x01#\0\0\0\x81\0¿\x95\xbe9\xfc9g\n:\xcf&\x06YA\xb5`\x97\xc13A\xbf;T+C\xc9Ut J>\xc5ҍ\xc4_S\x8a \xc1S\xeb\x15FH\xd2a\x04.D\xeeb\xac\x8f\xdb\xcc\xef\xc4l G\x9bR\xafp\x17s<=\x12\xab\x04ڳif\\A\x9ba0\xde%\xdei\x04\xc3\r\xb3\x81w\x88\xec\xc0f\x15A;AÝ\xc0r\xa1\u5fe\xd3\xf6)8\x8e\xa3\xcbc\xee\xdd\$\x04\x0f\xc1\xb4\x1f\xcc\xecK\xe0\x99" |> codeunits |> collect
++            random_key = collect(reinterpret(Cchar, codeunits("\0\0\0\assh-rsa\0\0\0\x01#\0\0\0\x81\0¿\x95\xbe9\xfc9g\n:\xcf&\x06YA\xb5`\x97\xc13A\xbf;T+C\xc9Ut J>\xc5ҍ\xc4_S\x8a \xc1S\xeb\x15FH\xd2a\x04.D\xeeb\xac\x8f\xdb\xcc\xef\xc4l G\x9bR\xafp\x17s<=\x12\xab\x04ڳif\\A\x9ba0\xde%\xdei\x04\xc3\r\xb3\x81w\x88\xec\xc0f\x15A;AÝ\xc0r\xa1\u5fe\xd3\xf6)8\x8e\xa3\xcbc\xee\xdd\$\x04\x0f\xc1\xb4\x1f\xcc\xecK\xe0\x99")))
+             # hashes of the unique github.com fingerprint
+-            github_key = "\0\0\0\assh-rsa\0\0\0\x01#\0\0\x01\x01\0\xab`;\x85\x11\xa6vy\xbd\xb5@\xdb;\xd2\x03K\0J\xe96\xd0k\xe3\xd7`\xf0\x8f˪\xdbN\xb4\xedóǑ\xc7\n\xae\x9at\xc9Xi\xe4wD!«\xea\x92\xe5T0_8\xb5\xfdAK2\b\xe5t\xc37\xe3 \x93e\x18F,vRɋ1\xe1n}\xa6R;\xd2\0t*dD\xd8?\xcd^\x172\xd06sǷ\x81\x15UH{U\xf0\xc4IO8)\xec\xe6\x0f\x94%Z\x95˚\xf57\xd7\xfc\x8c\x7f\xe4\x9e\xf3\x18GN\xf2\x92\t\x92\x05\"e\xb0\xa0n\xa6mJ\x16\x7f\xd9\xf3\xa4\x8a\x1aJ0~\xc1\xea\xaaQI\xa9i\xa6\xac]V\xa5\xefb~Q}\x81\xfbdO[t\\OG\x8e\xcd\b*\x94\x92\xf7D\xaa\xd3&\xf7l\x8cM\xc9\x10\vƫyF\x1d&W\xcbo\x06\xde\xc9.kd\xa6V/\xf0\xe3 \x84\xea\x06\xce\x0e\xa9\xd3ZX;\xfb\0\xbaӌ\x9d\x19p<T\x98\x92\xe5\xaaxܕ\xe2PQ at i" |> codeunits |> collect
++            github_key = collect(reinterpret(Cchar, codeunits("\0\0\0\assh-rsa\0\0\0\x01#\0\0\x01\x01\0\xab`;\x85\x11\xa6vy\xbd\xb5@\xdb;\xd2\x03K\0J\xe96\xd0k\xe3\xd7`\xf0\x8f˪\xdbN\xb4\xedóǑ\xc7\n\xae\x9at\xc9Xi\xe4wD!«\xea\x92\xe5T0_8\xb5\xfdAK2\b\xe5t\xc37\xe3 \x93e\x18F,vRɋ1\xe1n}\xa6R;\xd2\0t*dD\xd8?\xcd^\x172\xd06sǷ\x81\x15UH{U\xf0\xc4IO8)\xec\xe6\x0f\x94%Z\x95˚\xf57\xd7\xfc\x8c\x7f\xe4\x9e\xf3\x18GN\xf2\x92\t\x92\x05\"e\xb0\xa0n\xa6mJ\x16\x7f\xd9\xf3\xa4\x8a\x1aJ0~\xc1\xea\xaaQI\xa9i\xa6\xac]V\xa5\xefb~Q}\x81\xfbdO[t\\OG\x8e\xcd\b*\x94\x92\xf7D\xaa\xd3&\xf7l\x8cM\xc9\x10\vƫyF\x1d&W\xcbo\x06\xde\xc9.kd\xa6V/\xf0\xe3 \x84\xea\x06\xce\x0e\xa9\xd3ZX;\xfb\0\xbaӌ\x9d\x19p<T\x98\x92\xe5\xaaxܕ\xe2PQ at i")))
+             # hashes of the middle github.com fingerprint
+-            gitlab_key = "\0\0\0\vssh-ed25519\0\0\0 \a\xee\br\x95N:\xae\xc6\xfbz\bέtn\x12.\x9dA\xb6\x7f\xe79\xe1\xc7\x13\x95\x0e\xcd\x17_" |> codeunits |> collect
++            gitlab_key = collect(reinterpret(Cchar, codeunits("\0\0\0\vssh-ed25519\0\0\0 \a\xee\br\x95N:\xae\xc6\xfbz\bέtn\x12.\x9dA\xb6\x7f\xe79\xe1\xc7\x13\x95\x0e\xcd\x17_")))
+ 
+             # various known hosts files
+             no_file = tempname()
+diff --git a/stdlib/LibGit2_jll/Project.toml b/stdlib/LibGit2_jll/Project.toml
+index d38676c874025..5c4c42945a2a9 100644
+--- a/stdlib/LibGit2_jll/Project.toml
++++ b/stdlib/LibGit2_jll/Project.toml
+@@ -1,6 +1,6 @@
+ name = "LibGit2_jll"
+ uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
+-version = "1.2.3+0"
++version = "1.3.0+0"
+ 
+ [deps]
+ MbedTLS_jll = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
+diff --git a/stdlib/LibGit2_jll/test/runtests.jl b/stdlib/LibGit2_jll/test/runtests.jl
+index 9baea29d44be5..3a26e26d87ebd 100644
+--- a/stdlib/LibGit2_jll/test/runtests.jl
++++ b/stdlib/LibGit2_jll/test/runtests.jl
+@@ -7,5 +7,5 @@ using Test, Libdl, LibGit2_jll
+     minor = Ref{Cint}(0)
+     patch = Ref{Cint}(0)
+     @test ccall((:git_libgit2_version, libgit2), Cint, (Ref{Cint}, Ref{Cint}, Ref{Cint}), major, minor, patch) == 0
+-    @test VersionNumber(major[], minor[], patch[]) == v"1.1.0"
++    @test VersionNumber(major[], minor[], patch[]) == v"1.3.0"
+ end

Copied: julia/repos/community-staging-x86_64/julia-libgit-1.4.patch (from rev 1238980, julia/trunk/julia-libgit-1.4.patch)
===================================================================
--- community-staging-x86_64/julia-libgit-1.4.patch	                        (rev 0)
+++ community-staging-x86_64/julia-libgit-1.4.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,40 @@
+diff --git a/stdlib/LibGit2/src/consts.jl b/stdlib/LibGit2/src/consts.jl
+index 2bc9edaf89..55887ebe2a 100644
+--- a/stdlib/LibGit2/src/consts.jl
++++ b/stdlib/LibGit2/src/consts.jl
+@@ -247,6 +247,11 @@ const RESET_HARD  = Cint(3) # MIXED plus changes in working tree discarded
+                             REBASE_OPERATION_FIXUP  = Cint(4),
+                             REBASE_OPERATION_EXEC   = Cint(5))
+ 
++# git_remote_redirect_t
++const GIT_REMOTE_REDIRECT_NONE    = Cint(0)
++const GIT_REMOTE_REDIRECT_INITIAL = Cint(1)
++const GIT_REMOTE_REDIRECT_ALL     = Cint(2)
++
+ # fetch_prune
+ const FETCH_PRUNE_UNSPECIFIED = Cint(0)
+ const FETCH_PRUNE             = Cint(1)
+diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
+index 9ffcaa3646..98d938df65 100644
+--- a/stdlib/LibGit2/src/types.jl
++++ b/stdlib/LibGit2/src/types.jl
+@@ -343,6 +343,9 @@ The fields represent:
+     @static if LibGit2.VERSION >= v"0.25.0"
+         proxy_opts::ProxyOptions       = ProxyOptions()
+     end
++    @static if LibGit2.VERSION >= v"1.4.0"
++        follow_redirects::Cint         = Consts.GIT_REMOTE_REDIRECT_INITIAL
++    end
+     @static if LibGit2.VERSION >= v"0.24.0"
+         custom_headers::StrArrayStruct = StrArrayStruct()
+     end
+@@ -674,6 +677,9 @@ The fields represent:
+     @static if LibGit2.VERSION >= v"0.25.0"
+         proxy_opts::ProxyOptions       = ProxyOptions()
+     end
++    @static if LibGit2.VERSION >= v"1.4.0"
++        follow_redirects::Cint         = Consts.GIT_REMOTE_REDIRECT_INITIAL
++    end
+     @static if LibGit2.VERSION >= v"0.24.0"
+         custom_headers::StrArrayStruct = StrArrayStruct()
+     end

Copied: julia/repos/community-staging-x86_64/julia-libunwind-1.6.patch (from rev 1238980, julia/trunk/julia-libunwind-1.6.patch)
===================================================================
--- community-staging-x86_64/julia-libunwind-1.6.patch	                        (rev 0)
+++ community-staging-x86_64/julia-libunwind-1.6.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,20 @@
+diff --git a/src/debuginfo.cpp b/src/debuginfo.cpp
+index 95b562311b..69fceb0cfe 100644
+--- a/src/debuginfo.cpp
++++ b/src/debuginfo.cpp
+@@ -287,6 +287,7 @@ public:
+             di->format = UNW_INFO_FORMAT_ARM_EXIDX;
+             di->start_ip = (uintptr_t)arm_text_addr;
+             di->end_ip = (uintptr_t)(arm_text_addr + arm_text_len);
++            di->load_offset = 0;
+             di->u.rti.name_ptr = 0;
+             di->u.rti.table_data = arm_exidx_addr;
+             di->u.rti.table_len = arm_exidx_len;
+@@ -1597,6 +1598,7 @@ void register_eh_frames(uint8_t *Addr, size_t Size)
+     di->u.rti.table_data = (unw_word_t)table;
+     di->start_ip = start_ip;
+     di->end_ip = end_ip;
++    di->load_offset = 0;
+ 
+     jl_profile_atomic([&]() {
+         _U_dyn_register(di);

Copied: julia/repos/community-staging-x86_64/julia-system-cblas.patch (from rev 1238980, julia/trunk/julia-system-cblas.patch)
===================================================================
--- community-staging-x86_64/julia-system-cblas.patch	                        (rev 0)
+++ community-staging-x86_64/julia-system-cblas.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,133 @@
+From 0c442318196389d653ee21eba65d8c4f7beb72a0 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz at archlinux.org>
+Date: Fri, 5 Oct 2018 15:52:17 +0000
+Subject: [PATCH] Use a dedicated cblas library, that may or may not be in fact
+ the blas one.
+
+Openblas can be built with statically compiled convenience copies of
+cblas, but if not, then the system libcblas.so should be used.
+---
+ Make.inc                         | 12 +++++++++++-
+ Makefile                         |  3 +++
+ base/Makefile                    |  4 ++++
+ stdlib/LinearAlgebra/src/blas.jl | 15 +++++++++++++--
+ 4 files changed, 31 insertions(+), 3 deletions(-)
+
+diff --git a/Make.inc b/Make.inc
+index b00a41b356d8..7bc6cd69e863 100644
+--- a/Make.inc
++++ b/Make.inc
+@@ -1109,6 +1109,7 @@ endif
+ ifeq ($(USE_SYSTEM_BLAS), 1)
+ ifeq ($(OS), Darwin)
+ USE_BLAS64 := 0
++USE_SYSTEM_CBLAS := 0
+ USE_SYSTEM_LAPACK := 0
+ LIBBLAS := -L$(build_libdir) -lgfortblas
+ LIBBLASNAME := libgfortblas
+@@ -1121,12 +1122,21 @@ LIBBLAS := -L$(build_shlibdir) -lopenblas
+ LIBBLASNAME := libopenblas
+ endif
+ 
+-# OpenBLAS builds LAPACK as part of its build.
++# OpenBLAS builds cblas/LAPACK as part of its build.
+ # We only need to build LAPACK if we are not using OpenBLAS.
+ ifeq ($(USE_SYSTEM_BLAS), 0)
++LIBCBLAS := $(LIBBLAS)
++LIBCBLASNAME := $(LIBBLASNAME)
+ LIBLAPACK := $(LIBBLAS)
+ LIBLAPACKNAME := $(LIBBLASNAME)
+ else
++ifeq ($(USE_SYSTEM_CBLAS), 1)
++LIBCBLAS ?= -lcblas
++LIBCBLASNAME ?= libcblas
++else
++LIBCBLAS := -L$(build_shlibdir) -lcblas $(LIBBLAS)
++LIBCBLASNAME := libcblas
++endif
+ ifeq ($(USE_SYSTEM_LAPACK), 1)
+ LIBLAPACK ?= -llapack
+ LIBLAPACKNAME ?= liblapack
+diff --git a/Makefile b/Makefile
+index 6063e79ae956..7df60b8170d6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -198,6 +198,9 @@ endif
+ endif
+ 
+ JL_PRIVATE_LIBS-$(USE_SYSTEM_BLAS) += $(LIBBLASNAME)
++ifneq ($(LIBCBLASNAME),$(LIBBLASNAME))
++JL_PRIVATE_LIBS-$(USE_SYSTEM_CBLAS) += $(LIBCBLASNAME)
++endif
+ ifneq ($(LIBLAPACKNAME),$(LIBBLASNAME))
+ JL_PRIVATE_LIBS-$(USE_SYSTEM_LAPACK) += $(LIBLAPACKNAME)
+ endif
+diff --git a/base/Makefile b/base/Makefile
+index 70e6da933d70..8ecfa6902b59 100644
+--- a/base/Makefile
++++ b/base/Makefile
+@@ -54,6 +54,7 @@ else
+ endif
+ 	@echo "const libm_name = \"$(LIBMNAME)\"" >> $@
+ 	@echo "const libblas_name = \"$(LIBBLASNAME)\"" >> $@
++	@echo "const libcblas_name = \"$(LIBCBLASNAME)\"" >> $@
+ 	@echo "const liblapack_name = \"$(LIBLAPACKNAME)\"" >> $@
+ ifeq ($(USE_BLAS64), 1)
+ 	@echo "const USE_BLAS64 = true" >> $@
+@@ -183,6 +184,9 @@ endif
+ $(eval $(call symlink_system_library,PCRE,libpcre2-8))
+ $(eval $(call symlink_system_library,DSFMT,libdSFMT))
+ $(eval $(call symlink_system_library,BLAS,$(LIBBLASNAME)))
++ifneq ($(LIBCBLASNAME),$(LIBBLASNAME))
++$(eval $(call symlink_system_library,CBLAS,$(LIBCBLASNAME)))
++endif
+ ifneq ($(LIBLAPACKNAME),$(LIBBLASNAME))
+ $(eval $(call symlink_system_library,LAPACK,$(LIBLAPACKNAME)))
+ endif
+diff --git a/stdlib/LinearAlgebra/src/blas.jl b/stdlib/LinearAlgebra/src/blas.jl
+index 661e9e2b15..9bc1034682 100644
+--- a/stdlib/LinearAlgebra/src/blas.jl
++++ b/stdlib/LinearAlgebra/src/blas.jl
+@@ -71,6 +71,7 @@ libblastrampoline_handle = C_NULL
+ # should not look at these, instead preferring to parse the output
+ # of BLAS.get_config()
+ const libblas = libblastrampoline
++const libcblas = Base.libcblas_name
+ const liblapack = libblastrampoline
+ 
+ import LinearAlgebra
+@@ -109,6 +110,16 @@ else
+     end
+ end
+ 
++if libcblas == libblastrampoline
++     macro cblasfunc(x)
++        return @blasfunc(x)
++    end
++else
++    macro cblasfunc(x)
++        return Expr(:quote, x)
++    end
++end
++
+ _tryparse_env_int(key) = tryparse(Int, get(ENV, key, ""))
+ 
+ 
+@@ -327,7 +338,7 @@ for (fname, elty) in ((:cblas_zdotc_sub,:ComplexF64),
+                 #       DOUBLE PRECISION DX(*),DY(*)
+         function dotc(n::Integer, DX::Union{Ptr{$elty},AbstractArray{$elty}}, incx::Integer, DY::Union{Ptr{$elty},AbstractArray{$elty}}, incy::Integer)
+             result = Ref{$elty}()
+-            ccall((@blasfunc($fname), libblastrampoline), Cvoid,
++            ccall((@cblasfunc($fname), libcblas), Cvoid,
+                 (BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}),
+                  n, DX, incx, DY, incy, result)
+             result[]
+@@ -345,7 +356,7 @@ for (fname, elty) in ((:cblas_zdotu_sub,:ComplexF64),
+                 #       DOUBLE PRECISION DX(*),DY(*)
+         function dotu(n::Integer, DX::Union{Ptr{$elty},AbstractArray{$elty}}, incx::Integer, DY::Union{Ptr{$elty},AbstractArray{$elty}}, incy::Integer)
+             result = Ref{$elty}()
+-            ccall((@blasfunc($fname), libblastrampoline), Cvoid,
++            ccall((@cblasfunc($fname), libcblas), Cvoid,
+                 (BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}, BlasInt, Ptr{$elty}),
+                  n, DX, incx, DY, incy, result)
+             result[]

Copied: julia/repos/community-staging-x86_64/make-install-no-build.patch (from rev 1238980, julia/trunk/make-install-no-build.patch)
===================================================================
--- community-staging-x86_64/make-install-no-build.patch	                        (rev 0)
+++ community-staging-x86_64/make-install-no-build.patch	2022-06-22 16:49:18 UTC (rev 1238981)
@@ -0,0 +1,14 @@
+--- julia-1.3.0/Makefile.orig	2019-12-06 12:54:23.879790955 +0000
++++ julia-1.3.0/Makefile	2019-12-06 12:54:36.329952953 +0000
+@@ -277,11 +277,6 @@
+ 
+ 
+ install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
+-ifeq ($(BUNDLE_DEBUG_LIBS),1)
+-	@$(MAKE) $(QUIET_MAKE) all
+-else
+-	@$(MAKE) $(QUIET_MAKE) release
+-endif
+ 	@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(libexecdir); do \
+ 		mkdir -p $(DESTDIR)$$subdir; \
+ 	done



More information about the arch-commits mailing list