diff --git a/build_system/src/test.rs b/build_system/src/test.rs
index 303a2e518cf..dd09de24aa3 100644
--- a/build_system/src/test.rs
+++ b/build_system/src/test.rs
@@ -637,7 +637,8 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
         "https://github.com/BurntSushi/memchr",
         "https://github.com/dtolnay/itoa",
         "https://github.com/rust-lang/cfg-if",
-        "https://github.com/rust-lang-nursery/lazy-static.rs",
+        //"https://github.com/rust-lang-nursery/lazy-static.rs", // TODO: re-enable when the
+        //failing test is fixed upstream.
         //"https://github.com/marshallpierce/rust-base64", // FIXME: one test is OOM-killed.
         // TODO: ignore the base64 test that is OOM-killed.
         "https://github.com/time-rs/time",
diff --git a/libgccjit.version b/libgccjit.version
index 23ca7f02215..fa2bacc2c8e 100644
--- a/libgccjit.version
+++ b/libgccjit.version
@@ -1 +1 @@
-341be3b7d7ac6976cfed8ed59da3573c040d0776
+bcafd46296f7898dac02d127e441b1d838ef2afc
diff --git a/patches/0022-core-Disable-not-compiling-tests.patch b/patches/0022-core-Disable-not-compiling-tests.patch
index 08e2f1a7628..b2ab05691ec 100644
--- a/patches/0022-core-Disable-not-compiling-tests.patch
+++ b/patches/0022-core-Disable-not-compiling-tests.patch
@@ -1,26 +1,24 @@
-From f6befc4bb51d84f5f1cf35938a168c953d421350 Mon Sep 17 00:00:00 2001
-From: bjorn3 <bjorn3@users.noreply.github.com>
-Date: Sun, 24 Nov 2019 15:10:23 +0100
+From 18793c6109890493ceb3ff36549849a36e3d8022 Mon Sep 17 00:00:00 2001
+From: None <none@example.com>
+Date: Sun, 1 Sep 2024 11:42:17 -0400
 Subject: [PATCH] [core] Disable not compiling tests
 
 ---
- library/core/tests/Cargo.toml         | 8 ++++++++
- library/core/tests/num/flt2dec/mod.rs | 1 -
- library/core/tests/num/int_macros.rs  | 2 ++
- library/core/tests/num/uint_macros.rs | 2 ++
- library/core/tests/ptr.rs             | 2 ++
- library/core/tests/slice.rs           | 2 ++
- 6 files changed, 16 insertions(+), 1 deletion(-)
+ library/core/tests/Cargo.toml | 14 ++++++++++++++
+ library/core/tests/lib.rs     |  1 +
+ 2 files changed, 15 insertions(+)
  create mode 100644 library/core/tests/Cargo.toml
 
 diff --git a/library/core/tests/Cargo.toml b/library/core/tests/Cargo.toml
 new file mode 100644
-index 0000000..46fd999
+index 0000000..ca326ac
 --- /dev/null
 +++ b/library/core/tests/Cargo.toml
-@@ -0,0 +1,12 @@
+@@ -0,0 +1,14 @@
++[workspace]
++
 +[package]
-+name = "core"
++name = "coretests"
 +version = "0.0.0"
 +edition = "2021"
 +
@@ -32,12 +30,14 @@ index 0000000..46fd999
 +rand = { version = "0.8.5", default-features = false }
 +rand_xorshift = { version = "0.3.0", default-features = false }
 diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
-index 42a26ae..5ac1042 100644
+index 1e336bf..5800ebb 100644
 --- a/library/core/tests/lib.rs
 +++ b/library/core/tests/lib.rs
-@@ -2,4 +2,5 @@
+@@ -1,4 +1,5 @@
  // tidy-alphabetical-start
 +#![cfg(test)]
  #![cfg_attr(bootstrap, feature(offset_of_nested))]
  #![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
  #![cfg_attr(test, feature(cfg_match))]
+--
+2.46.0
diff --git a/src/consts.rs b/src/consts.rs
index 53dbb35d711..483b2355c52 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -386,6 +386,7 @@ fn check_and_apply_linkage<'gcc, 'tcx>(
             cx.declare_global_with_linkage(sym, cx.type_i8(), base::global_linkage_to_gcc(linkage));
 
         if linkage == Linkage::ExternalWeak {
+            #[cfg(feature = "master")]
             global1.add_attribute(VarAttribute::Weak);
         }
 
diff --git a/src/intrinsic/llvm.rs b/src/intrinsic/llvm.rs
index 554e57250e6..2287c96b41b 100644
--- a/src/intrinsic/llvm.rs
+++ b/src/intrinsic/llvm.rs
@@ -985,6 +985,8 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
         "llvm.x86.avx512.vpdpbusds.512" => "__builtin_ia32_vpdpbusds_v16si",
         "llvm.x86.avx512.vpdpbusds.256" => "__builtin_ia32_vpdpbusds_v8si",
         "llvm.x86.avx512.vpdpbusds.128" => "__builtin_ia32_vpdpbusds_v4si",
+        "llvm.x86.xsave" => "__builtin_ia32_xsave",
+        "llvm.x86.xsaveopt" => "__builtin_ia32_xsaveopt",
 
         // NOTE: this file is generated by https://github.com/GuillaumeGomez/llvmint/blob/master/generate_list.py
         _ => include!("archs.rs"),
diff --git a/tests/failing-ice-tests.txt b/tests/failing-ice-tests.txt
index 2084f86b62e..ff1b6f14894 100644
--- a/tests/failing-ice-tests.txt
+++ b/tests/failing-ice-tests.txt
@@ -34,3 +34,7 @@ tests/ui/sepcomp/sepcomp-unwind.rs
 tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs
 tests/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs
 tests/ui/unwind-no-uwtable.rs
+tests/ui/delegation/fn-header.rs
+tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
+tests/ui/simd/masked-load-store.rs
+tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
diff --git a/tests/failing-ui-tests.txt b/tests/failing-ui-tests.txt
index 5a55bdb156e..56b51275a53 100644
--- a/tests/failing-ui-tests.txt
+++ b/tests/failing-ui-tests.txt
@@ -95,3 +95,29 @@ tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
 tests/ui/backtrace/backtrace.rs
 tests/ui/lifetimes/tail-expr-lock-poisoning.rs
 tests/ui/runtime/rt-explody-panic-payloads.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/function.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/basic.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/inline1.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/print.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/inline2.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/print3.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/function.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/basic.rs
+tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/print3.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs
+tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/basic.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/function.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/print.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/print3.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs
+tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs
+tests/ui/sanitizer/cfi-sized-associated-ty.rs
+tests/ui/sanitizer/cfi-can-reveal-opaques.rs