Build rustc from source with libgcc < 9.3.1

This is an extremely niche problem, I'm sure, but I've tried... a very large number of things with little success. The situation is this: I am trying to build rust 1.66.0 (and .1) on a debian:buster-slim docker container (libgcc 8.3.0, glibc 2.28) using llvm 14 and I'm getting insurmountable linker errors:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "/tmp/rustcWJ3gY3/symbols.o" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/rustc_main-95936b2b75bd5cef.rustc_main.eb2391a0-cgu.0.rcgu.o" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/rustc_main-95936b2b75bd5cef.rustc_main.eb2391a0-cgu.1.rcgu.o" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/rustc_main-95936b2b75bd5cef.rustc_main.eb2391a0-cgu.2.rcgu.o" "-Wl,--as-needed" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/release/deps" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/build/psm-725259a90952840f/out" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/build/rustc_llvm-1fe81efb55ddb6da/out" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/llvm/build/lib" "-L" "/usr/lib/gcc/aarch64-linux-gnu/8" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps" "-lrustc_driver-c4bd77c3b6122f7a" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-lstd-40ce485c9be82a30" "-Wl,-Bstatic" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-a6b1f233b01990e9.rlib" "-Wl,-Bdynamic" "-lrt" "-ldl" "-lpthread" "-lm" "-lz" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/rustc_main-95936b2b75bd5cef" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib"

= note: ld: error: /home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_driver-c4bd77c3b6122f7a.so: undefined reference to __aarch64_ldadd8_relax [--no-allow-shlib-undefined]
        ld: error: /home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_driver-c4bd77c3b6122f7a.so: undefined reference to __aarch64_ldadd8_rel [--no-allow-shlib-undefined]
        ld: error: /home/jacob/v1.66.1/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_driver-c4bd77c3b6122f7a.so: undefined reference to __aarch64_cas1_acq [--no-allow-shlib-undefined]
...etc...

So, clearly, my research has lead me to out-of-line atomics as being the culprit here. I've tried compiling gcc 12.2.0, and passed a variety of -Ctarget-feature=-outline-atomics, -L path/to/gcc12/{libgcc,libgcc_s,libgcc.a,etc}, tried patching the outline-atomics feature out of the build spec for aarch64-unknown-linux-gnu, etc.

Noteworthy other explorations: the exact same setup builds just fine on ubuntu-latest. rustc up to 1.65.0 builds just fine with the same setup. I've diffed and reviewed the changes between 1.65.0 and 1.66.0, and I just can't see what might have caught me here.

I'd love any insight into what further explorations might be fruitful here. Thanks for reading this mess, if you got this far.