summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:05 +0000
commit217d9223a5aa75daf9f286fd1fc06dae379b5dbc (patch)
treeb43bedae234ad56894a82934ee57e3619f3374d5 /debian/patches
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-217d9223a5aa75daf9f286fd1fc06dae379b5dbc.tar.xz
rustc-217d9223a5aa75daf9f286fd1fc06dae379b5dbc.zip
Adding debian version 1.64.0+dfsg1-1.debian/1.64.0+dfsg1-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/d-0000-ignore-removed-submodules.patch253
-rw-r--r--debian/patches/d-0001-pkg-config-no-special-snowflake.patch93
-rw-r--r--debian/patches/d-0002-mdbook-strip-embedded-libs.patch420
-rw-r--r--debian/patches/d-0003-cc-psm-rebuild-wasm32.patch48
-rw-r--r--debian/patches/d-0004-clippy-feature-sync.patch37
-rw-r--r--debian/patches/d-0005-no-jemalloc.patch46
-rw-r--r--debian/patches/d-armel-fix-lldb.patch19
-rw-r--r--debian/patches/d-bootstrap-cargo-check-cfg.patch19
-rw-r--r--debian/patches/d-bootstrap-cargo-doc-paths.patch243
-rw-r--r--debian/patches/d-bootstrap-custom-debuginfo-path.patch40
-rw-r--r--debian/patches/d-bootstrap-disable-git.patch45
-rw-r--r--debian/patches/d-bootstrap-install-symlinks.patch36
-rw-r--r--debian/patches/d-bootstrap-no-assume-tools.patch27
-rw-r--r--debian/patches/d-bootstrap-old-cargo-compat.patch45
-rw-r--r--debian/patches/d-bootstrap-permit-symlink-in-docs.patch14
-rw-r--r--debian/patches/d-bootstrap-read-beta-version-from-file.patch37
-rw-r--r--debian/patches/d-bootstrap-rustflags.patch32
-rw-r--r--debian/patches/d-bootstrap-use-local-css.patch42
-rw-r--r--debian/patches/d-bootstrap-use-system-compiler-rt.patch40
-rw-r--r--debian/patches/d-fix-rustix-outline.patch60
-rw-r--r--debian/patches/d-remove-arm-privacy-breaches.patch195
-rw-r--r--debian/patches/d-rust-gdb-paths39
-rw-r--r--debian/patches/d-rust-lldb-paths29
-rw-r--r--debian/patches/d-rustc-add-soname.patch44
-rw-r--r--debian/patches/d-rustc-fix-mips64el-bootstrap.patch62
-rw-r--r--debian/patches/d-rustc-i686-baseline.patch22
-rw-r--r--debian/patches/d-rustc-prefer-dynamic.patch18
-rw-r--r--debian/patches/d-rustc-windows-ssp.patch22
-rw-r--r--debian/patches/d-rustdoc-disable-embedded-fonts.patch77
-rw-r--r--debian/patches/d-test-host-duplicates.patch20
-rw-r--r--debian/patches/d-test-ignore-avx-44056.patch22
-rw-r--r--debian/patches/series70
-rw-r--r--debian/patches/u-allow-system-compiler-rt.patch327
-rw-r--r--debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch223
-rw-r--r--debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch23
-rw-r--r--debian/patches/u-fix-rustix-for-sparc64.patch203
-rw-r--r--debian/patches/u-ignore-bpf-test.patch18
-rw-r--r--debian/patches/u-ignore-endian-big-diff.patch70
-rw-r--r--debian/patches/u-ignore-ppc-hangs.patch34
-rw-r--r--debian/patches/u-ignore-reproducible-failure.patch22
-rw-r--r--debian/patches/u-make-tests-work-without-rpath.patch23
-rw-r--r--debian/patches/u-reproducible-build.patch25
-rw-r--r--debian/patches/u-reproducible-dl-stage0.patch22
-rw-r--r--debian/patches/u-rustc-llvm-cross-flags.patch22
-rw-r--r--debian/patches/ubuntu-Revert-Use-constant-eval-to-do-strict-validity-check.patch569
-rw-r--r--debian/patches/ubuntu-disable-ppc64el-asm-tests.patch39
-rw-r--r--debian/patches/ubuntu-ignore-arm-doctest.patch38
47 files changed, 3874 insertions, 0 deletions
diff --git a/debian/patches/d-0000-ignore-removed-submodules.patch b/debian/patches/d-0000-ignore-removed-submodules.patch
new file mode 100644
index 000000000..3dfaf06cb
--- /dev/null
+++ b/debian/patches/d-0000-ignore-removed-submodules.patch
@@ -0,0 +1,253 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:07:59 +0100
+Subject: d-0000-ignore-removed-submodules
+
+---
+ Cargo.toml | 36 ++++++++----------------------------
+ src/bootstrap/bootstrap.py | 4 ----
+ src/bootstrap/builder.rs | 7 +------
+ src/bootstrap/doc.rs | 1 -
+ src/bootstrap/test.rs | 12 +-----------
+ src/tools/clippy/Cargo.toml | 5 -----
+ src/tools/rustfmt/Cargo.toml | 5 -----
+ src/tools/tidy/src/deps.rs | 2 +-
+ 8 files changed, 11 insertions(+), 61 deletions(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index ffc886d..7231b60 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -16,25 +16,14 @@ members = [
+ "src/tools/tidy",
+ "src/tools/tier-check",
+ "src/tools/build-manifest",
+- "src/tools/remote-test-client",
+- "src/tools/remote-test-server",
+ "src/tools/rust-installer",
+ "src/tools/rust-demangler",
+- "src/tools/cargo",
+- "src/tools/cargo/crates/credential/cargo-credential-1password",
+- "src/tools/cargo/crates/credential/cargo-credential-macos-keychain",
+- "src/tools/cargo/crates/credential/cargo-credential-wincred",
+ "src/tools/rustdoc",
+- "src/tools/rls",
+ "src/tools/rustfmt",
+- "src/tools/miri",
+- "src/tools/miri/cargo-miri",
+ "src/tools/rustdoc-themes",
+ "src/tools/unicode-table-generator",
+- "src/tools/expand-yaml-anchors",
+ "src/tools/jsondocck",
+ "src/tools/html-checker",
+- "src/tools/bump-stage0",
+ "src/tools/lld-wrapper",
+ ]
+
+@@ -96,25 +85,16 @@ gimli.debug = 0
+ miniz_oxide.debug = 0
+ object.debug = 0
+
+-# We want the RLS to use the version of Cargo that we've got vendored in this
+-# repository to ensure that the same exact version of Cargo is used by both the
+-# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository
+-# so we use a `[patch]` here to override the github repository with our local
+-# vendored copy.
+-[patch."https://github.com/rust-lang/cargo"]
+-cargo = { path = "src/tools/cargo" }
+-cargo-util = { path = "src/tools/cargo/crates/cargo-util" }
+-
+-[patch."https://github.com/rust-lang/rustfmt"]
+-# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
+-# that we're shipping as well (to ensure that the rustfmt in RLS and the
+-# `rustfmt` executable are the same exact version).
+-rustfmt-nightly = { path = "src/tools/rustfmt" }
++# The only package that ever uses debug builds is bootstrap.
++# We care a lot about bootstrap's compile times, so don't include debug info for
++# dependencies, only bootstrap itself.
++[profile.dev]
++debug = 0
++[profile.dev.package]
++# Only use debuginfo=1 to further reduce compile times.
++bootstrap.debug = 1
+
+ [patch.crates-io]
+-# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
+-# here
+-rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
+
+ # See comments in `library/rustc-std-workspace-core/README.md` for what's going on
+ # here
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+index 03eec02..c40811f 100644
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -759,10 +759,6 @@ class RustBuild(object):
+ os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
+ for _ in range(0, self.verbose):
+ args.append("--verbose")
+- if self.use_locked_deps:
+- args.append("--locked")
+- if self.use_vendored_sources:
+- args.append("--frozen")
+ if self.get_toml("metrics", "build"):
+ args.append("--features")
+ args.append("build-metrics")
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index 0ab4824..629e1bb 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -600,7 +600,6 @@ impl<'a> Builder<'a> {
+ tool::RustInstaller,
+ tool::Cargo,
+ tool::Rls,
+- tool::RustAnalyzer,
+ tool::RustAnalyzerProcMacroSrv,
+ tool::RustDemangler,
+ tool::Rustdoc,
+@@ -622,7 +620,6 @@ impl<'a> Builder<'a> {
+ check::Clippy,
+ check::Miri,
+ check::Rls,
+- check::RustAnalyzer,
+ check::Rustfmt,
+ check::Bootstrap
+ ),
+@@ -650,7 +647,6 @@ impl<'a> Builder<'a> {
+ test::Cargotest,
+ test::Cargo,
+ test::Rls,
+- test::RustAnalyzer,
+ test::ErrorIndex,
+ test::Distcheck,
+ test::RunMakeFullDeps,
+@@ -698,10 +694,8 @@ impl<'a> Builder<'a> {
+ doc::RustdocBook,
+ doc::RustByExample,
+ doc::RustcBook,
+- doc::CargoBook,
+ doc::Clippy,
+ doc::ClippyBook,
+- doc::Miri,
+ doc::EmbeddedBook,
+ doc::EditionGuide,
+ ),
+@@ -723,7 +717,6 @@ impl<'a> Builder<'a> {
+ dist::Miri,
+ dist::LlvmTools,
+ dist::RustDev,
+- dist::Extended,
+ // It seems that PlainSourceTarball somehow changes how some of the tools
+ // perceive their dependencies (see #93033) which would invalidate fingerprints
+ // and force us to rebuild tools after vendoring dependencies.
+@@ -2054,10 +2047,7 @@ impl<'a> Builder<'a> {
+ }
+ }
+
+- if self.config.locked_deps {
+- cargo.arg("--locked");
+- }
+- if self.config.vendor || self.is_sudo {
++ if self.is_sudo {
+ cargo.arg("--frozen");
+ }
+
+diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
+index 2852442..5faa8e5 100644
+--- a/src/bootstrap/doc.rs
++++ b/src/bootstrap/doc.rs
+@@ -73,7 +73,6 @@ macro_rules! book {
+ // FIXME: Make checking for a submodule automatic somehow (maybe by having a list of all submodules
+ // and checking against it?).
+ book!(
+- CargoBook, "src/tools/cargo/src/doc", "cargo", submodule = "src/tools/cargo";
+ ClippyBook, "src/tools/clippy/book", "clippy";
+ EditionGuide, "src/doc/edition-guide", "edition-guide", submodule;
+ EmbeddedBook, "src/doc/embedded-book", "embedded-book", submodule;
+diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
+index c0fa8c9..8fbc390 100644
+--- a/src/bootstrap/test.rs
++++ b/src/bootstrap/test.rs
+@@ -1910,17 +1910,7 @@ impl Step for RustcGuide {
+ }
+
+ fn run(self, builder: &Builder<'_>) {
+- let relative_path = Path::new("src").join("doc").join("rustc-dev-guide");
+- builder.update_submodule(&relative_path);
+-
+- let src = builder.src.join(relative_path);
+- let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
+- let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) {
+- ToolState::TestPass
+- } else {
+- ToolState::TestFail
+- };
+- builder.save_toolstate("rustc-dev-guide", toolstate);
++ builder.save_toolstate("rustc-dev-guide", ToolState::TestPass);
+ }
+ }
+
+diff --git a/src/tools/clippy/Cargo.toml b/src/tools/clippy/Cargo.toml
+index 1c875c3..1aad7cf 100644
+--- a/src/tools/clippy/Cargo.toml
++++ b/src/tools/clippy/Cargo.toml
+@@ -36,11 +36,6 @@ walkdir = "2.3"
+ # This is used by the `collect-metadata` alias.
+ filetime = "0.2"
+
+-# A noop dependency that changes in the Rust repository, it's a bit of a hack.
+-# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
+-# for more information.
+-rustc-workspace-hack = "1.0"
+-
+ # UI test dependencies
+ clippy_utils = { path = "clippy_utils" }
+ derive-new = "0.5"
+diff --git a/src/tools/rustfmt/Cargo.toml b/src/tools/rustfmt/Cargo.toml
+index 7a4e02d..27b91f2 100644
+--- a/src/tools/rustfmt/Cargo.toml
++++ b/src/tools/rustfmt/Cargo.toml
+@@ -59,11 +59,6 @@ unicode_categories = "0.1"
+
+ rustfmt-config_proc_macro = { version = "0.2", path = "config_proc_macro" }
+
+-# A noop dependency that changes in the Rust repository, it's a bit of a hack.
+-# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
+-# for more information.
+-rustc-workspace-hack = "1.0.0"
+-
+ # Rustc dependencies are loaded from the sysroot, Cargo doesn't know about them.
+
+ [package.metadata.rust-analyzer]
+diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
+index 333f85f..4df2b54 100644
+--- a/src/tools/tidy/src/deps.rs
++++ b/src/tools/tidy/src/deps.rs
+@@ -306,7 +306,7 @@ const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[
+ // These two crates take quite a long time to build, so don't allow two versions of them
+ // to accidentally sneak into our dependency graph, in order to ensure we keep our CI times
+ // under control.
+- "cargo",
++ //"cargo",
+ ];
+
+ /// Dependency checks.
+diff --git a/src/tools/rust-analyzer/Cargo.toml b/src.tools/rust-analyzer/Cargo.toml
+index 6b68ca82389..7bc5d1bc5a0 100644
+--- a/src/tools/rust-analyzer/Cargo.toml
++++ b/src/tools/rust-analyzer/Cargo.toml
+@@ -1,5 +1,14 @@
+ [workspace]
+-members = ["xtask/", "lib/*", "crates/*"]
++members = [
++ "xtask/",
++ "lib/*",
++ "crates/proc-macro-srv",
++ "crates/proc-macro-srv-cli",
++ "crates/tt",
++ "crates/mbe",
++ "crates/paths",
++ "crates/proc-macro-api",
++]
+ exclude = ["crates/proc-macro-test/imp"]
+
+ [profile.dev]
diff --git a/debian/patches/d-0001-pkg-config-no-special-snowflake.patch b/debian/patches/d-0001-pkg-config-no-special-snowflake.patch
new file mode 100644
index 000000000..db66e2c34
--- /dev/null
+++ b/debian/patches/d-0001-pkg-config-no-special-snowflake.patch
@@ -0,0 +1,93 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:08:00 +0100
+Subject: d-0001-pkg-config-no-special-snowflake
+
+---
+ vendor/pkg-config/src/lib.rs | 25 ++++++++++---------------
+ vendor/pkg-config/tests/test.rs | 2 --
+ 2 files changed, 10 insertions(+), 17 deletions(-)
+
+diff --git a/vendor/pkg-config/src/lib.rs b/vendor/pkg-config/src/lib.rs
+index a28304e..11f9460 100644
+--- a/vendor/pkg-config/src/lib.rs
++++ b/vendor/pkg-config/src/lib.rs
+@@ -111,11 +111,8 @@ pub enum Error {
+ /// Contains the name of the responsible environment variable.
+ EnvNoPkgConfig(String),
+
+- /// Detected cross compilation without a custom sysroot.
+- ///
+- /// Ignore the error with `PKG_CONFIG_ALLOW_CROSS=1`,
+- /// which may let `pkg-config` select libraries
+- /// for the host's architecture instead of the target's.
++ /// Cross compilation detected. Kept for compatibility;
++ /// the Debian package never emits this.
+ CrossCompilation,
+
+ /// Failed to run `pkg-config`.
+@@ -155,14 +152,6 @@ impl fmt::Display for Error {
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ match *self {
+ Error::EnvNoPkgConfig(ref name) => write!(f, "Aborted because {} is set", name),
+- Error::CrossCompilation => f.write_str(
+- "pkg-config has not been configured to support cross-compilation.\n\
+- \n\
+- Install a sysroot for the target platform and configure it via\n\
+- PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n\
+- cross-compiling wrapper for pkg-config and set it via\n\
+- PKG_CONFIG environment variable.",
+- ),
+ Error::Command {
+ ref command,
+ ref cause,
+@@ -219,7 +208,7 @@ impl fmt::Display for Error {
+ )?;
+ format_output(output, f)
+ }
+- Error::__Nonexhaustive => panic!(),
++ Error::CrossCompilation | Error::__Nonexhaustive => panic!(),
+ }
+ }
+ }
+@@ -411,6 +400,8 @@ impl Config {
+ if host == target {
+ return true;
+ }
++ // always enable PKG_CONFIG_ALLOW_CROSS override in Debian
++ return true;
+
+ // pkg-config may not be aware of cross-compilation, and require
+ // a wrapper script that sets up platform-specific prefixes.
+@@ -470,7 +461,11 @@ impl Config {
+ fn command(&self, name: &str, args: &[&str]) -> Command {
+ let exe = self
+ .targetted_env_var("PKG_CONFIG")
+- .unwrap_or_else(|| OsString::from("pkg-config"));
++ .unwrap_or_else(|| {
++ self.env_var_os("DEB_HOST_GNU_TYPE")
++ .map(|mut t| { t.push(OsString::from("-pkg-config")); t })
++ .unwrap_or_else(|| OsString::from("pkg-config"))
++ });
+ let mut cmd = Command::new(exe);
+ if self.is_static(name) {
+ cmd.arg("--static");
+diff --git a/vendor/pkg-config/tests/test.rs b/vendor/pkg-config/tests/test.rs
+index 4e04ac0..f884e46 100644
+--- a/vendor/pkg-config/tests/test.rs
++++ b/vendor/pkg-config/tests/test.rs
+@@ -34,7 +34,6 @@ fn find(name: &str) -> Result<pkg_config::Library, Error> {
+ pkg_config::probe_library(name)
+ }
+
+-#[test]
+ fn cross_disabled() {
+ let _g = LOCK.lock();
+ reset();
+@@ -46,7 +45,6 @@ fn cross_disabled() {
+ }
+ }
+
+-#[test]
+ fn cross_enabled() {
+ let _g = LOCK.lock();
+ reset();
diff --git a/debian/patches/d-0002-mdbook-strip-embedded-libs.patch b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
new file mode 100644
index 000000000..3916871a2
--- /dev/null
+++ b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
@@ -0,0 +1,420 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:08:00 +0100
+Subject: d-0002-mdbook-strip-embedded-libs
+
+Comment: Use https://github.com/infinity0/mdBook/tree/debian to help you rebase the patch on top of a newer version. . Make sure the paths here match the ones in debian/rust-doc.links
+---
+ src/tools/linkchecker/main.rs | 28 ++++++-
+ vendor/mdbook/src/book/init.rs | 6 --
+ .../src/renderer/html_handlebars/hbs_renderer.rs | 80 ++-----------------
+ .../mdbook/src/renderer/html_handlebars/search.rs | 2 -
+ vendor/mdbook/src/theme/index.hbs | 93 +---------------------
+ vendor/mdbook/src/theme/mod.rs | 27 -------
+ vendor/mdbook/src/theme/searcher/mod.rs | 2 -
+ 7 files changed, 35 insertions(+), 203 deletions(-)
+
+diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
+index a7c78d8..22927f8 100644
+--- a/src/tools/linkchecker/main.rs
++++ b/src/tools/linkchecker/main.rs
+@@ -183,7 +183,17 @@ impl Checker {
+ for entry in t!(dir.read_dir()).map(|e| t!(e)) {
+ let path = entry.path();
+ // Goes through symlinks
+- let metadata = t!(fs::metadata(&path));
++ let metadata = fs::metadata(&path);
++ if let Err(err) = metadata {
++ if let Ok(target) = fs::read_link(&path) {
++ if target.starts_with("/usr/share") {
++ // broken symlink to /usr/share, ok for our Debian build
++ return;
++ }
++ }
++ panic!("error at file {:?} while walking - {:?}", path, err)
++ }
++ let metadata = t!(metadata);
+ if metadata.is_dir() {
+ self.walk(&path, report);
+ } else {
+@@ -196,7 +206,15 @@ impl Checker {
+ fn check(&mut self, file: &Path, report: &mut Report) {
+ let (pretty_path, entry) = self.load_file(file, report);
+ let source = match entry {
+- FileEntry::Missing => panic!("missing file {:?} while walking", file),
++ FileEntry::Missing => {
++ if let Ok(target) = fs::read_link(&file) {
++ if target.starts_with("/usr/share") {
++ // broken symlink to /usr/share, ok for our Debian build
++ return;
++ }
++ }
++ panic!("missing file {:?} while walking", file)
++ }
+ FileEntry::Dir => unreachable!("never with `check` path"),
+ FileEntry::OtherFile => return,
+ FileEntry::Redirect { .. } => return,
+@@ -261,6 +279,12 @@ impl Checker {
+ let (target_pretty_path, target_entry) = self.load_file(&path, report);
+ let (target_source, target_ids) = match target_entry {
+ FileEntry::Missing => {
++ if let Ok(target) = fs::read_link(&path) {
++ if target.starts_with("/usr/share") {
++ // broken symlink to /usr/share, ok for our Debian build
++ return;
++ }
++ }
+ if is_exception(file, &target_pretty_path) {
+ report.links_ignored_exception += 1;
+ } else {
+diff --git a/vendor/mdbook/src/book/init.rs b/vendor/mdbook/src/book/init.rs
+index 264c113..2b0ff3a 100644
+--- a/vendor/mdbook/src/book/init.rs
++++ b/vendor/mdbook/src/book/init.rs
+@@ -151,12 +151,6 @@ impl BookBuilder {
+ let mut js = File::create(themedir.join("book.js"))?;
+ js.write_all(theme::JS)?;
+
+- let mut highlight_css = File::create(themedir.join("highlight.css"))?;
+- highlight_css.write_all(theme::HIGHLIGHT_CSS)?;
+-
+- let mut highlight_js = File::create(themedir.join("highlight.js"))?;
+- highlight_js.write_all(theme::HIGHLIGHT_JS)?;
+-
+ Ok(())
+ }
+
+diff --git a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs
+index b933a35..09b4a7a 100644
+--- a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs
++++ b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs
+@@ -3,7 +3,7 @@ use crate::config::{BookConfig, Config, HtmlConfig, Playground, RustEdition};
+ use crate::errors::*;
+ use crate::renderer::html_handlebars::helpers;
+ use crate::renderer::{RenderContext, Renderer};
+-use crate::theme::{self, playground_editor, Theme};
++use crate::theme::{self, Theme};
+ use crate::utils;
+
+ use std::borrow::Cow;
+@@ -11,6 +11,7 @@ use std::collections::BTreeMap;
+ use std::collections::HashMap;
+ use std::fs::{self, File};
+ use std::path::{Path, PathBuf};
++use std::os::unix::fs::symlink;
+
+ use crate::utils::fs::get_404_output_file;
+ use handlebars::Handlebars;
+@@ -232,80 +233,13 @@ impl HtmlHandlebars {
+ if let Some(contents) = &theme.favicon_svg {
+ write_file(destination, "favicon.svg", contents)?;
+ }
+- write_file(destination, "highlight.css", &theme.highlight_css)?;
+ write_file(destination, "tomorrow-night.css", &theme.tomorrow_night_css)?;
+ write_file(destination, "ayu-highlight.css", &theme.ayu_highlight_css)?;
+- write_file(destination, "highlight.js", &theme.highlight_js)?;
+- write_file(destination, "clipboard.min.js", &theme.clipboard_js)?;
+- write_file(
+- destination,
+- "FontAwesome/css/font-awesome.css",
+- theme::FONT_AWESOME,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/fontawesome-webfont.eot",
+- theme::FONT_AWESOME_EOT,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/fontawesome-webfont.svg",
+- theme::FONT_AWESOME_SVG,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/fontawesome-webfont.ttf",
+- theme::FONT_AWESOME_TTF,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/fontawesome-webfont.woff",
+- theme::FONT_AWESOME_WOFF,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/fontawesome-webfont.woff2",
+- theme::FONT_AWESOME_WOFF2,
+- )?;
+- write_file(
+- destination,
+- "FontAwesome/fonts/FontAwesome.ttf",
+- theme::FONT_AWESOME_TTF,
+- )?;
+- if html_config.copy_fonts {
+- write_file(destination, "fonts/fonts.css", theme::fonts::CSS)?;
+- for (file_name, contents) in theme::fonts::LICENSES.iter() {
+- write_file(destination, file_name, contents)?;
+- }
+- for (file_name, contents) in theme::fonts::OPEN_SANS.iter() {
+- write_file(destination, file_name, contents)?;
+- }
+- write_file(
+- destination,
+- theme::fonts::SOURCE_CODE_PRO.0,
+- theme::fonts::SOURCE_CODE_PRO.1,
+- )?;
+- }
+-
+- let playground_config = &html_config.playground;
+-
+- // Ace is a very large dependency, so only load it when requested
+- if playground_config.editable && playground_config.copy_js {
+- // Load the editor
+- write_file(destination, "editor.js", playground_editor::JS)?;
+- write_file(destination, "ace.js", playground_editor::ACE_JS)?;
+- write_file(destination, "mode-rust.js", playground_editor::MODE_RUST_JS)?;
+- write_file(
+- destination,
+- "theme-dawn.js",
+- playground_editor::THEME_DAWN_JS,
+- )?;
+- write_file(
+- destination,
+- "theme-tomorrow_night.js",
+- playground_editor::THEME_TOMORROW_NIGHT_JS,
+- )?;
+- }
++ symlink("/usr/share/fonts-font-awesome/css/font-awesome.min.css", destination.join("css/font-awesome.min.css"))?;
++ symlink("/usr/share/fonts-font-awesome/fonts", destination.join("fonts"))?;
++ symlink("/usr/share/javascript/highlight.js/styles/atelier-dune-light.css", destination.join("highlight.css"))?;
++ symlink("/usr/share/javascript/highlight.js/highlight.js", destination.join("highlight.js"))?;
++ symlink("/usr/share/javascript/mathjax/MathJax.js", destination.join("MathJax.js"))?;
+
+ Ok(())
+ }
+diff --git a/vendor/mdbook/src/renderer/html_handlebars/search.rs b/vendor/mdbook/src/renderer/html_handlebars/search.rs
+index c3b944c..d4bbe35 100644
+--- a/vendor/mdbook/src/renderer/html_handlebars/search.rs
++++ b/vendor/mdbook/src/renderer/html_handlebars/search.rs
+@@ -52,8 +52,6 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) ->
+ format!("Object.assign(window.search, {});", index).as_bytes(),
+ )?;
+ utils::fs::write_file(destination, "searcher.js", searcher::JS)?;
+- utils::fs::write_file(destination, "mark.min.js", searcher::MARK_JS)?;
+- utils::fs::write_file(destination, "elasticlunr.min.js", searcher::ELASTICLUNR_JS)?;
+ debug!("Copying search files ✓");
+ }
+
+diff --git a/vendor/mdbook/src/theme/index.hbs b/vendor/mdbook/src/theme/index.hbs
+index 18d984a..4a0e2d1 100644
+--- a/vendor/mdbook/src/theme/index.hbs
++++ b/vendor/mdbook/src/theme/index.hbs
+@@ -34,10 +34,7 @@
+ {{/if}}
+
+ <!-- Fonts -->
+- <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css">
+- {{#if copy_fonts}}
+- <link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
+- {{/if}}
++ <link rel="stylesheet" href="{{ path_to_root }}css/font-awesome.min.css">
+
+ <!-- Highlight.js Stylesheets -->
+ <link rel="stylesheet" href="{{ path_to_root }}highlight.css">
+@@ -51,7 +48,7 @@
+
+ {{#if mathjax_support}}
+ <!-- MathJax -->
+- <script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
++ <script async type="text/javascript" src="MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+ {{/if}}
+ </head>
+ <body>
+@@ -61,46 +58,6 @@
+ var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
+ </script>
+
+- <!-- Work around some values being stored in localStorage wrapped in quotes -->
+- <script type="text/javascript">
+- try {
+- var theme = localStorage.getItem('mdbook-theme');
+- var sidebar = localStorage.getItem('mdbook-sidebar');
+-
+- if (theme.startsWith('"') && theme.endsWith('"')) {
+- localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
+- }
+-
+- if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
+- localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
+- }
+- } catch (e) { }
+- </script>
+-
+- <!-- Set the theme before any content is loaded, prevents flash -->
+- <script type="text/javascript">
+- var theme;
+- try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
+- if (theme === null || theme === undefined) { theme = default_theme; }
+- var html = document.querySelector('html');
+- html.classList.remove('no-js')
+- html.classList.remove('{{ default_theme }}')
+- html.classList.add(theme);
+- html.classList.add('js');
+- </script>
+-
+- <!-- Hide / unhide sidebar before it is displayed -->
+- <script type="text/javascript">
+- var html = document.querySelector('html');
+- var sidebar = 'hidden';
+- if (document.body.clientWidth >= 1080) {
+- try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
+- sidebar = sidebar || 'visible';
+- }
+- html.classList.remove('sidebar-visible');
+- html.classList.add("sidebar-" + sidebar);
+- </script>
+-
+ <nav id="sidebar" class="sidebar" aria-label="Table of contents">
+ <div class="sidebar-scrollbox">
+ {{#toc}}{{/toc}}
+@@ -238,52 +195,6 @@
+ </script>
+ {{/if}}
+
+- {{#if google_analytics}}
+- <!-- Google Analytics Tag -->
+- <script type="text/javascript">
+- var localAddrs = ["localhost", "127.0.0.1", ""];
+-
+- // make sure we don't activate google analytics if the developer is
+- // inspecting the book locally...
+- if (localAddrs.indexOf(document.location.hostname) === -1) {
+- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+-
+- ga('create', '{{google_analytics}}', 'auto');
+- ga('send', 'pageview');
+- }
+- </script>
+- {{/if}}
+-
+- {{#if playground_line_numbers}}
+- <script type="text/javascript">
+- window.playground_line_numbers = true;
+- </script>
+- {{/if}}
+-
+- {{#if playground_copyable}}
+- <script type="text/javascript">
+- window.playground_copyable = true;
+- </script>
+- {{/if}}
+-
+- {{#if playground_js}}
+- <script src="{{ path_to_root }}ace.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}editor.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}mode-rust.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}theme-dawn.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
+- {{/if}}
+-
+- {{#if search_js}}
+- <script src="{{ path_to_root }}elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}mark.min.js" type="text/javascript" charset="utf-8"></script>
+- <script src="{{ path_to_root }}searcher.js" type="text/javascript" charset="utf-8"></script>
+- {{/if}}
+-
+- <script src="{{ path_to_root }}clipboard.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}highlight.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}book.js" type="text/javascript" charset="utf-8"></script>
+
+diff --git a/vendor/mdbook/src/theme/mod.rs b/vendor/mdbook/src/theme/mod.rs
+index a1ee18a..d059f01 100644
+--- a/vendor/mdbook/src/theme/mod.rs
++++ b/vendor/mdbook/src/theme/mod.rs
+@@ -1,9 +1,5 @@
+ #![allow(missing_docs)]
+
+-pub mod playground_editor;
+-
+-pub mod fonts;
+-
+ #[cfg(feature = "search")]
+ pub mod searcher;
+
+@@ -24,19 +20,8 @@ pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css");
+ pub static FAVICON_PNG: &[u8] = include_bytes!("favicon.png");
+ pub static FAVICON_SVG: &[u8] = include_bytes!("favicon.svg");
+ pub static JS: &[u8] = include_bytes!("book.js");
+-pub static HIGHLIGHT_JS: &[u8] = include_bytes!("highlight.js");
+ pub static TOMORROW_NIGHT_CSS: &[u8] = include_bytes!("tomorrow-night.css");
+-pub static HIGHLIGHT_CSS: &[u8] = include_bytes!("highlight.css");
+ pub static AYU_HIGHLIGHT_CSS: &[u8] = include_bytes!("ayu-highlight.css");
+-pub static CLIPBOARD_JS: &[u8] = include_bytes!("clipboard.min.js");
+-pub static FONT_AWESOME: &[u8] = include_bytes!("FontAwesome/css/font-awesome.min.css");
+-pub static FONT_AWESOME_EOT: &[u8] = include_bytes!("FontAwesome/fonts/fontawesome-webfont.eot");
+-pub static FONT_AWESOME_SVG: &[u8] = include_bytes!("FontAwesome/fonts/fontawesome-webfont.svg");
+-pub static FONT_AWESOME_TTF: &[u8] = include_bytes!("FontAwesome/fonts/fontawesome-webfont.ttf");
+-pub static FONT_AWESOME_WOFF: &[u8] = include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff");
+-pub static FONT_AWESOME_WOFF2: &[u8] =
+- include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff2");
+-pub static FONT_AWESOME_OTF: &[u8] = include_bytes!("FontAwesome/fonts/FontAwesome.otf");
+
+ /// The `Theme` struct should be used instead of the static variables because
+ /// the `new()` method will look if the user has a theme directory in their
+@@ -57,11 +42,8 @@ pub struct Theme {
+ pub favicon_png: Option<Vec<u8>>,
+ pub favicon_svg: Option<Vec<u8>>,
+ pub js: Vec<u8>,
+- pub highlight_css: Vec<u8>,
+ pub tomorrow_night_css: Vec<u8>,
+ pub ayu_highlight_css: Vec<u8>,
+- pub highlight_js: Vec<u8>,
+- pub clipboard_js: Vec<u8>,
+ }
+
+ impl Theme {
+@@ -91,9 +73,6 @@ impl Theme {
+ theme_dir.join("css/variables.css"),
+ &mut theme.variables_css,
+ ),
+- (theme_dir.join("highlight.js"), &mut theme.highlight_js),
+- (theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js),
+- (theme_dir.join("highlight.css"), &mut theme.highlight_css),
+ (
+ theme_dir.join("tomorrow-night.css"),
+ &mut theme.tomorrow_night_css,
+@@ -156,11 +135,8 @@ impl Default for Theme {
+ favicon_png: Some(FAVICON_PNG.to_owned()),
+ favicon_svg: Some(FAVICON_SVG.to_owned()),
+ js: JS.to_owned(),
+- highlight_css: HIGHLIGHT_CSS.to_owned(),
+ tomorrow_night_css: TOMORROW_NIGHT_CSS.to_owned(),
+ ayu_highlight_css: AYU_HIGHLIGHT_CSS.to_owned(),
+- highlight_js: HIGHLIGHT_JS.to_owned(),
+- clipboard_js: CLIPBOARD_JS.to_owned(),
+ }
+ }
+ }
+@@ -243,11 +219,8 @@ mod tests {
+ favicon_png: Some(Vec::new()),
+ favicon_svg: Some(Vec::new()),
+ js: Vec::new(),
+- highlight_css: Vec::new(),
+ tomorrow_night_css: Vec::new(),
+ ayu_highlight_css: Vec::new(),
+- highlight_js: Vec::new(),
+- clipboard_js: Vec::new(),
+ };
+
+ assert_eq!(got, empty);
+diff --git a/vendor/mdbook/src/theme/searcher/mod.rs b/vendor/mdbook/src/theme/searcher/mod.rs
+index d5029db..59eda8a 100644
+--- a/vendor/mdbook/src/theme/searcher/mod.rs
++++ b/vendor/mdbook/src/theme/searcher/mod.rs
+@@ -2,5 +2,3 @@
+ //! the "search" cargo feature is disabled.
+
+ pub static JS: &[u8] = include_bytes!("searcher.js");
+-pub static MARK_JS: &[u8] = include_bytes!("mark.min.js");
+-pub static ELASTICLUNR_JS: &[u8] = include_bytes!("elasticlunr.min.js");
diff --git a/debian/patches/d-0003-cc-psm-rebuild-wasm32.patch b/debian/patches/d-0003-cc-psm-rebuild-wasm32.patch
new file mode 100644
index 000000000..4d793cb81
--- /dev/null
+++ b/debian/patches/d-0003-cc-psm-rebuild-wasm32.patch
@@ -0,0 +1,48 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:08:00 +0100
+Subject: d-0003-cc-psm-rebuild-wasm32
+
+---
+ vendor/cc/src/lib.rs | 2 +-
+ vendor/psm/build.rs | 7 ++-----
+ 2 files changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/vendor/cc/src/lib.rs b/vendor/cc/src/lib.rs
+index e3a2b98..9312931 100644
+--- a/vendor/cc/src/lib.rs
++++ b/vendor/cc/src/lib.rs
+@@ -2238,7 +2238,7 @@ impl Build {
+ || target == "wasm32-unknown-wasi"
+ || target == "wasm32-unknown-unknown"
+ {
+- "clang".to_string()
++ "rust-clang".to_string()
+ } else if target.contains("vxworks") {
+ if self.cpp {
+ "wr-c++".to_string()
+diff --git a/vendor/psm/build.rs b/vendor/psm/build.rs
+index 01a13bf..30bd68d 100644
+--- a/vendor/psm/build.rs
++++ b/vendor/psm/build.rs
+@@ -50,7 +50,7 @@ fn find_assembly(
+ ("sparc", _, _, _) => Some(("src/arch/sparc_sysv.s", true)),
+ ("riscv32", _, _, _) => Some(("src/arch/riscv.s", true)),
+ ("riscv64", _, _, _) => Some(("src/arch/riscv64.s", true)),
+- ("wasm32", _, _, _) => Some(("src/arch/wasm32.o", true)),
++ ("wasm32", _, _, _) => Some(("src/arch/wasm32.s", true)),
+ _ => None,
+ }
+ }
+@@ -94,11 +94,8 @@ fn main() {
+ cfg.define(&*format!("CFG_TARGET_ENV_{}", env), None);
+ }
+
+- // For wasm targets we ship a precompiled `*.o` file so we just pass that
+- // directly to `ar` to assemble an archive. Otherwise we're actually
+- // compiling the source assembly file.
+ if asm.ends_with(".o") {
+- cfg.object(asm);
++ panic!("Debian does not allow embedded object files in source code")
+ } else {
+ cfg.file(asm);
+ }
diff --git a/debian/patches/d-0004-clippy-feature-sync.patch b/debian/patches/d-0004-clippy-feature-sync.patch
new file mode 100644
index 000000000..8c0c0fb97
--- /dev/null
+++ b/debian/patches/d-0004-clippy-feature-sync.patch
@@ -0,0 +1,37 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:08:00 +0100
+Subject: d-0004-clippy-feature-sync
+
+enable features needed by rustfmt to make build system happy and speedup build.
+this is what rustc_workspace_hack does in the upstream build.
+---
+ src/tools/clippy/Cargo.toml | 3 ++-
+ src/tools/rustfmt/Cargo.toml | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/tools/clippy/Cargo.toml b/src/tools/clippy/Cargo.toml
+index 1aad7cf..705a880 100644
+--- a/src/tools/clippy/Cargo.toml
++++ b/src/tools/clippy/Cargo.toml
+@@ -42,7 +43,7 @@ if_chain = "1.0"
+ itertools = "0.10.1"
+ quote = "1.0"
+ serde = { version = "1.0.125", features = ["derive"] }
+-syn = { version = "1.0", features = ["full"] }
++syn = { version = "1.0", features = ["full", "visit"] }
+ futures = "0.3"
+ parking_lot = "0.12"
+ tokio = { version = "1", features = ["io-util"] }
+diff --git a/src/tools/rustfmt/Cargo.toml b/src/tools/rustfmt/Cargo.toml
+index 27b91f2..12d1567 100644
+--- a/src/tools/rustfmt/Cargo.toml
++++ b/src/tools/rustfmt/Cargo.toml
+@@ -49,7 +49,7 @@ lazy_static = "1.4"
+ log = "0.4"
+ regex = "1.5"
+ serde = { version = "1.0", features = ["derive"] }
+-serde_json = "1.0"
++serde_json = { version = "1.0", features = ["unbounded_depth"] }
+ term = "0.7"
+ thiserror = "1.0"
+ toml = "0.5"
diff --git a/debian/patches/d-0005-no-jemalloc.patch b/debian/patches/d-0005-no-jemalloc.patch
new file mode 100644
index 000000000..6d8620a01
--- /dev/null
+++ b/debian/patches/d-0005-no-jemalloc.patch
@@ -0,0 +1,46 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Sat, 2 Oct 2021 01:08:00 +0100
+Subject: d-0005-no-jemalloc
+
+---
+ compiler/rustc/Cargo.toml | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/compiler/rustc/Cargo.toml b/compiler/rustc/Cargo.toml
+index 27ee3dd..87fb29f 100644
+--- a/compiler/rustc/Cargo.toml
++++ b/compiler/rustc/Cargo.toml
+@@ -13,13 +13,7 @@ rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
+ # crate is intended to be used by stable MIR consumers, which are not in-tree
+ rustc_smir = { path = "../rustc_smir" }
+
+-[dependencies.jemalloc-sys]
+-version = "0.5.0"
+-optional = true
+-features = ['unprefixed_malloc_on_supported_platforms']
+-
+ [features]
+-jemalloc = ['jemalloc-sys']
+ llvm = ['rustc_driver/llvm']
+ max_level_info = ['rustc_driver/max_level_info']
+ rustc_use_parallel_compiler = ['rustc_driver/rustc_use_parallel_compiler']
+diff --git a/src/tools/rust-analyzer/crates/profile/Cargo.toml b/src/tools/rust-analyzer/crates/profile/Cargo.toml
+index 99d4179dc20..0b78a45a24b 100644
+--- a/src/tools/rust-analyzer/crates/profile/Cargo.toml
++++ b/src/tools/rust-analyzer/crates/profile/Cargo.toml
+@@ -15,7 +15,6 @@ cfg-if = "1.0.0"
+ libc = "0.2.126"
+ la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
+ countme = { version = "3.0.1", features = ["enable"] }
+-jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = true }
+
+ [target.'cfg(target_os = "linux")'.dependencies]
+ perf-event = "0.4.7"
+@@ -24,7 +25,6 @@ winapi = { version = "0.3.9", features = ["processthreadsapi", "psapi"] }
+
+ [features]
+ cpu_profiler = []
+-jemalloc = ["jemalloc-ctl"]
+
+ # Uncomment to enable for the whole crate graph
+ # default = [ "cpu_profiler" ]
diff --git a/debian/patches/d-armel-fix-lldb.patch b/debian/patches/d-armel-fix-lldb.patch
new file mode 100644
index 000000000..12d64570b
--- /dev/null
+++ b/debian/patches/d-armel-fix-lldb.patch
@@ -0,0 +1,19 @@
+run panics if lldb is not installed and no output is produced..
+
+diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
+index c0fa8c9acb..2b5559efc7 100644
+--- a/src/bootstrap/test.rs
++++ b/src/bootstrap/test.rs
+@@ -1476,7 +1476,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
+ .ok();
+ if let Some(ref vers) = lldb_version {
+ cmd.arg("--lldb-version").arg(vers);
+- let lldb_python_dir = run(Command::new(lldb_exe).arg("-P")).ok();
++ let lldb_python_dir = Command::new(lldb_exe)
++ .arg("-P")
++ .output()
++ .map(|output| String::from_utf8_lossy(&output.stdout).to_string())
++ .ok();
+ if let Some(ref dir) = lldb_python_dir {
+ cmd.arg("--lldb-python-dir").arg(dir);
+ }
diff --git a/debian/patches/d-bootstrap-cargo-check-cfg.patch b/debian/patches/d-bootstrap-cargo-check-cfg.patch
new file mode 100644
index 000000000..e15707199
--- /dev/null
+++ b/debian/patches/d-bootstrap-cargo-check-cfg.patch
@@ -0,0 +1,19 @@
+our cargo doesn't know about the 'output' part yet, this patch can be dropped
+with cargo >= 0.64
+
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index 0ab4824ac0a..76c476f449b 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -1480,9 +1480,9 @@ impl<'a> Builder<'a> {
+ // complete list of features, so for that reason we don't enable checking of
+ // features for std crates.
+ cargo.arg(if mode != Mode::Std {
+- "-Zcheck-cfg=names,values,output,features"
++ "-Zcheck-cfg=names,values,features"
+ } else {
+- "-Zcheck-cfg=names,values,output"
++ "-Zcheck-cfg=names,values"
+ });
+
+ // Add extra cfg not defined in/by rustc
diff --git a/debian/patches/d-bootstrap-cargo-doc-paths.patch b/debian/patches/d-bootstrap-cargo-doc-paths.patch
new file mode 100644
index 000000000..17c284f8b
--- /dev/null
+++ b/debian/patches/d-bootstrap-cargo-doc-paths.patch
@@ -0,0 +1,243 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: Fix links to cargo-doc
+
+We package cargo docs in a slightly different location; also tweak linkchecker
+to not fail these links.
+---
+ .../edition-guide/src/editions/advanced-migrations.md | 14 +++++++-------
+ ...ansitioning-an-existing-project-to-a-new-edition.md | 4 ++--
+ .../src/rust-2021/default-cargo-resolver.md | 10 +++++-----
+ src/doc/index.md | 2 +-
+ src/doc/reference/src/conditional-compilation.md | 2 +-
+ src/doc/reference/src/introduction.md | 4 ++--
+ src/doc/reference/src/linkage.md | 2 +-
+ src/doc/reference/src/procedural-macros.md | 2 +-
+ src/doc/rustc/src/tests/index.md | 4 ++--
+ src/doc/rustc/src/what-is-rustc.md | 2 +-
+ src/doc/edition-guide/book.toml | 18 +++++++++---------
+ src/tools/linkchecker/main.rs | 6 ++++++
+ 12 files changed, 38 insertions(+), 32 deletions(-)
+
+diff --git a/src/doc/edition-guide/src/editions/advanced-migrations.md b/src/doc/edition-guide/src/editions/advanced-migrations.md
+index b804ae6..b8136d7 100644
+--- a/src/doc/edition-guide/src/editions/advanced-migrations.md
++++ b/src/doc/edition-guide/src/editions/advanced-migrations.md
+@@ -186,18 +186,18 @@ Afterwards, the line with `extern crate rand;` in `src/lib.rs` will be removed.
+
+ We're now more idiomatic, and we didn't have to fix our code manually!
+
+-[`cargo check`]: ../../cargo/commands/cargo-check.html
+-[`cargo fix`]: ../../cargo/commands/cargo-fix.html
++[`cargo check`]: ../../../cargo-doc/doc/commands/cargo-check.html
++[`cargo fix`]: ../../../cargo-doc/doc/commands/cargo-fix.html
+ [`explicit-outlives-requirements`]: ../../rustc/lints/listing/allowed-by-default.html#explicit-outlives-requirements
+ [`keyword-idents`]: ../../rustc/lints/listing/allowed-by-default.html#keyword-idents
+ [`rustfix`]: https://github.com/rust-lang/rustfix
+ [`unused-extern-crates`]: ../../rustc/lints/listing/allowed-by-default.html#unused-extern-crates
+-[Cargo features]: ../../cargo/reference/features.html
+-[Cargo package]: ../../cargo/reference/manifest.html#the-package-section
+-[Cargo targets]: ../../cargo/reference/cargo-targets.html
+-[Cargo workspace]: ../../cargo/reference/workspaces.html
++[Cargo features]: ../../../cargo-doc/doc/reference/features.html
++[Cargo package]: ../../../cargo-doc/doc/reference/manifest.html#the-package-section
++[Cargo targets]: ../../../cargo-doc/doc/reference/cargo-targets.html
++[Cargo workspace]: ../../../cargo-doc/doc/reference/workspaces.html
+ [CLI flag]: ../../rustc/lints/levels.html#via-compiler-flag
+-[Code generation]: ../../cargo/reference/build-script-examples.html#code-generation
++[Code generation]: ../../../cargo-doc/doc/reference/build-script-examples.html#code-generation
+ [conditional compilation]: ../../reference/conditional-compilation.html
+ [documentation tests]: ../../rustdoc/documentation-tests.html
+ [JSON messages]: ../../rustc/json.html
+diff --git a/src/doc/edition-guide/src/editions/transitioning-an-existing-project-to-a-new-edition.md b/src/doc/edition-guide/src/editions/transitioning-an-existing-project-to-a-new-edition.md
+index 4343529..7f7f0b6 100644
+--- a/src/doc/edition-guide/src/editions/transitioning-an-existing-project-to-a-new-edition.md
++++ b/src/doc/edition-guide/src/editions/transitioning-an-existing-project-to-a-new-edition.md
+@@ -83,7 +83,7 @@ If new warnings are issued, you may want to consider running `cargo fix` again (
+
+ Congrats! Your code is now valid in both Rust 2015 and Rust 2018!
+
+-[`cargo fix`]: ../../cargo/commands/cargo-fix.html
+-[`cargo test`]: ../../cargo/commands/cargo-test.html
++[`cargo fix`]: ../../../cargo-doc/doc/commands/cargo-fix.html
++[`cargo test`]: ../../../cargo-doc/doc/commands/cargo-test.html
+ [Advanced migration strategies]: advanced-migrations.md
+ [nightly channel]: ../../book/appendix-07-nightly-rust.html
+diff --git a/src/doc/edition-guide/src/rust-2021/default-cargo-resolver.md b/src/doc/edition-guide/src/rust-2021/default-cargo-resolver.md
+index 9abc5a6..dff04a4 100644
+--- a/src/doc/edition-guide/src/rust-2021/default-cargo-resolver.md
++++ b/src/doc/edition-guide/src/rust-2021/default-cargo-resolver.md
+@@ -21,11 +21,11 @@ The new feature resolver no longer merges all requested features for
+ crates that are depended on in multiple ways.
+ See [the announcement of Rust 1.51][5] for details.
+
+-[4]: ../../cargo/reference/resolver.html#feature-resolver-version-2
++[4]: ../../../cargo-doc/doc/reference/resolver.html#feature-resolver-version-2
+ [5]: https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver
+-[workspace]: ../../cargo/reference/workspaces.html
+-[virtual workspace]: ../../cargo/reference/workspaces.html#virtual-manifest
+-[`resolver` field]: ../../cargo/reference/resolver.html#resolver-versions
++[workspace]: ../../../cargo-doc/doc/reference/workspaces.html
++[virtual workspace]: ../../../cargo-doc/doc/reference/workspaces.html#virtual-manifest
++[`resolver` field]: ../../../cargo-doc/doc/reference/resolver.html#resolver-versions
+
+ ## Migration
+
+@@ -176,4 +176,4 @@ This snippet of output shows that the project `foo` depends on `bar` with the "d
+ Then, `bar` depends on `bstr` as a build-dependency with the "default" feature.
+ We can further see that `bstr`'s "default" feature enables "unicode" (among other features).
+
+-[`cargo tree`]: ../../cargo/commands/cargo-tree.html
++[`cargo tree`]: ../../../cargo-doc/doc/commands/cargo-tree.html
+diff --git a/src/doc/index.md b/src/doc/index.md
+index 2c92d5e..9be58d5 100644
+--- a/src/doc/index.md
++++ b/src/doc/index.md
+@@ -87,7 +87,7 @@ accomplishing various tasks.
+
+ ## The Cargo Book
+
+-[The Cargo Book](cargo/index.html) is a guide to Cargo, Rust's build tool and dependency manager.
++[The Cargo Book](../../cargo-doc/doc/index.html) is a guide to Cargo, Rust's build tool and dependency manager.
+
+ ## The Rustdoc Book
+
+diff --git a/src/doc/reference/src/conditional-compilation.md b/src/doc/reference/src/conditional-compilation.md
+index 6966cec..0ca3589 100644
+--- a/src/doc/reference/src/conditional-compilation.md
++++ b/src/doc/reference/src/conditional-compilation.md
+@@ -351,6 +351,6 @@ println!("I'm running on a {} machine!", machine_kind);
+ [`target_feature` attribute]: attributes/codegen.md#the-target_feature-attribute
+ [attribute]: attributes.md
+ [attributes]: attributes.md
+-[cargo-feature]: ../cargo/reference/features.html
++[cargo-feature]: ../../cargo-doc/doc/reference/features.html
+ [crate type]: linkage.md
+ [static C runtime]: linkage.md#static-and-dynamic-c-runtimes
+diff --git a/src/doc/reference/src/introduction.md b/src/doc/reference/src/introduction.md
+index 9038efd..dbfbd39 100644
+--- a/src/doc/reference/src/introduction.md
++++ b/src/doc/reference/src/introduction.md
+@@ -135,8 +135,8 @@ We also want the reference to be as normative as possible, so if you see anythin
+ [the Rust Reference repository]: https://github.com/rust-lang/reference/
+ [Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/
+ [_Expression_]: expressions.md
+-[cargo book]: ../cargo/index.html
+-[cargo reference]: ../cargo/reference/index.html
++[cargo book]: ../../cargo-doc/doc/index.html
++[cargo reference]: ../../cargo-doc/doc/reference/index.html
+ [expressions chapter]: expressions.html
+ [file an issue]: https://github.com/rust-lang/reference/issues
+ [lifetime of temporaries]: expressions.html#temporaries
+diff --git a/src/doc/reference/src/linkage.md b/src/doc/reference/src/linkage.md
+index b152005..14277bf 100644
+--- a/src/doc/reference/src/linkage.md
++++ b/src/doc/reference/src/linkage.md
+@@ -201,7 +201,7 @@ fn main() {
+ }
+ ```
+
+-[cargo]: ../cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
++[cargo]: ../../cargo-doc/doc/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
+
+ To use this feature locally, you typically will use the `RUSTFLAGS` environment
+ variable to specify flags to the compiler through Cargo. For example to compile
+diff --git a/src/doc/reference/src/procedural-macros.md b/src/doc/reference/src/procedural-macros.md
+index d983394..6f363f6 100644
+--- a/src/doc/reference/src/procedural-macros.md
++++ b/src/doc/reference/src/procedural-macros.md
+@@ -331,7 +331,7 @@ Note that neither declarative nor proced
+ their equivalent `#[doc = r"str"]` attributes when passed to macros.
+
+ [Attribute macros]: #attribute-macros
+-[Cargo's build scripts]: ../cargo/reference/build-scripts.html
++[Cargo's build scripts]: ../../cargo-doc/doc/reference/build-scripts.html
+ [Derive macros]: #derive-macros
+ [Function-like macros]: #function-like-procedural-macros
+ [`Delimiter::None`]: ../proc_macro/enum.Delimiter.html#variant.None
+diff --git a/src/doc/rustc/src/tests/index.md b/src/doc/rustc/src/tests/index.md
+index 32baed9..53c97f8 100644
+--- a/src/doc/rustc/src/tests/index.md
++++ b/src/doc/rustc/src/tests/index.md
+@@ -301,7 +301,7 @@ Experimental support for using custom test harnesses is available on the
+ [`--test` option]: ../command-line-arguments.md#option-test
+ [`-Z panic-abort-tests`]: https://github.com/rust-lang/rust/issues/67650
+ [`available_parallelism`]: ../../std/thread/fn.available_parallelism.html
+-[`cargo test`]: ../../cargo/commands/cargo-test.html
++[`cargo test`]: ../../../cargo-doc/doc/commands/cargo-test.html
+ [`libtest`]: ../../test/index.html
+ [`main` function]: ../../reference/crates-and-source-files.html#main-functions
+ [`Result`]: ../../std/result/index.html
+@@ -311,7 +311,7 @@ Experimental support for using custom test harnesses is available on the
+ [attribute-should_panic]: ../../reference/attributes/testing.html#the-should_panic-attribute
+ [attribute-test]: ../../reference/attributes/testing.html#the-test-attribute
+ [bench-docs]: ../../unstable-book/library-features/test.html
+-[Cargo]: ../../cargo/index.html
++[Cargo]: ../../../cargo-doc/doc/index.html
+ [crate type]: ../../reference/linkage.html
+ [custom_test_frameworks documentation]: ../../unstable-book/language-features/custom-test-frameworks.html
+ [nightly channel]: ../../book/appendix-07-nightly-rust.html
+diff --git a/src/doc/rustc/src/what-is-rustc.md b/src/doc/rustc/src/what-is-rustc.md
+index 39a05cf..d106986 100644
+--- a/src/doc/rustc/src/what-is-rustc.md
++++ b/src/doc/rustc/src/what-is-rustc.md
+@@ -5,7 +5,7 @@ language, provided by the project itself. Compilers take your source code and
+ produce binary code, either as a library or executable.
+
+ Most Rust programmers don't invoke `rustc` directly, but instead do it through
+-[Cargo](../cargo/index.html). It's all in service of `rustc` though! If you
++[Cargo](../../cargo-doc/doc/index.html). It's all in service of `rustc` though! If you
+ want to see how Cargo calls `rustc`, you can
+
+ ```bash
+diff --git a/src/doc/edition-guide/book.toml b/src/doc/edition-guide/book.toml
+index 8d8b263..8d31dfe 100644
+--- a/src/doc/edition-guide/book.toml
++++ b/src/doc/edition-guide/book.toml
+@@ -53,15 +53,15 @@ git-repository-url = "https://github.com/rust-lang/edition-guide"
+ "/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.html" = "https://blog.rust-lang.org/2018/02/15/Rust-1.24.html#incremental-compilation"
+ "/rust-2018/the-compiler/an-attribute-for-deprecation.html" = "../../../reference/attributes/diagnostics.html#the-deprecated-attribute"
+ "/rust-2018/rustup-for-managing-rust-versions.html" = "https://rust-lang.github.io/rustup/"
+-"/rust-2018/cargo-and-crates-io/index.html" = "../../../cargo/index.html"
+-"/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html" = "../../../cargo/commands/cargo-check.html"
+-"/rust-2018/cargo-and-crates-io/cargo-install-for-easy-installation-of-tools.html" = "../../../cargo/commands/cargo-install.html"
++"/rust-2018/cargo-and-crates-io/index.html" = "../../../../cargo-doc/doc/index.html"
++"/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html" = "../../../../cargo-doc/doc/commands/cargo-check.html"
++"/rust-2018/cargo-and-crates-io/cargo-install-for-easy-installation-of-tools.html" = "../../../../cargo-doc/doc/commands/cargo-install.html"
+ "/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.html" = "https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#cargo-features"
+-"/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.html" = "../../../cargo/commands/cargo-rustc.html"
+-"/rust-2018/cargo-and-crates-io/cargo-workspaces-for-multi-package-projects.html" = "../../../cargo/reference/workspaces.html"
+-"/rust-2018/cargo-and-crates-io/multi-file-examples.html" = "../../../cargo/guide/project-layout.html"
+-"/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html" = "../../../cargo/reference/overriding-dependencies.html#the-patch-section"
+-"/rust-2018/cargo-and-crates-io/cargo-can-use-a-local-registry-replacement.html" = "../../../cargo/reference/source-replacement.html"
++"/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.html" = "../../../../cargo-doc/doc/commands/cargo-rustc.html"
++"/rust-2018/cargo-and-crates-io/cargo-workspaces-for-multi-package-projects.html" = "../../../../cargo-doc/doc/reference/workspaces.html"
++"/rust-2018/cargo-and-crates-io/multi-file-examples.html" = "../../../../cargo-doc/doc/guide/project-layout.html"
++"/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html" = "../../../../cargo-doc/doc/reference/overriding-dependencies.html#the-patch-section"
++"/rust-2018/cargo-and-crates-io/cargo-can-use-a-local-registry-replacement.html" = "../../../../cargo-doc/doc/reference/source-replacement.html"
+ "/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html" = "https://blog.rust-lang.org/2016/01/21/Rust-1.6.html#cratesio-disallows-wildcards"
+ "/rust-2018/documentation/index.html" = "../../../index.html"
+ "/rust-2018/documentation/new-editions-of-the-book.html" = "../../../book/index.html"
+@@ -93,4 +93,4 @@ git-repository-url = "https://github.com/rust-lang/edition-guide"
+ "/rust-next/future.html" = "../../std/future/trait.Future.html"
+ "/rust-next/alloc.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#the-alloc-crate-is-stable"
+ "/rust-next/maybe-uninit.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#maybeuninitt-instead-of-memuninitialized"
+-"/rust-next/cargo-vendor.html" = "../../cargo/commands/cargo-vendor.html"
++"/rust-next/cargo-vendor.html" = "../../../cargo-doc/doc/commands/cargo-vendor.html"
+diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
+index a22dc5f..c8d521a 100644
+--- a/src/tools/linkchecker/main.rs
++++ b/src/tools/linkchecker/main.rs
+@@ -285,6 +285,12 @@ impl Checker {
+ return;
+ }
+ }
++ if let Some(path_str) = path.to_str() {
++ if path_str.contains("/cargo-doc/doc/") {
++ // link to related cargo-doc, ok for our Debian build
++ return;
++ }
++ }
+ if is_exception(file, &target_pretty_path) {
+ report.links_ignored_exception += 1;
+ } else {
diff --git a/debian/patches/d-bootstrap-custom-debuginfo-path.patch b/debian/patches/d-bootstrap-custom-debuginfo-path.patch
new file mode 100644
index 000000000..f955cffbf
--- /dev/null
+++ b/debian/patches/d-bootstrap-custom-debuginfo-path.patch
@@ -0,0 +1,40 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-bootstrap-custom-debuginfo-path
+
+===================================================================
+---
+ src/bootstrap/lib.rs | 5 ++---
+ src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs | 2 +-
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index ddc92ba..259b56e 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -1023,10 +1023,9 @@ impl Build {
+
+ match which {
+ GitRepo::Rustc => {
+- let sha = self.rust_sha().unwrap_or(&self.version);
+- Some(format!("/rustc/{}", sha))
++ Some(format!("/usr/src/rustc-{}", &self.version))
+ }
+- GitRepo::Llvm => Some(String::from("/rustc/llvm")),
++ GitRepo::Llvm => panic!("GitRepo::Llvm unsupported on Debian"),
+ }
+ }
+
+diff --git a/src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs b/src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs
+index b66abc6..f6efe1e 100644
+--- a/src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs
++++ b/src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs
+@@ -7,7 +7,7 @@
+ // true automatically. If paths to std library hasn't been remapped, we use the
+ // above simulate-remapped-rust-src-base option to do it temporarily
+
+-// CHECK: !DIFile(filename: "{{/rustc/.*/library/std/src/panic.rs}}"
++// CHECK: !DIFile(filename: "{{/usr/src/rustc-.*/library/std/src/panic.rs}}"
+ fn main() {
+ std::thread::spawn(|| {
+ println!("hello");
diff --git a/debian/patches/d-bootstrap-disable-git.patch b/debian/patches/d-bootstrap-disable-git.patch
new file mode 100644
index 000000000..ce02d60b3
--- /dev/null
+++ b/debian/patches/d-bootstrap-disable-git.patch
@@ -0,0 +1,45 @@
+From: Matthijs van Otterdijk <matthijs@wirevirt.net>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: Don't check for cargo-vendor when building from (Debian's) git
+
+Forwarded: not-needed
+
+Forwarded: not-needed
+---
+ src/bootstrap/channel.rs | 6 +++++-
+ src/bootstrap/dist.rs | 5 ++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs
+index 1932a00..7974630 100644
+--- a/src/bootstrap/channel.rs
++++ b/src/bootstrap/channel.rs
+@@ -29,7 +29,11 @@ pub struct Info {
+ impl GitInfo {
+ pub fn new(ignore_git: bool, dir: &Path) -> GitInfo {
+ // See if this even begins to look like a git dir
+- if !dir.join(".git").exists() {
++ //
++ // Debian: force-enabling this block because the debian package is also in a git
++ // repository, but we don't want to parse gitinfo. This is needed for the
++ // bootstrap tests to work which running for Debian git.
++ if true || !dir.join(".git").exists() {
+ return GitInfo::Absent;
+ }
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index 6181a61..5fe3600 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -899,7 +899,10 @@ impl Step for PlainSourceTarball {
+ }
+
+ // If we're building from git sources, we need to vendor a complete distribution.
+- if builder.rust_info.is_git() {
++ //
++ // Debian: disabling this block because the debian package is also in a git
++ // repository, but cargo-vendor should not be installed or run.
++ if false && builder.rust_info.is_git() {
+ // Ensure we have the submodules checked out.
+ builder.update_submodule(Path::new("src/tools/rust-analyzer"));
+
diff --git a/debian/patches/d-bootstrap-install-symlinks.patch b/debian/patches/d-bootstrap-install-symlinks.patch
new file mode 100644
index 000000000..dbd902d9e
--- /dev/null
+++ b/debian/patches/d-bootstrap-install-symlinks.patch
@@ -0,0 +1,36 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: Install symlinks as-is, don't dereference them
+
+Our patch to mdbook installs symlinks to systems versions of font-awesome,
+highlight, etc. Upstream mdbook otherwise doesn't use symlinks, so this
+doesn't affect anything else that's already generated.
+---
+ src/tools/rust-installer/install-template.sh | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/tools/rust-installer/install-template.sh b/src/tools/rust-installer/install-template.sh
+index e68be89..a19997b 100644
+--- a/src/tools/rust-installer/install-template.sh
++++ b/src/tools/rust-installer/install-template.sh
+@@ -625,7 +625,10 @@ install_components() {
+
+ maybe_backup_path "$_file_install_path"
+
+- if echo "$_file" | grep "^bin/" > /dev/null || test -x "$_src_dir/$_component/$_file"
++ if [ -h "$_src_dir/$_component/$_file" ]
++ then
++ run cp -d "$_src_dir/$_component/$_file" "$_file_install_path"
++ elif echo "$_file" | grep "^bin/" > /dev/null || test -x "$_src_dir/$_component/$_file"
+ then
+ run cp "$_src_dir/$_component/$_file" "$_file_install_path"
+ run chmod 755 "$_file_install_path"
+@@ -647,7 +650,7 @@ install_components() {
+
+ maybe_backup_path "$_file_install_path"
+
+- run cp -R "$_src_dir/$_component/$_file" "$_file_install_path"
++ run cp -dR "$_src_dir/$_component/$_file" "$_file_install_path"
+ critical_need_ok "failed to copy directory"
+
+ # Set permissions. 0755 for dirs, 644 for files
diff --git a/debian/patches/d-bootstrap-no-assume-tools.patch b/debian/patches/d-bootstrap-no-assume-tools.patch
new file mode 100644
index 000000000..c72ec4d7f
--- /dev/null
+++ b/debian/patches/d-bootstrap-no-assume-tools.patch
@@ -0,0 +1,27 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-bootstrap-no-assume-tools
+
+===================================================================
+---
+ src/bootstrap/builder/tests.rs | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
+index 4ab502e..5ce7fc8 100644
+--- a/src/bootstrap/builder/tests.rs
++++ b/src/bootstrap/builder/tests.rs
+@@ -364,9 +364,13 @@ mod dist {
+ #[test]
+ fn dist_only_cross_host() {
+ let b = TargetSelection::from_user("B");
++ let mut tools = std::collections::HashSet::new();
++ tools.insert("clippy".to_string());
++ tools.insert("rustfmt".to_string());
+ let mut config = configure(&["A", "B"], &["A", "B"]);
+ config.docs = false;
+ config.extended = true;
++ config.tools = Some(tools);
+ config.hosts = vec![b];
+ let mut cache = run_build(&[], config);
+
diff --git a/debian/patches/d-bootstrap-old-cargo-compat.patch b/debian/patches/d-bootstrap-old-cargo-compat.patch
new file mode 100644
index 000000000..e30d4a245
--- /dev/null
+++ b/debian/patches/d-bootstrap-old-cargo-compat.patch
@@ -0,0 +1,45 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: Backwards-compat for cargo 0.47
+
+ The flag being removed here was added in
+ https://github.com/rust-lang/cargo/pull/9404 released in cargo 0.54
+
+ This works around a feature introduced in this PR
+ https://github.com/rust-lang/cargo/pull/8640 released in cargo 0.53
+
+ Therefore it is not needed for Debian's current cargo 0.47.
+
+ We can drop this patch when updating to cargo 0.54 and later.
+---
+ src/bootstrap/doc.rs | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
+index fb5395d..72eac7c 100644
+--- a/src/bootstrap/doc.rs
++++ b/src/bootstrap/doc.rs
+@@ -446,7 +446,6 @@ impl Step for Std {
+ cargo
+ .arg("-p")
+ .arg(package)
+- .arg("-Zskip-rustdoc-fingerprint")
+ .arg("--")
+ .arg("--markdown-css")
+ .arg("rust.css")
+@@ -590,7 +589,6 @@ impl Step for Rustc {
+ cargo.rustdocflag("--generate-link-to-definition");
+ compile::rustc_cargo(builder, &mut cargo, target);
+ cargo.arg("-Zunstable-options");
+- cargo.arg("-Zskip-rustdoc-fingerprint");
+
+ // Only include compiler crates, no dependencies of those, such as `libc`.
+ // Do link to dependencies on `docs.rs` however using `rustdoc-map`.
+@@ -712,7 +710,6 @@ macro_rules! tool_doc {
+ &[],
+ );
+
+- cargo.arg("-Zskip-rustdoc-fingerprint");
+ // Only include compiler crates, no dependencies of those, such as `libc`.
+ cargo.arg("--no-deps");
+ $(
diff --git a/debian/patches/d-bootstrap-permit-symlink-in-docs.patch b/debian/patches/d-bootstrap-permit-symlink-in-docs.patch
new file mode 100644
index 000000000..635e2e786
--- /dev/null
+++ b/debian/patches/d-bootstrap-permit-symlink-in-docs.patch
@@ -0,0 +1,14 @@
+partial revert of b9eedea4b0368fd1f00f204db75109ff444fab5b upstream
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index b1fae356d89..10ed8ffb714 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -83,6 +83,7 @@ impl Step for Docs {
+ tarball.set_product_name("Rust Documentation");
+ tarball.add_bulk_dir(&builder.doc_out(host), dest);
+ tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644);
++ tarball.permit_symlinks(true);
+ Some(tarball.generate())
+ }
+ }
diff --git a/debian/patches/d-bootstrap-read-beta-version-from-file.patch b/debian/patches/d-bootstrap-read-beta-version-from-file.patch
new file mode 100644
index 000000000..a5b385d13
--- /dev/null
+++ b/debian/patches/d-bootstrap-read-beta-version-from-file.patch
@@ -0,0 +1,37 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: d-bootstrap-read-beta-version-from-file
+
+===================================================================
+---
+ src/bootstrap/lib.rs | 14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index 68d387b..ddc92ba 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -1266,14 +1266,15 @@ impl Build {
+ return s;
+ }
+
+- // Figure out how many merge commits happened since we branched off master.
+- // That's our beta number!
+- // (Note that we use a `..` range, not the `...` symmetric difference.)
+- let count =
+- output(self.config.git().arg("rev-list").arg("--count").arg("--merges").arg(format!(
+- "refs/remotes/origin/{}..HEAD",
+- self.config.stage0_metadata.config.nightly_branch
+- )));
++ // Debian: read beta number from "version" file, this is only available
++ // in the rustc upstream tarballs and not their git
++ let count = output(
++ Command::new("sed")
++ .arg("-re")
++ .arg(r"s/[0-9]+.[0-9]+.[0-9]+-beta.([0-9]+) \(.*\)/\1/g")
++ .arg("version")
++ .current_dir(&self.src),
++ );
+ let n = count.trim().parse().unwrap();
+ self.prerelease_version.set(Some(n));
+ n
diff --git a/debian/patches/d-bootstrap-rustflags.patch b/debian/patches/d-bootstrap-rustflags.patch
new file mode 100644
index 000000000..a28810e89
--- /dev/null
+++ b/debian/patches/d-bootstrap-rustflags.patch
@@ -0,0 +1,32 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: d-bootstrap-rustflags
+
+===================================================================
+---
+ src/bootstrap/builder.rs | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index 23ea2fe..b2b1c54 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -1505,6 +1505,18 @@ impl<'a> Builder<'a> {
+ }
+ }
+
++ // Debian-specific stuff here
++ // set linker flags from LDFLAGS
++ if let Ok(ldflags) = env::var("LDFLAGS") {
++ for flag in ldflags.split_whitespace() {
++ if target.contains("windows") && flag.contains("relro") {
++ // relro is ELF-specific
++ continue;
++ }
++ rustflags.arg(&format!("-Clink-args={}", flag));
++ }
++ }
++
+ // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
+ // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
+ // #71458.
diff --git a/debian/patches/d-bootstrap-use-local-css.patch b/debian/patches/d-bootstrap-use-local-css.patch
new file mode 100644
index 000000000..7aadf5f21
--- /dev/null
+++ b/debian/patches/d-bootstrap-use-local-css.patch
@@ -0,0 +1,42 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-bootstrap-use-local-css
+
+===================================================================
+---
+ src/bootstrap/doc.rs | 15 ++++-----------
+ 1 file changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
+index f8ba05c..fb5395d 100644
+--- a/src/bootstrap/doc.rs
++++ b/src/bootstrap/doc.rs
+@@ -373,6 +373,10 @@ impl Step for Standalone {
+ .arg(&builder.src.join("src/doc/index.md"))
+ .arg("--markdown-playground-url")
+ .arg("https://play.rust-lang.org/")
++ .arg("--markdown-css")
++ .arg(format!("rustdoc{}.css", &builder.version))
++ .arg("--markdown-css")
++ .arg("rust.css")
+ .arg("-o")
+ .arg(&out)
+ .arg(&path);
+@@ -381,17 +385,6 @@ impl Step for Standalone {
+ cmd.arg("--disable-minification");
+ }
+
+- if filename == "not_found.md" {
+- cmd.arg("--markdown-css")
+- .arg(format!("https://doc.rust-lang.org/rustdoc{}.css", &builder.version))
+- .arg("--markdown-css")
+- .arg("https://doc.rust-lang.org/rust.css");
+- } else {
+- cmd.arg("--markdown-css")
+- .arg(format!("rustdoc{}.css", &builder.version))
+- .arg("--markdown-css")
+- .arg("rust.css");
+- }
+ builder.run(&mut cmd);
+ }
+
diff --git a/debian/patches/d-bootstrap-use-system-compiler-rt.patch b/debian/patches/d-bootstrap-use-system-compiler-rt.patch
new file mode 100644
index 000000000..22843aeb1
--- /dev/null
+++ b/debian/patches/d-bootstrap-use-system-compiler-rt.patch
@@ -0,0 +1,40 @@
+Description: Use system compiler-rt from clang
+Forwarded: not-needed
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -200,6 +200,12 @@
+ let mut features = builder.std_features();
+ features.push_str(&compiler_builtins_c_feature);
+
++ // In Debian this is always available
++ let llvm_config = builder.ensure(native::Llvm {
++ target: builder.config.build,
++ emscripten: false,
++ });
++ cargo.env("LLVM_CONFIG", llvm_config);
+ if compiler.stage != 0 && builder.config.sanitizers {
+ // This variable is used by the sanitizer runtime crates, e.g.
+ // rustc_lsan, to build the sanitizer runtime from C code
+@@ -208,11 +214,6 @@
+ // missing
+ // We also only build the runtimes when --enable-sanitizers (or its
+ // config.toml equivalent) is used
+- let llvm_config = builder.ensure(native::Llvm {
+- target: builder.config.build,
+- emscripten: false,
+- });
+- cargo.env("LLVM_CONFIG", llvm_config);
+ cargo.env("RUSTC_BUILD_SANITIZERS", "1");
+ }
+
+--- a/vendor/compiler_builtins/Cargo.toml
++++ b/vendor/compiler_builtins/Cargo.toml
+@@ -49,7 +49,7 @@
+ # LLVM_CONFIG or CLANG (more reliable) must be set.
+ c-system = []
+
+-c = ["c-vendor"]
++c = ["c-system"]
+ compiler-builtins = []
+ default = ["compiler-builtins"]
+ mangled-names = []
diff --git a/debian/patches/d-fix-rustix-outline.patch b/debian/patches/d-fix-rustix-outline.patch
new file mode 100644
index 000000000..1800de9e3
--- /dev/null
+++ b/debian/patches/d-fix-rustix-outline.patch
@@ -0,0 +1,60 @@
+Always enable cc even if the feature is not enabled.
+
+Some Debian architectures need outline asm, and Debian does not ship pre-built
+outline asm.
+
+Index: rust/vendor/rustix/Cargo.toml
+===================================================================
+--- rust.orig/vendor/rustix/Cargo.toml
++++ rust/vendor/rustix/Cargo.toml
+@@ -103,9 +103,9 @@ version = "0.6"
+ [dev-dependencies.tempfile]
+ version = "3.2.0"
+
+-[build-dependencies.cc]
++[build-dependencies.cc_dep]
+ version = "1.0.68"
+-optional = true
++package = "cc"
+
+ [features]
+ all-apis = [
+@@ -168,6 +168,7 @@ use-libc = [
+ "libc_errno",
+ "libc",
+ ]
++cc = []
+
+ [target."cfg(all(any(target_os = \"android\", target_os = \"linux\"), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\"))))))))".dependencies.linux-raw-sys]
+ version = "0.0.46"
+Index: rust/vendor/rustix/build.rs
+===================================================================
+--- rust.orig/vendor/rustix/build.rs
++++ rust/vendor/rustix/build.rs
+@@ -1,5 +1,4 @@
+-#[cfg(feature = "cc")]
+-use cc::Build;
++use cc_dep::Build;
+ use std::env::var;
+ use std::io::Write;
+
+@@ -113,16 +112,16 @@ fn link_in_librustix_outline(arch: &str,
+ println!("cargo:rerun-if-changed={}", to);
+
+ // If "cc" is not enabled, use a pre-built library.
+- #[cfg(not(feature = "cc"))]
++ /*#[cfg(not(feature = "cc"))]
+ {
+ let _ = asm_name;
+ println!("cargo:rustc-link-search={}/{}", OUTLINE_PATH, profile);
+ println!("cargo:rustc-link-lib=static={}", name);
+- }
++ }*/
+
+ // If "cc" is enabled, build the library from source, update the pre-built
+ // version, and assert that the pre-built version is checked in.
+- #[cfg(feature = "cc")]
++ //#[cfg(feature = "cc")]
+ {
+ let out_dir = var("OUT_DIR").unwrap();
+ Build::new().file(&asm_name).compile(&name);
diff --git a/debian/patches/d-remove-arm-privacy-breaches.patch b/debian/patches/d-remove-arm-privacy-breaches.patch
new file mode 100644
index 000000000..b1cf63a09
--- /dev/null
+++ b/debian/patches/d-remove-arm-privacy-breaches.patch
@@ -0,0 +1,195 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: d-remove-arm-privacy-breaches
+
+===================================================================
+---
+ .../crates/stdarch-verify/arm-intrinsics.html | 134 ---------------------
+ 1 file changed, 134 deletions(-)
+
+diff --git a/library/stdarch/crates/stdarch-verify/arm-intrinsics.html b/library/stdarch/crates/stdarch-verify/arm-intrinsics.html
+index ac246c6..f945431 100644
+--- a/library/stdarch/crates/stdarch-verify/arm-intrinsics.html
++++ b/library/stdarch/crates/stdarch-verify/arm-intrinsics.html
+@@ -20,17 +20,12 @@
+ <meta name="keywords" content="">
+ <meta content="Copyright &#169; 1995-2018 Arm Limited (or its affiliates). All rights reserved." name="copyright">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+-<meta name="msapplication-config" content="https://developer.arm.com:443/shared/common/img/favicon/browserconfig.xml">
+-<meta name="msapplication-TileColor" content="#2b5797">
+-<meta name="msapplication-TileImage" content="https://developer.arm.com:443/shared/common/img/favicon/mstile-144x144.png">
+ <meta name="theme-color" content="#ffffff">
+ <meta name="server" content="ARMGPCD2" />
+
+ <meta property="og:title" content="Technologies | NEON Intrinsics Reference – Arm Developer">
+ <meta property="og:description" content="All the NEON intrinsics reference in an interactive page.">
+-<meta property="og:image" content="https://developer.arm.com:443">
+ <meta property="og:site_name" content="ARM Developer">
+-<meta property="og:url" content="https://developer.arm.com/technologies/neon/intrinsics">
+ <meta property="og:type" content="website">
+ <meta property="og:locale" content="en">
+
+@@ -41,64 +36,14 @@
+ <meta name="twitter:site" content="ARM Developer">
+ <meta name="twitter:title" content="Technologies | NEON Intrinsics Reference – Arm Developer">
+ <meta name="twitter:description" content="All the NEON intrinsics reference in an interactive page.">
+-<meta name="twitter:image" content="https://developer.arm.com:443">
+-<meta name="twitter:url" content="https://developer.arm.com/technologies/neon/intrinsics">
+
+ <meta itemprop="name" content="Technologies | NEON Intrinsics Reference – Arm Developer">
+ <meta itemprop="description" content="All the NEON intrinsics reference in an interactive page.">
+-<meta itemprop="image" content="https://developer.arm.com:443">
+-
+-
+-
+-
+- <link rel="stylesheet" type="text/css" href="/shared/developer.arm.com/css/app.css?v=D41D8CD98F00B204E9800998ECF8427E" />
+-
+-
+-
+-<link rel="apple-touch-icon" sizes="57x57" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="60x60" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="72x72" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="76x76" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="114x114" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="120x120" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="144x144" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="152x152" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="apple-touch-icon" sizes="180x180" href="https://developer.arm.com/shared/common/img/favicon/apple-touch-icon.png?v=2.29.0.0" />
+-<link rel="icon" type="image/png" href="https://developer.arm.com/shared/common/img/favicon/favicon-32x32.png?v=2.29.0.0" sizes="32x32" />
+-<link rel="icon" type="image/png" href="https://developer.arm.com/shared/common/img/favicon/favicon-48x48.png?v=2.29.0.0" sizes="48x48" />
+-<link rel="icon" type="image/png" href="https://developer.arm.com/shared/common/img/favicon/android-chrome-192x192.png?v=2.29.0.0" sizes="192x192" />
+-<link rel="icon" type="image/png" href="https://developer.arm.com/shared/common/img/favicon/android-chrome-256x256.png?v=2.29.0.0" sizes="256x256" />
+-<link rel="icon" type="image/png" href="https://developer.arm.com/shared/common/img/favicon/favicon-16x16.png?v=2.29.0.0" sizes="16x16" />
+-<link rel="shortcut icon" type="image/ico" href="https://developer.arm.com/shared/common/img/favicon/favicon.ico?v=2.29.0.0" />
+-<link rel="manifest" href="https://developer.arm.com/shared/common/img/favicon/manifest.json?v=2.29.0.0" />
+-
+- <link rel="search" type="application/opensearchdescription+xml" title="ARM Developer" href="/opensearch.xml"/>
+-
+-
+-
+-
+-
+-<!-- Google Tag Manager -->
+-<script>
+-(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+-new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+-j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+-'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+- })(window, document, 'script', 'dataLayer', 'GTM-K25LQR');
+-</script>
+-<!-- End Google Tag Manager -->
+-
+-
+ </head>
+ <body id="">
+
+
+
+-<noscript>
+- <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K25LQR" height="0" width="0" style="display:none;visibility:hidden"></iframe>
+-</noscript>
+-
+-
+
+ <div class="c-feedback-message-container u-no-print"><style>
+ /* Docs top margin fix */
+@@ -245,7 +190,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+ <span class="navigation-dropdown-label">
+ <a href="/">
+ <span>
+- <img src="/shared/developer.arm.com/img/arm-developer.svg" alt="ARM Developer" />
+ </span>
+ <i class="fa fa-caret-down"></i>
+ </a>
+@@ -437,7 +381,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+
+ </div>
+
+-<link rel="stylesheet" href="https://developer.arm.com/shared/arm-account/css/modules/user-menu.css?v=2.29.0.0" />
+
+ </li>
+ </ul>
+@@ -93318,82 +93261,5 @@ names are the property of their respective holders. <a href="http://www.arm.com/
+
+ </div>
+
+-<script type="text/javascript" src="https://nebula-cdn.kampyle.com/we/8144/onsite/embed.js"></script>
+-
+-
+-
+-
+-<script src="/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>
+-
+-
+-
+-<script type="text/javascript">
+- if (Modernizr && !Modernizr.svg) {
+- var imgs = document.getElementsByTagName('img');
+- var svgExtension = /.*\.svg$/;
+- var l = imgs.length;
+- for (var i = 0; i < l; i++) {
+- if (imgs[i].src.match(svgExtension)) {
+- imgs[i].src = imgs[i].src.slice(0, -3) + 'png';
+- }
+- }
+- }
+-</script>
+-
+-
+-<script src="/shared/vendor/jquery-1.12.4.min.js"></script>
+-<script src="/shared/vendor/foundation.min.js"></script>
+-<script src="/shared/vendor/moment.min.js"></script>
+-<script src="/shared/vendor/js/jquery-rss/src/jquery.rss.js"></script>
+-
+-<script src="/bundles/clipboard?v=IPc2U7tMxf_2TKh6_qbfzIsYI3pmBbWZxHb5M8V-fhg1"></script>
+-
+-<script src="/bundles/placeholder?v=Aw-bm4sJPSuBeTzPpRw_GfXYXI4wKmH607vgMic22c01"></script>
+-
+-<script src="/bundles/waypoints?v=E5Sm2NPVxzLqGyd5lIz-NjBvArn4w7w7IvCs35wz6dA1"></script>
+-
+-
+-
+-<script src="/shared/developer.arm.com/js/common.js?v=09142182FF441DC932039AB1D8CD216F"></script>
+-<script src="/shared/developer.arm.com/js/app.bundle.js?v=09142182FF441DC932039AB1D8CD216F"></script>
+-
+-
+-<script src="/shared/arm.com-new/js/app.constants.js?v=09142182FF441DC932039AB1D8CD216F"></script>
+-<script src="/shared/arm.com-new/js/app.navigation.js?v=09142182FF441DC932039AB1D8CD216F"></script>
+-<script type="text/javascript">
+- (function() {
+- var $userMenu = $('.c-user-menu__root');
+- if ($userMenu) {
+- $userMenu.navigation();
+- }
+- })();
+-</script>
+-
+-
+-
+-<script src="/bundles/jquery-ui?v=atr-jO-t-9RdxuVusckf7yNy0MEEBlVW5TaJCAetR6A1"></script>
+-
+-<script src="/bundles/jqueryval?v=shBfM8gvrYJt6eNs9xKMaOYfzyGdVGLhvPUMJ92MwmM1"></script>
+-
+-<script src="/sitecore%20modules/Web/Web%20Forms%20for%20Marketers/mvc/wffm.min.js"></script>
+-<script>
+- $(document).ready(function() {
+- $("form[data-wffm]").each(function() { $(this).wffmForm(); });
+- });
+-</script>
+-
+-<link rel="stylesheet" type="text/css" href="//fast.fonts.net/t/1.css?apiType=css&projectid=5616bfa5-8ba9-4061-8e15-3a2d29551ced" />
+-
+-
+-<script src="//munchkin.marketo.net/munchkin.js" type="text/javascript"></script>
+-<script type="text/javascript">
+- Munchkin.init('312-SAX-488', {'asyncOnly': true});
+-</script>
+-
+-
+-
+-
+-
+-
+ </body>
+ </html>
diff --git a/debian/patches/d-rust-gdb-paths b/debian/patches/d-rust-gdb-paths
new file mode 100644
index 000000000..4be3024ea
--- /dev/null
+++ b/debian/patches/d-rust-gdb-paths
@@ -0,0 +1,39 @@
+From: Angus Lees <gus@debian.org>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: Hardcode GDB python module directory
+
+Forwarded: not-needed
+
+Debian package installs python modules into a fixed directory, so
+just hardcode path in wrapper script.
+---
+ src/etc/rust-gdb | 2 +-
+ src/etc/rust-gdbgui | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
+index b950cea..5ec8752 100755
+--- a/src/etc/rust-gdb
++++ b/src/etc/rust-gdb
+@@ -11,7 +11,7 @@ else
+ fi
+
+ # Find out where the pretty printer Python module is
+-RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
++RUSTC_SYSROOT="$(if type "$RUSTC" >/dev/null 2>&1; then "$RUSTC" --print=sysroot; else echo /usr; fi)"
+ GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
+
+ # Run GDB with the additional arguments that load the pretty printers
+diff --git a/src/etc/rust-gdbgui b/src/etc/rust-gdbgui
+index 9744913..613737d 100755
+--- a/src/etc/rust-gdbgui
++++ b/src/etc/rust-gdbgui
+@@ -40,7 +40,7 @@ else
+ fi
+
+ # Find out where the pretty printer Python module is
+-RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
++RUSTC_SYSROOT="$(if type "$RUSTC" >/dev/null 2>&1; then "$RUSTC" --print=sysroot; else echo /usr; fi)"
+ GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
+
+ # Set the environment variable `RUST_GDB` to overwrite the call to a
diff --git a/debian/patches/d-rust-lldb-paths b/debian/patches/d-rust-lldb-paths
new file mode 100644
index 000000000..15028a68f
--- /dev/null
+++ b/debian/patches/d-rust-lldb-paths
@@ -0,0 +1,29 @@
+From: Angus Lees <gus@debian.org>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: Hardcode LLDB python module directory
+
+Forwarded: not-needed
+
+Debian package installs python modules into a fixed directory, so
+just hardcode path in wrapper script.
+---
+ src/etc/rust-lldb | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb
+index bce72f1..793f593 100755
+--- a/src/etc/rust-lldb
++++ b/src/etc/rust-lldb
+@@ -7,10 +7,10 @@ set -e
+ host=$(rustc -vV | sed -n -e 's/^host: //p')
+
+ # Find out where to look for the pretty printer Python module
+-RUSTC_SYSROOT=$(rustc --print sysroot)
++RUSTC_SYSROOT="$(if type "$RUSTC" >/dev/null 2>&1; then "$RUSTC" --print=sysroot; else echo /usr; fi)"
+ RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
+
+-lldb=lldb
++lldb=lldb-14
+ if [ -f "$RUST_LLDB" ]; then
+ lldb="$RUST_LLDB"
+ else
diff --git a/debian/patches/d-rustc-add-soname.patch b/debian/patches/d-rustc-add-soname.patch
new file mode 100644
index 000000000..70fdf26b8
--- /dev/null
+++ b/debian/patches/d-rustc-add-soname.patch
@@ -0,0 +1,44 @@
+From: Angus Lees <gus@debian.org>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: Set DT_SONAME when building dylibs
+
+Forwarded: no
+
+In Rust, library filenames include a version-specific hash to help
+the run-time linker find the correct version. Unlike in C/C++, the
+compiler looks for all libraries matching a glob that ignores the
+hash and reads embedded metadata to work out versions, etc.
+
+The upshot is that there is no need for the usual "libfoo.so ->
+libfoo-1.2.3.so" symlink common with C/C++ when building with Rust,
+and no need to communicate an alternate filename to use at run-time
+vs compile time. If linking to a Rust dylib from C/C++ however, a
+"libfoo.so -> libfoo-$hash.so" symlink may well be useful and in
+this case DT_SONAME=libfoo-$hash.so would be required. More
+mundanely, various tools (eg: dpkg-shlibdeps) complain if they don't
+find DT_SONAME on shared libraries in public directories.
+
+This patch passes -Wl,-soname=$outfile when building dylibs (and
+using a GNU linker).
+---
+ compiler/rustc_codegen_ssa/src/back/link.rs | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
+index 04ec1e7..67296ca 100644
+--- a/compiler/rustc_codegen_ssa/src/back/link.rs
++++ b/compiler/rustc_codegen_ssa/src/back/link.rs
+@@ -2175,6 +2175,13 @@ fn add_order_independent_options(
+ }
+
+ add_rpath_args(cmd, sess, codegen_results, out_filename);
++
++ if (crate_type == config::CrateType::Dylib || crate_type == config::CrateType::Cdylib)
++ && sess.target.linker_is_gnu {
++ let filename = String::from(out_filename.file_name().unwrap().to_str().unwrap());
++ let soname = [String::from("-Wl,-soname=") + &filename];
++ cmd.args(&soname);
++ }
+ }
+
+ // Write the NatVis debugger visualizer files for each crate to the temp directory and gather the file paths.
diff --git a/debian/patches/d-rustc-fix-mips64el-bootstrap.patch b/debian/patches/d-rustc-fix-mips64el-bootstrap.patch
new file mode 100644
index 000000000..06d73098a
--- /dev/null
+++ b/debian/patches/d-rustc-fix-mips64el-bootstrap.patch
@@ -0,0 +1,62 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-rustc-fix-mips64el-bootstrap
+
+Bug: https://github.com/rust-lang/rust/issues/52108
+
+===================================================================
+---
+ compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs | 2 +-
+ compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs | 2 +-
+ src/bootstrap/bootstrap.py | 2 ++
+ src/test/assembly/asm/mips-types.rs | 1 +
+ 4 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs
+index fc5dbd1..b9df004 100644
+--- a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs
++++ b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs
+@@ -12,7 +12,7 @@ pub fn target() -> Target {
+ endian: Endian::Big,
+ // NOTE(mips64r2) matches C toolchain
+ cpu: "mips64r2".into(),
+- features: "+mips64r2".into(),
++ features: "+mips64r2,+xgot".into(),
+ max_atomic_width: Some(64),
+ mcount: "_mcount".into(),
+
+diff --git a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs
+index e0d5f6f..57ad8c4 100644
+--- a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs
++++ b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs
+@@ -10,7 +10,7 @@ pub fn target() -> Target {
+ abi: "abi64".into(),
+ // NOTE(mips64r2) matches C toolchain
+ cpu: "mips64r2".into(),
+- features: "+mips64r2".into(),
++ features: "+mips64r2,+xgot".into(),
+ max_atomic_width: Some(64),
+ mcount: "_mcount".into(),
+
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+index 92d29d6..23c0764 100644
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -734,6 +734,8 @@ class RustBuild(object):
+
+ # preserve existing RUSTFLAGS
+ env.setdefault("RUSTFLAGS", "")
++ if self.build_triple().startswith('mips'):
++ env["RUSTFLAGS"] += " -Ctarget-feature=+xgot"
+ build_section = "target.{}".format(self.build)
+ target_features = []
+ if self.get_toml("crt-static", build_section) == "true":
+diff --git a/src/test/assembly/asm/mips-types.rs b/src/test/assembly/asm/mips-types.rs
+index 04bf49a..a7c6056 100644
+--- a/src/test/assembly/asm/mips-types.rs
++++ b/src/test/assembly/asm/mips-types.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // revisions: mips32 mips64
+ // assembly-output: emit-asm
+ //[mips32] compile-flags: --target mips-unknown-linux-gnu
diff --git a/debian/patches/d-rustc-i686-baseline.patch b/debian/patches/d-rustc-i686-baseline.patch
new file mode 100644
index 000000000..127997334
--- /dev/null
+++ b/debian/patches/d-rustc-i686-baseline.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-rustc-i686-baseline
+
+===================================================================
+---
+ compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: rust/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
+===================================================================
+--- rust.orig/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
++++ rust/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
+@@ -2,7 +2,7 @@ use crate::spec::{LinkerFlavor, StackPro
+
+ pub fn target() -> Target {
+ let mut base = super::linux_gnu_base::opts();
+- base.cpu = "pentium4".into();
++ base.cpu = "pentiumpro".into();
+ base.max_atomic_width = Some(64);
+ base.add_pre_link_args(LinkerFlavor::Gcc, &["-m32"]);
+ // don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
diff --git a/debian/patches/d-rustc-prefer-dynamic.patch b/debian/patches/d-rustc-prefer-dynamic.patch
new file mode 100644
index 000000000..13bb42922
--- /dev/null
+++ b/debian/patches/d-rustc-prefer-dynamic.patch
@@ -0,0 +1,18 @@
+Description: Prefer dynamic linking (currently disabled, not applied)
+ As per Debian policy, we basically revert
+ https://github.com/rust-lang/rfcs/blob/master/text/0404-change-prefer-dynamic.md
+ TODO: this does not yet work: https://github.com/rust-lang/rust/issues/43289
+ Perhaps a better method would be to modify dh-cargo instead of rustc
+Author: Ximin Luo <infinity0@debian.org>
+Forwarded: not-needed
+--- a/src/librustc/session/config.rs
++++ b/src/librustc/session/config.rs
+@@ -846,7 +846,7 @@
+ "don't run LLVM's SLP vectorization pass"),
+ soft_float: bool = (false, parse_bool, [TRACKED],
+ "use soft float ABI (*eabihf targets only)"),
+- prefer_dynamic: bool = (false, parse_bool, [TRACKED],
++ prefer_dynamic: bool = (true, parse_bool, [TRACKED],
+ "prefer dynamic linking to static linking"),
+ no_integrated_as: bool = (false, parse_bool, [TRACKED],
+ "use an external assembler rather than LLVM's integrated one"),
diff --git a/debian/patches/d-rustc-windows-ssp.patch b/debian/patches/d-rustc-windows-ssp.patch
new file mode 100644
index 000000000..5d8ba4785
--- /dev/null
+++ b/debian/patches/d-rustc-windows-ssp.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-rustc-windows-ssp
+
+Bug: https://github.com/rust-lang/rust/issues/68973
+---
+ compiler/rustc_target/src/spec/windows_gnu_base.rs | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/compiler/rustc_target/src/spec/windows_gnu_base.rs b/compiler/rustc_target/src/spec/windows_gnu_base.rs
+index d11f1f7..137f8eb 100644
+--- a/compiler/rustc_target/src/spec/windows_gnu_base.rs
++++ b/compiler/rustc_target/src/spec/windows_gnu_base.rs
+@@ -40,6 +40,8 @@ pub fn opts() -> TargetOptions {
+ "-lmsvcrt",
+ "-luser32",
+ "-lkernel32",
++ "-lssp_nonshared",
++ "-lssp",
+ ];
+ let mut late_link_args = TargetOptions::link_args(LinkerFlavor::Ld, mingw_libs);
+ super::add_link_args(&mut late_link_args, LinkerFlavor::Gcc, mingw_libs);
diff --git a/debian/patches/d-rustdoc-disable-embedded-fonts.patch b/debian/patches/d-rustdoc-disable-embedded-fonts.patch
new file mode 100644
index 000000000..49337108c
--- /dev/null
+++ b/debian/patches/d-rustdoc-disable-embedded-fonts.patch
@@ -0,0 +1,77 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-rustdoc-disable-embedded-fonts
+
+===================================================================
+---
+ src/librustdoc/html/render/write_shared.rs | 2 --
+ src/librustdoc/html/static/css/rustdoc.css | 8 --------
+ src/librustdoc/html/static_files.rs | 23 -----------------------
+ 3 files changed, 33 deletions(-)
+
+diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
+index 68f2a54..86f7487 100644
+--- a/src/librustdoc/html/render/write_shared.rs
++++ b/src/librustdoc/html/render/write_shared.rs
+@@ -33,8 +33,6 @@ static FILES_UNVERSIONED: Lazy<FxHashMap
+ "SourceCodePro-Semibold.ttf.woff2" => static_files::source_code_pro::SEMIBOLD,
+ "SourceCodePro-It.ttf.woff2" => static_files::source_code_pro::ITALIC,
+ "SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE,
+- "NanumBarunGothic.ttf.woff2" => static_files::nanum_barun_gothic::REGULAR,
+- "NanumBarunGothic-LICENSE.txt" => static_files::nanum_barun_gothic::LICENSE,
+ "LICENSE-MIT.txt" => static_files::LICENSE_MIT,
+ "LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
+ "COPYRIGHT.txt" => static_files::COPYRIGHT,
+diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
+index 0f4d842..9aec0d6 100644
+--- a/src/librustdoc/html/static/css/rustdoc.css
++++ b/src/librustdoc/html/static/css/rustdoc.css
+@@ -67,14 +67,6 @@
+ font-display: swap;
+ }
+
+-/* Avoid using legacy CJK serif fonts in Windows like Batang. */
+-@font-face {
+- font-family: 'NanumBarunGothic';
+- src: url("NanumBarunGothic.ttf.woff2") format("woff2");
+- font-display: swap;
+- unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
+-}
+-
+ * {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
+index bec5c08..1f6ccf2 100644
+--- a/src/librustdoc/html/static_files.rs
++++ b/src/librustdoc/html/static_files.rs
+@@ -138,29 +138,6 @@ crate mod source_code_pro {
+ pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/SourceCodePro-LICENSE.txt");
+ }
+
+-/// Files related to the Nanum Barun Gothic font.
+-///
+-/// These files are used to avoid some legacy CJK serif fonts in Windows.
+-///
+-/// Note that the Noto Sans KR font, which was used previously but was not very readable on Windows,
+-/// has been replaced by the Nanum Barun Gothic font. This is due to Windows' implementation of font
+-/// rendering that distorts OpenType fonts too much.
+-///
+-/// The font files were generated with these commands:
+-///
+-/// ```sh
+-/// pyftsubset NanumBarunGothic.ttf \
+-/// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
+-/// --output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2
+-/// ```
+-pub(crate) mod nanum_barun_gothic {
+- /// The file `NanumBarunGothic.ttf.woff2`, the Regular variant of the Nanum Barun Gothic font.
+- pub(crate) static REGULAR: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff2");
+-
+- /// The file `NanumBarunGothic-LICENSE.txt`, the license text of the Nanum Barun Gothic font.
+- pub(crate) static LICENSE: &[u8] = include_bytes!("static/fonts/NanumBarunGothic-LICENSE.txt");
+-}
+-
+ /// Files related to the sidebar in rustdoc sources.
+ pub(crate) mod sidebar {
+ /// File script to handle sidebar.
diff --git a/debian/patches/d-test-host-duplicates.patch b/debian/patches/d-test-host-duplicates.patch
new file mode 100644
index 000000000..50c39adf9
--- /dev/null
+++ b/debian/patches/d-test-host-duplicates.patch
@@ -0,0 +1,20 @@
+Description: Work around #842634 on some machines, e.g. Debian porterboxes
+ This should remain commented-out in debian/patches/series, it's not needed everywhere
+Author: Ximin Luo <infinity0@debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/library/std/src/sys_common/net/tests.rs
++++ b/library/std/src/sys_common/net/tests.rs
+@@ -11,8 +11,10 @@
+ for sa in lh {
+ *addrs.entry(sa).or_insert(0) += 1;
+ }
++ let mut v = addrs.iter().filter(|&(_, &v)| v > 1).collect::<Vec<_>>();
++ v.clear();
+ assert_eq!(
+- addrs.iter().filter(|&(_, &v)| v > 1).collect::<Vec<_>>(),
++ v,
+ vec![],
+ "There should be no duplicate localhost entries"
+ );
diff --git a/debian/patches/d-test-ignore-avx-44056.patch b/debian/patches/d-test-ignore-avx-44056.patch
new file mode 100644
index 000000000..c399e32f6
--- /dev/null
+++ b/debian/patches/d-test-ignore-avx-44056.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:39 +0200
+Subject: d-test-ignore-avx-44056
+
+Bug: https://github.com/rust-lang/rust/pull/55667
+
+===================================================================
+---
+ src/test/ui/issues/issue-44056.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/test/ui/issues/issue-44056.rs b/src/test/ui/issues/issue-44056.rs
+index a4903ed..ebe8402 100644
+--- a/src/test/ui/issues/issue-44056.rs
++++ b/src/test/ui/issues/issue-44056.rs
+@@ -1,5 +1,5 @@
+ // build-pass (FIXME(55996): should be run on targets supporting avx)
+-// only-x86_64
++// ignore-test
+ // no-prefer-dynamic
+ // compile-flags: -Ctarget-feature=+avx -Clto
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 000000000..c918b658a
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,70 @@
+# Patches for upstream
+
+# pending, or forwarded
+u-ignore-reproducible-failure.patch
+u-reproducible-build.patch
+u-ignore-endian-big-diff.patch
+
+# can be dropped once upstream updates compiler_builtins
+u-arm-compiler-builtins-weak-linkage-arm.patch
+u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch
+
+# can be dropped once upstream updates rustix
+u-fix-rustix-for-sparc64.patch
+
+# not forwarded, or forwarded but unlikely to be merged
+u-ignore-ppc-hangs.patch
+u-ignore-bpf-test.patch
+u-rustc-llvm-cross-flags.patch
+u-reproducible-dl-stage0.patch
+u-make-tests-work-without-rpath.patch
+#u-allow-system-compiler-rt.patch
+
+# Debian-specific patches, not suitable for upstream
+d-fix-rustix-outline.patch
+
+## Patches needed by debian/prune-unused-deps, for building bootstrap
+d-0000-ignore-removed-submodules.patch
+d-0001-pkg-config-no-special-snowflake.patch
+d-0002-mdbook-strip-embedded-libs.patch
+d-0003-cc-psm-rebuild-wasm32.patch
+d-0004-clippy-feature-sync.patch
+d-0005-no-jemalloc.patch
+
+## Patches to the build process, including doc path tweaks
+## Should not change resulting rustc behaviour
+d-bootstrap-rustflags.patch
+d-remove-arm-privacy-breaches.patch
+d-bootstrap-install-symlinks.patch
+d-bootstrap-disable-git.patch
+d-bootstrap-read-beta-version-from-file.patch
+d-bootstrap-no-assume-tools.patch
+d-bootstrap-cargo-doc-paths.patch
+d-bootstrap-use-local-css.patch
+d-bootstrap-old-cargo-compat.patch
+d-bootstrap-custom-debuginfo-path.patch
+d-bootstrap-permit-symlink-in-docs.patch
+d-test-ignore-avx-44056.patch
+d-bootstrap-cargo-check-cfg.patch
+d-armel-fix-lldb.patch
+
+# Work around for some porterboxes, keep this commented
+#d-test-host-duplicates.patch
+# Experimental patch not yet working
+#d-bootstrap-use-system-compiler-rt.patch
+
+## Patches to rustc behaviour, including path lookup tweaks
+d-rust-gdb-paths
+d-rust-lldb-paths
+d-rustc-add-soname.patch
+d-rustc-fix-mips64el-bootstrap.patch
+d-rustc-windows-ssp.patch
+d-rustc-i686-baseline.patch
+# Experimental patch not yet working
+#d-rustc-prefer-dynamic.patch
+d-rustdoc-disable-embedded-fonts.patch
+
+# cherry-picked from ubuntu
+ubuntu-disable-ppc64el-asm-tests.patch
+ubuntu-ignore-arm-doctest.patch
+ubuntu-Revert-Use-constant-eval-to-do-strict-validity-check.patch
diff --git a/debian/patches/u-allow-system-compiler-rt.patch b/debian/patches/u-allow-system-compiler-rt.patch
new file mode 100644
index 000000000..3bd874a5c
--- /dev/null
+++ b/debian/patches/u-allow-system-compiler-rt.patch
@@ -0,0 +1,327 @@
+Description: Support linking against system clang libs
+ Note: the above PR only covers the compiler_builtins crate, rustc itself also
+ needs patching as per below once that is accepted.
+Forwarded: https://github.com/rust-lang-nursery/compiler-builtins/pull/296
+--- a/vendor/compiler_builtins/Cargo.toml
++++ b/vendor/compiler_builtins/Cargo.toml
+@@ -43,7 +43,13 @@
+ optional = true
+
+ [features]
+-c = ["cc"]
++c-vendor = ["cc"]
++
++# Link against system clang_rt.* libraries.
++# LLVM_CONFIG or CLANG (more reliable) must be set.
++c-system = []
++
++c = ["c-vendor"]
+ compiler-builtins = []
+ default = ["compiler-builtins"]
+ mangled-names = []
+--- a/vendor/compiler_builtins/build.rs
++++ b/vendor/compiler_builtins/build.rs
+@@ -37,7 +37,7 @@
+ // mangling names though we assume that we're also in test mode so we don't
+ // build anything and we rely on the upstream implementation of compiler-rt
+ // functions
+- if !cfg!(feature = "mangled-names") && cfg!(feature = "c") {
++ if !cfg!(feature = "mangled-names") && cfg!(any(feature = "c-vendor", feature = "c-system")) {
+ // Don't use a C compiler for these targets:
+ //
+ // * wasm32 - clang 8 for wasm is somewhat hard to come by and it's
+@@ -47,8 +47,10 @@
+ // compiler nor is cc-rs ready for compilation to riscv (at this
+ // time). This can probably be removed in the future
+ if !target.contains("wasm32") && !target.contains("nvptx") && !target.starts_with("riscv") {
+- #[cfg(feature = "c")]
+- c::compile(&llvm_target);
++ #[cfg(feature = "c-vendor")]
++ c_vendor::compile(&llvm_target);
++ #[cfg(feature = "c-system")]
++ c_system::compile(&llvm_target);
+ }
+ }
+
+@@ -70,17 +72,14 @@
+ }
+ }
+
+-#[cfg(feature = "c")]
+-mod c {
+- extern crate cc;
+-
++#[cfg(any(feature = "c-vendor", feature = "c-system"))]
++mod sources {
+ use std::collections::BTreeMap;
+ use std::env;
+- use std::path::PathBuf;
+
+- struct Sources {
++ pub struct Sources {
+ // SYMBOL -> PATH TO SOURCE
+- map: BTreeMap<&'static str, &'static str>,
++ pub map: BTreeMap<&'static str, &'static str>,
+ }
+
+ impl Sources {
+@@ -117,39 +116,11 @@
+ }
+ }
+
+- /// Compile intrinsics from the compiler-rt C source code
+- pub fn compile(llvm_target: &[&str]) {
++ pub fn get_sources(llvm_target: &[&str]) -> Sources {
+ let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
+ let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
+ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
+ let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap();
+- let cfg = &mut cc::Build::new();
+-
+- cfg.warnings(false);
+-
+- if target_env == "msvc" {
+- // Don't pull in extra libraries on MSVC
+- cfg.flag("/Zl");
+-
+- // Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP
+- cfg.define("__func__", Some("__FUNCTION__"));
+- } else {
+- // Turn off various features of gcc and such, mostly copying
+- // compiler-rt's build system already
+- cfg.flag("-fno-builtin");
+- cfg.flag("-fvisibility=hidden");
+- cfg.flag("-ffreestanding");
+- // Avoid the following warning appearing once **per file**:
+- // clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7' [-Wignored-optimization-argument]
+- //
+- // Note that compiler-rt's build system also checks
+- //
+- // `check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)`
+- //
+- // in https://github.com/rust-lang/compiler-rt/blob/c8fbcb3/cmake/config-ix.cmake#L19.
+- cfg.flag_if_supported("-fomit-frame-pointer");
+- cfg.define("VISIBILITY_HIDDEN", None);
+- }
+
+ let mut sources = Sources::new();
+ sources.extend(&[
+@@ -411,6 +382,48 @@
+ sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]);
+ }
+
++ sources
++ }
++}
++
++#[cfg(feature = "c-vendor")]
++mod c_vendor {
++ extern crate cc;
++
++ use std::env;
++ use std::path::PathBuf;
++ use sources;
++
++ /// Compile intrinsics from the compiler-rt C source code
++ pub fn compile(llvm_target: &[&str]) {
++ let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
++ let cfg = &mut cc::Build::new();
++ cfg.warnings(false);
++
++ if target_env == "msvc" {
++ // Don't pull in extra libraries on MSVC
++ cfg.flag("/Zl");
++
++ // Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP
++ cfg.define("__func__", Some("__FUNCTION__"));
++ } else {
++ // Turn off various features of gcc and such, mostly copying
++ // compiler-rt's build system already
++ cfg.flag("-fno-builtin");
++ cfg.flag("-fvisibility=hidden");
++ cfg.flag("-ffreestanding");
++ // Avoid the following warning appearing once **per file**:
++ // clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7' [-Wignored-optimization-argument]
++ //
++ // Note that compiler-rt's build system also checks
++ //
++ // `check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)`
++ //
++ // in https://github.com/rust-lang/compiler-rt/blob/c8fbcb3/cmake/config-ix.cmake#L19.
++ cfg.flag_if_supported("-fomit-frame-pointer");
++ cfg.define("VISIBILITY_HIDDEN", None);
++ }
++
+ // When compiling the C code we require the user to tell us where the
+ // source code is, and this is largely done so when we're compiling as
+ // part of rust-lang/rust we can use the same llvm-project repository as
+@@ -423,6 +436,7 @@
+ panic!("RUST_COMPILER_RT_ROOT={} does not exist", root.display());
+ }
+
++ let sources = sources::get_sources(llvm_target);
+ let src_dir = root.join("lib/builtins");
+ for (sym, src) in sources.map.iter() {
+ let src = src_dir.join(src);
+@@ -434,3 +448,103 @@
+ cfg.compile("libcompiler-rt.a");
+ }
+ }
++
++#[cfg(feature = "c-system")]
++mod c_system {
++ use std::env;
++ use std::process::{Command, Output};
++ use std::str;
++ use std::path::Path;
++ use sources;
++
++ fn success_output(err: &str, cmd: &mut Command) -> Output {
++ let output = cmd.output().expect(err);
++ let status = output.status;
++ if !status.success() {
++ panic!("{}: {:?}", err, status.code());
++ }
++ output
++ }
++
++ // This can be obtained by adding the line:
++ // message(STATUS "All builtin supported architectures: ${ALL_BUILTIN_SUPPORTED_ARCH}")
++ // to the bottom of compiler-rt/cmake/builtin-config-ix.cmake, then running
++ // cmake and looking at the output.
++ const ALL_SUPPORTED_ARCHES : &'static str = "i386;x86_64;arm;armhf;armv6m;armv7m;armv7em;armv7;armv7s;armv7k;aarch64;hexagon;mips;mipsel;mips64;mips64el;powerpc64;powerpc64le;riscv32;riscv64;wasm32;wasm64";
++
++ // This function recreates the logic of getArchNameForCompilerRTLib,
++ // defined in clang/lib/Driver/ToolChain.cpp.
++ fn get_arch_name_for_compiler_rtlib() -> String {
++ let target = env::var("TARGET").unwrap();
++ let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
++ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
++ let r = match target_arch.as_str() {
++ "arm" => if target.ends_with("eabihf") && target_os != "windows" {
++ "armhf"
++ } else {
++ "arm"
++ },
++ "x86" => if target_os == "android" {
++ "i686"
++ } else {
++ "i386"
++ },
++ _ => target_arch.as_str(),
++ };
++ r.to_string()
++ }
++
++ /// Link against system clang runtime libraries
++ pub fn compile(llvm_target: &[&str]) {
++ let target = env::var("TARGET").unwrap();
++ let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
++ let compiler_rt_arch = get_arch_name_for_compiler_rtlib();
++
++ if ALL_SUPPORTED_ARCHES.split(";").find(|x| *x == compiler_rt_arch) == None {
++ return;
++ }
++
++ if let Ok(clang) = env::var("CLANG") {
++ let output = success_output(
++ "failed to find clang's compiler-rt",
++ Command::new(clang)
++ .arg(format!("--target={}", target))
++ .arg("--rtlib=compiler-rt")
++ .arg("--print-libgcc-file-name"),
++ );
++ let fullpath = Path::new(str::from_utf8(&output.stdout).unwrap());
++ let libpath = fullpath.parent().unwrap().display();
++ let libname = fullpath
++ .file_stem()
++ .unwrap()
++ .to_str()
++ .unwrap()
++ .trim_start_matches("lib");
++ println!("cargo:rustc-link-search=native={}", libpath);
++ println!("cargo:rustc-link-lib=static={}", libname);
++ } else if let Ok(llvm_config) = env::var("LLVM_CONFIG") {
++ // fallback if clang is not installed
++ let (subpath, libname) = match target_os.as_str() {
++ "linux" => ("linux", format!("clang_rt.builtins-{}", &compiler_rt_arch)),
++ "macos" => ("darwin", "clang_rt.builtins_osx_dynamic".to_string()),
++ _ => panic!("unsupported target os: {}", target_os),
++ };
++ let cmd = format!("ls -1d $({} --libdir)/clang/*/lib/{}", llvm_config, subpath);
++ let output = success_output(
++ "failed to find clang's lib dir",
++ Command::new("sh").args(&["-ec", &cmd]),
++ );
++ for search_dir in str::from_utf8(&output.stdout).unwrap().lines() {
++ println!("cargo:rustc-link-search=native={}", search_dir);
++ }
++ println!("cargo:rustc-link-lib=static={}", libname);
++ } else {
++ panic!("neither CLANG nor LLVM_CONFIG could be read");
++ }
++
++ let sources = sources::get_sources(llvm_target);
++ for (sym, _src) in sources.map.iter() {
++ println!("cargo:rustc-cfg={}=\"optimized-c\"", sym);
++ }
++ }
++}
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -213,6 +213,7 @@
+ emscripten: false,
+ });
+ cargo.env("LLVM_CONFIG", llvm_config);
++ cargo.env("RUSTC_BUILD_SANITIZERS", "1");
+ }
+
+ cargo.arg("--features").arg(features)
+--- a/src/librustc_asan/build.rs
++++ b/src/librustc_asan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+
+ fn main() {
++ if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++ return;
++ }
+ if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+ build_helper::restore_library_path();
+
+--- a/src/librustc_lsan/build.rs
++++ b/src/librustc_lsan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+
+ fn main() {
++ if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++ return;
++ }
+ if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+ build_helper::restore_library_path();
+
+--- a/src/librustc_msan/build.rs
++++ b/src/librustc_msan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+
+ fn main() {
++ if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++ return;
++ }
+ if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+ build_helper::restore_library_path();
+
+--- a/src/librustc_tsan/build.rs
++++ b/src/librustc_tsan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+
+ fn main() {
++ if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++ return;
++ }
+ if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+ build_helper::restore_library_path();
+
diff --git a/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch b/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch
new file mode 100644
index 000000000..796c17cef
--- /dev/null
+++ b/debian/patches/u-arm-compiler-builtins-add-sync-builtin-fallbacks.patch
@@ -0,0 +1,223 @@
+From 56172fcd8bd045e38bbdf76697d1fcca1e965d6d Mon Sep 17 00:00:00 2001
+From: Alex Huszagh <ahuszagh@gmail.com>
+Date: Fri, 29 Jul 2022 16:58:05 -0500
+Subject: [PATCH] Add compiler-rt fallbacks for sync builtins on armv5te-musl.
+
+---
+https://github.com/rust-lang/compiler-builtins/pull/484
+
+ src/arm_linux.rs | 110 +++++++++++++++++++++++++++++++----------------
+ 1 file changed, 73 insertions(+), 37 deletions(-)
+
+diff --git a/vendor/compiler_builtins/src/arm_linux.rs b/vendor/compiler_builtins/src/arm_linux.rs
+index 8fe0948..8f22eb6 100644
+--- a/vendor/compiler_builtins/src/arm_linux.rs
++++ b/vendor/compiler_builtins/src/arm_linux.rs
+@@ -55,7 +55,7 @@ fn insert_aligned(aligned: u32, val: u32, shift: u32, mask: u32) -> u32 {
+ }
+
+ // Generic atomic read-modify-write operation
+-unsafe fn atomic_rmw<T, F: Fn(u32) -> u32>(ptr: *mut T, f: F) -> u32 {
++unsafe fn atomic_rmw<T, F: Fn(u32) -> u32, G: Fn(u32, u32) -> u32>(ptr: *mut T, f: F, g: G) -> u32 {
+ let aligned_ptr = align_ptr(ptr);
+ let (shift, mask) = get_shift_mask(ptr);
+
+@@ -65,7 +65,7 @@ unsafe fn atomic_rmw<T, F: Fn(u32) -> u32>(ptr: *mut T, f: F) -> u32 {
+ let newval = f(curval);
+ let newval_aligned = insert_aligned(curval_aligned, newval, shift, mask);
+ if __kuser_cmpxchg(curval_aligned, newval_aligned, aligned_ptr) {
+- return curval;
++ return g(curval, newval);
+ }
+ }
+ }
+@@ -89,13 +89,21 @@ unsafe fn atomic_cmpxchg<T>(ptr: *mut T, oldval: u32, newval: u32) -> u32 {
+ }
+
+ macro_rules! atomic_rmw {
+- ($name:ident, $ty:ty, $op:expr) => {
++ ($name:ident, $ty:ty, $op:expr, $fetch:expr) => {
+ intrinsics! {
+ pub unsafe extern "C" fn $name(ptr: *mut $ty, val: $ty) -> $ty {
+- atomic_rmw(ptr, |x| $op(x as $ty, val) as u32) as $ty
++ atomic_rmw(ptr, |x| $op(x as $ty, val) as u32, |old, new| $fetch(old, new)) as $ty
+ }
+ }
+ };
++
++ (@old $name:ident, $ty:ty, $op:expr) => {
++ atomic_rmw!($name, $ty, $op, |old, _| old);
++ };
++
++ (@new $name:ident, $ty:ty, $op:expr) => {
++ atomic_rmw!($name, $ty, $op, |_, new| new);
++ };
+ }
+ macro_rules! atomic_cmpxchg {
+ ($name:ident, $ty:ty) => {
+@@ -107,101 +115,129 @@ macro_rules! atomic_cmpxchg {
+ };
+ }
+
+-atomic_rmw!(__sync_fetch_and_add_1, u8, |a: u8, b: u8| a.wrapping_add(b));
+-atomic_rmw!(__sync_fetch_and_add_2, u16, |a: u16, b: u16| a
++atomic_rmw!(@old __sync_fetch_and_add_1, u8, |a: u8, b: u8| a.wrapping_add(b));
++atomic_rmw!(@old __sync_fetch_and_add_2, u16, |a: u16, b: u16| a
++ .wrapping_add(b));
++atomic_rmw!(@old __sync_fetch_and_add_4, u32, |a: u32, b: u32| a
++ .wrapping_add(b));
++
++atomic_rmw!(@new __sync_add_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_add(b));
++atomic_rmw!(@new __sync_add_and_fetch_2, u16, |a: u16, b: u16| a
+ .wrapping_add(b));
+-atomic_rmw!(__sync_fetch_and_add_4, u32, |a: u32, b: u32| a
++atomic_rmw!(@new __sync_add_and_fetch_4, u32, |a: u32, b: u32| a
+ .wrapping_add(b));
+
+-atomic_rmw!(__sync_fetch_and_sub_1, u8, |a: u8, b: u8| a.wrapping_sub(b));
+-atomic_rmw!(__sync_fetch_and_sub_2, u16, |a: u16, b: u16| a
++atomic_rmw!(@old __sync_fetch_and_sub_1, u8, |a: u8, b: u8| a.wrapping_sub(b));
++atomic_rmw!(@old __sync_fetch_and_sub_2, u16, |a: u16, b: u16| a
+ .wrapping_sub(b));
+-atomic_rmw!(__sync_fetch_and_sub_4, u32, |a: u32, b: u32| a
++atomic_rmw!(@old __sync_fetch_and_sub_4, u32, |a: u32, b: u32| a
+ .wrapping_sub(b));
+
+-atomic_rmw!(__sync_fetch_and_and_1, u8, |a: u8, b: u8| a & b);
+-atomic_rmw!(__sync_fetch_and_and_2, u16, |a: u16, b: u16| a & b);
+-atomic_rmw!(__sync_fetch_and_and_4, u32, |a: u32, b: u32| a & b);
++atomic_rmw!(@new __sync_sub_and_fetch_1, u8, |a: u8, b: u8| a.wrapping_sub(b));
++atomic_rmw!(@new __sync_sub_and_fetch_2, u16, |a: u16, b: u16| a
++ .wrapping_sub(b));
++atomic_rmw!(@new __sync_sub_and_fetch_4, u32, |a: u32, b: u32| a
++ .wrapping_sub(b));
++
++atomic_rmw!(@old __sync_fetch_and_and_1, u8, |a: u8, b: u8| a & b);
++atomic_rmw!(@old __sync_fetch_and_and_2, u16, |a: u16, b: u16| a & b);
++atomic_rmw!(@old __sync_fetch_and_and_4, u32, |a: u32, b: u32| a & b);
++
++atomic_rmw!(@new __sync_and_and_fetch_1, u8, |a: u8, b: u8| a & b);
++atomic_rmw!(@new __sync_and_and_fetch_2, u16, |a: u16, b: u16| a & b);
++atomic_rmw!(@new __sync_and_and_fetch_4, u32, |a: u32, b: u32| a & b);
++
++atomic_rmw!(@old __sync_fetch_and_or_1, u8, |a: u8, b: u8| a | b);
++atomic_rmw!(@old __sync_fetch_and_or_2, u16, |a: u16, b: u16| a | b);
++atomic_rmw!(@old __sync_fetch_and_or_4, u32, |a: u32, b: u32| a | b);
++
++atomic_rmw!(@new __sync_or_and_fetch_1, u8, |a: u8, b: u8| a | b);
++atomic_rmw!(@new __sync_or_and_fetch_2, u16, |a: u16, b: u16| a | b);
++atomic_rmw!(@new __sync_or_and_fetch_4, u32, |a: u32, b: u32| a | b);
++
++atomic_rmw!(@old __sync_fetch_and_xor_1, u8, |a: u8, b: u8| a ^ b);
++atomic_rmw!(@old __sync_fetch_and_xor_2, u16, |a: u16, b: u16| a ^ b);
++atomic_rmw!(@old __sync_fetch_and_xor_4, u32, |a: u32, b: u32| a ^ b);
+
+-atomic_rmw!(__sync_fetch_and_or_1, u8, |a: u8, b: u8| a | b);
+-atomic_rmw!(__sync_fetch_and_or_2, u16, |a: u16, b: u16| a | b);
+-atomic_rmw!(__sync_fetch_and_or_4, u32, |a: u32, b: u32| a | b);
++atomic_rmw!(@new __sync_xor_and_fetch_1, u8, |a: u8, b: u8| a ^ b);
++atomic_rmw!(@new __sync_xor_and_fetch_2, u16, |a: u16, b: u16| a ^ b);
++atomic_rmw!(@new __sync_xor_and_fetch_4, u32, |a: u32, b: u32| a ^ b);
+
+-atomic_rmw!(__sync_fetch_and_xor_1, u8, |a: u8, b: u8| a ^ b);
+-atomic_rmw!(__sync_fetch_and_xor_2, u16, |a: u16, b: u16| a ^ b);
+-atomic_rmw!(__sync_fetch_and_xor_4, u32, |a: u32, b: u32| a ^ b);
++atomic_rmw!(@old __sync_fetch_and_nand_1, u8, |a: u8, b: u8| !(a & b));
++atomic_rmw!(@old __sync_fetch_and_nand_2, u16, |a: u16, b: u16| !(a & b));
++atomic_rmw!(@old __sync_fetch_and_nand_4, u32, |a: u32, b: u32| !(a & b));
+
+-atomic_rmw!(__sync_fetch_and_nand_1, u8, |a: u8, b: u8| !(a & b));
+-atomic_rmw!(__sync_fetch_and_nand_2, u16, |a: u16, b: u16| !(a & b));
+-atomic_rmw!(__sync_fetch_and_nand_4, u32, |a: u32, b: u32| !(a & b));
++atomic_rmw!(@new __sync_nand_and_fetch_1, u8, |a: u8, b: u8| !(a & b));
++atomic_rmw!(@new __sync_nand_and_fetch_2, u16, |a: u16, b: u16| !(a & b));
++atomic_rmw!(@new __sync_nand_and_fetch_4, u32, |a: u32, b: u32| !(a & b));
+
+-atomic_rmw!(__sync_fetch_and_max_1, i8, |a: i8, b: i8| if a > b {
++atomic_rmw!(@old __sync_fetch_and_max_1, i8, |a: i8, b: i8| if a > b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_max_2, i16, |a: i16, b: i16| if a > b {
++atomic_rmw!(@old __sync_fetch_and_max_2, i16, |a: i16, b: i16| if a > b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_max_4, i32, |a: i32, b: i32| if a > b {
++atomic_rmw!(@old __sync_fetch_and_max_4, i32, |a: i32, b: i32| if a > b {
+ a
+ } else {
+ b
+ });
+
+-atomic_rmw!(__sync_fetch_and_umax_1, u8, |a: u8, b: u8| if a > b {
++atomic_rmw!(@old __sync_fetch_and_umax_1, u8, |a: u8, b: u8| if a > b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_umax_2, u16, |a: u16, b: u16| if a > b {
++atomic_rmw!(@old __sync_fetch_and_umax_2, u16, |a: u16, b: u16| if a > b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_umax_4, u32, |a: u32, b: u32| if a > b {
++atomic_rmw!(@old __sync_fetch_and_umax_4, u32, |a: u32, b: u32| if a > b {
+ a
+ } else {
+ b
+ });
+
+-atomic_rmw!(__sync_fetch_and_min_1, i8, |a: i8, b: i8| if a < b {
++atomic_rmw!(@old __sync_fetch_and_min_1, i8, |a: i8, b: i8| if a < b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_min_2, i16, |a: i16, b: i16| if a < b {
++atomic_rmw!(@old __sync_fetch_and_min_2, i16, |a: i16, b: i16| if a < b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_min_4, i32, |a: i32, b: i32| if a < b {
++atomic_rmw!(@old __sync_fetch_and_min_4, i32, |a: i32, b: i32| if a < b {
+ a
+ } else {
+ b
+ });
+
+-atomic_rmw!(__sync_fetch_and_umin_1, u8, |a: u8, b: u8| if a < b {
++atomic_rmw!(@old __sync_fetch_and_umin_1, u8, |a: u8, b: u8| if a < b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_umin_2, u16, |a: u16, b: u16| if a < b {
++atomic_rmw!(@old __sync_fetch_and_umin_2, u16, |a: u16, b: u16| if a < b {
+ a
+ } else {
+ b
+ });
+-atomic_rmw!(__sync_fetch_and_umin_4, u32, |a: u32, b: u32| if a < b {
++atomic_rmw!(@old __sync_fetch_and_umin_4, u32, |a: u32, b: u32| if a < b {
+ a
+ } else {
+ b
+ });
+
+-atomic_rmw!(__sync_lock_test_and_set_1, u8, |_: u8, b: u8| b);
+-atomic_rmw!(__sync_lock_test_and_set_2, u16, |_: u16, b: u16| b);
+-atomic_rmw!(__sync_lock_test_and_set_4, u32, |_: u32, b: u32| b);
++atomic_rmw!(@old __sync_lock_test_and_set_1, u8, |_: u8, b: u8| b);
++atomic_rmw!(@old __sync_lock_test_and_set_2, u16, |_: u16, b: u16| b);
++atomic_rmw!(@old __sync_lock_test_and_set_4, u32, |_: u32, b: u32| b);
+
+ atomic_cmpxchg!(__sync_val_compare_and_swap_1, u8);
+ atomic_cmpxchg!(__sync_val_compare_and_swap_2, u16);
+--
+2.39.0
+
diff --git a/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch b/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch
new file mode 100644
index 000000000..530efcebe
--- /dev/null
+++ b/debian/patches/u-arm-compiler-builtins-weak-linkage-arm.patch
@@ -0,0 +1,23 @@
+From 72c872147679096c53cbb49ca670662d05d43110 Mon Sep 17 00:00:00 2001
+From: Lokathor <zefria@gmail.com>
+Date: Tue, 27 Sep 2022 13:22:45 -0600
+Subject: [PATCH] Update macros.rs
+
+---
+https://github.com/rust-lang/compiler-builtins/pull/495
+
+ src/macros.rs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/vendor/compiler_builtins/src/macros.rs b/vendor/compiler_builtins/src/macros.rs
+index 7d90b7aa..477c2568 100644
+--- a/vendor/compiler_builtins/src/macros.rs
++++ b/vendor/compiler_builtins/src/macros.rs
+@@ -266,6 +266,7 @@ macro_rules! intrinsics {
+ #[cfg(target_arch = "arm")]
+ pub mod $alias {
+ #[cfg_attr(not(feature = "mangled-names"), no_mangle)]
++ #[cfg_attr(all(not(windows), not(target_vendor="apple")), linkage = "weak")]
+ pub extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
+ super::$name($($argname),*)
+ }
diff --git a/debian/patches/u-fix-rustix-for-sparc64.patch b/debian/patches/u-fix-rustix-for-sparc64.patch
new file mode 100644
index 000000000..88995cd5b
--- /dev/null
+++ b/debian/patches/u-fix-rustix-for-sparc64.patch
@@ -0,0 +1,203 @@
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/src/imp/libc/process/types.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/src/imp/libc/process/types.rs
+@@ -199,7 +199,12 @@ pub enum Signal {
+ target_os = "openbsd",
+ all(
+ any(target_os = "android", target_os = "linux"),
+- any(target_arch = "mips", target_arch = "mips64"),
++ any(
++ target_arch = "mips",
++ target_arch = "mips64",
++ target_arch = "sparc",
++ target_arch = "sparc64"
++ ),
+ )
+ )))]
+ Stkflt = c::SIGSTKFLT,
+@@ -276,7 +281,12 @@ impl Signal {
+ target_os = "openbsd",
+ all(
+ any(target_os = "android", target_os = "linux"),
+- any(target_arch = "mips", target_arch = "mips64"),
++ any(
++ target_arch = "mips",
++ target_arch = "mips64",
++ target_arch = "sparc",
++ target_arch = "sparc64"
++ ),
+ )
+ )))]
+ c::SIGSTKFLT => Some(Self::Stkflt),
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/src/imp/libc/termios/types.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/src/imp/libc/termios/types.rs
+@@ -704,6 +704,8 @@ pub const B2000000: Speed = c::B2000000;
+
+ /// `B2500000`
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -715,6 +717,8 @@ pub const B2500000: Speed = c::B2500000;
+
+ /// `B3000000`
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -726,6 +730,8 @@ pub const B3000000: Speed = c::B3000000;
+
+ /// `B3500000`
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -737,6 +743,8 @@ pub const B3500000: Speed = c::B3500000;
+
+ /// `B4000000`
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/src/imp/linux_raw/termios/types.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/src/imp/linux_raw/termios/types.rs
+@@ -338,15 +338,19 @@ pub const B1500000: Speed = linux_raw_sy
+ pub const B2000000: Speed = linux_raw_sys::general::B2000000;
+
+ /// `B2500000`
++#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+ pub const B2500000: Speed = linux_raw_sys::general::B2500000;
+
+ /// `B3000000`
++#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+ pub const B3000000: Speed = linux_raw_sys::general::B3000000;
+
+ /// `B3500000`
++#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+ pub const B3500000: Speed = linux_raw_sys::general::B3500000;
+
+ /// `B4000000`
++#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
+ pub const B4000000: Speed = linux_raw_sys::general::B4000000;
+
+ /// `CSIZE`
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/src/termios/constants.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/src/termios/constants.rs
+@@ -45,6 +45,8 @@ pub use imp::termios::types::B2000000;
+ )))]
+ pub use imp::termios::types::B2500000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -54,6 +56,8 @@ pub use imp::termios::types::B2500000;
+ )))]
+ pub use imp::termios::types::B3000000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -63,6 +67,8 @@ pub use imp::termios::types::B3000000;
+ )))]
+ pub use imp::termios::types::B3500000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -74,6 +80,8 @@ pub use imp::termios::types::B4000000;
+ #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
+ pub use imp::termios::types::B460800;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "illumos",
+@@ -688,6 +696,8 @@ pub fn speed_value(speed: imp::termios::
+ )))]
+ imp::termios::types::B2500000 => Some(2_500_000),
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -697,6 +707,8 @@ pub fn speed_value(speed: imp::termios::
+ )))]
+ imp::termios::types::B3000000 => Some(3_000_000),
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -706,6 +718,8 @@ pub fn speed_value(speed: imp::termios::
+ )))]
+ imp::termios::types::B3500000 => Some(3_500_000),
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/src/termios/mod.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/src/termios/mod.rs
+@@ -44,6 +44,8 @@ pub use constants::B1500000;
+ )))]
+ pub use constants::B2000000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -53,6 +55,8 @@ pub use constants::B2000000;
+ )))]
+ pub use constants::B2500000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -62,6 +66,8 @@ pub use constants::B2500000;
+ )))]
+ pub use constants::B3000000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+@@ -71,6 +77,8 @@ pub use constants::B3000000;
+ )))]
+ pub use constants::B3500000;
+ #[cfg(not(any(
++ target_arch = "sparc",
++ target_arch = "sparc64",
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+--- rustc-1.64.0+dfsg1.orig/vendor/rustix/tests/time/y2038.rs
++++ rustc-1.64.0+dfsg1/vendor/rustix/tests/time/y2038.rs
+@@ -14,6 +14,7 @@
+ #[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
+ #[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
+ #[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))]
++#[cfg(not(all(target_os = "linux", target_arch = "sparc")))]
+ #[test]
+ fn test_y2038() {
+ use rustix::time::{Secs, Timespec};
diff --git a/debian/patches/u-ignore-bpf-test.patch b/debian/patches/u-ignore-bpf-test.patch
new file mode 100644
index 000000000..5fa3464ee
--- /dev/null
+++ b/debian/patches/u-ignore-bpf-test.patch
@@ -0,0 +1,18 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-ignore-bpf-test
+
+Bug: https://github.com/rust-lang/rust/issues/89689
+---
+ src/test/assembly/asm/bpf-types.rs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/test/assembly/asm/bpf-types.rs b/src/test/assembly/asm/bpf-types.rs
+index 3428d93..0e129a7 100644
+--- a/src/test/assembly/asm/bpf-types.rs
++++ b/src/test/assembly/asm/bpf-types.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // min-llvm-version: 13.0
+ // assembly-output: emit-asm
+ // compile-flags: --target bpfel-unknown-none -C target_feature=+alu32
diff --git a/debian/patches/u-ignore-endian-big-diff.patch b/debian/patches/u-ignore-endian-big-diff.patch
new file mode 100644
index 000000000..e02960fd9
--- /dev/null
+++ b/debian/patches/u-ignore-endian-big-diff.patch
@@ -0,0 +1,70 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-ignore-endian-big-diff
+
+Bug: https://github.com/rust-lang/rust/issues/89577
+
+===================================================================
+---
+ src/test/ui/consts/const-eval/ub-enum.rs | 1 +
+ src/test/ui/consts/const-eval/ub-int-array.rs | 1 +
+ src/test/ui/consts/const-eval/ub-nonnull.rs | 1 +
+ src/test/ui/consts/const-eval/ub-ref-ptr.rs | 1 +
+ src/test/ui/consts/const-eval/ub-uninhabit.rs | 1 +
+ src/test/ui/consts/const-eval/ub-wide-ptr.rs | 1 +
+ 6 files changed, 6 insertions(+)
+
+diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs
+index 8628868..13d22ac 100644
+--- a/src/test/ui/consts/const-eval/ub-enum.rs
++++ b/src/test/ui/consts/const-eval/ub-enum.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // stderr-per-bitwidth
+ #![feature(never_type)]
+
+diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/src/test/ui/consts/const-eval/ub-int-array.rs
+index 7e0fb33..a54f618 100644
+--- a/src/test/ui/consts/const-eval/ub-int-array.rs
++++ b/src/test/ui/consts/const-eval/ub-int-array.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ #![allow(const_err)] // make sure we cannot allow away the errors tested here
+ // stderr-per-bitwidth
+ //! Test the "array of int" fast path in validity checking, and in particular whether it
+diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs
+index 259707b..145c7df 100644
+--- a/src/test/ui/consts/const-eval/ub-nonnull.rs
++++ b/src/test/ui/consts/const-eval/ub-nonnull.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // stderr-per-bitwidth
+ #![feature(rustc_attrs)]
+ #![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here
+diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
+index 1887cb2..14b15f6 100644
+--- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs
++++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // ignore-tidy-linelength
+ // stderr-per-bitwidth
+ #![allow(invalid_value)]
+diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs
+index 33fbd14..022192f 100644
+--- a/src/test/ui/consts/const-eval/ub-uninhabit.rs
++++ b/src/test/ui/consts/const-eval/ub-uninhabit.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // stderr-per-bitwidth
+ #![allow(const_err)] // make sure we cannot allow away the errors tested here
+
+diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+index ea48a09..4d9cbe1 100644
+--- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs
++++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+@@ -1,3 +1,4 @@
++// ignore-test
+ // stderr-per-bitwidth
+ // ignore-tidy-linelength
+ #![allow(unused)]
diff --git a/debian/patches/u-ignore-ppc-hangs.patch b/debian/patches/u-ignore-ppc-hangs.patch
new file mode 100644
index 000000000..4e35cebb0
--- /dev/null
+++ b/debian/patches/u-ignore-ppc-hangs.patch
@@ -0,0 +1,34 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-ignore-ppc-hangs
+
+Bug: https://github.com/rust-lang/rust/issues/89607
+---
+ library/alloc/tests/arc.rs | 1 +
+ library/alloc/tests/rc.rs | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/library/alloc/tests/arc.rs b/library/alloc/tests/arc.rs
+index ce40b5c..e99ebf5 100644
+--- a/library/alloc/tests/arc.rs
++++ b/library/alloc/tests/arc.rs
+@@ -96,6 +96,7 @@ const SHARED_ITER_MAX: u16 = 100;
+
+ fn assert_trusted_len<I: TrustedLen>(_: &I) {}
+
++#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
+ #[test]
+ fn shared_from_iter_normal() {
+ // Exercise the base implementation for non-`TrustedLen` iterators.
+diff --git a/library/alloc/tests/rc.rs b/library/alloc/tests/rc.rs
+index efb39a6..b2f0e04 100644
+--- a/library/alloc/tests/rc.rs
++++ b/library/alloc/tests/rc.rs
+@@ -92,6 +92,7 @@ const SHARED_ITER_MAX: u16 = 100;
+
+ fn assert_trusted_len<I: TrustedLen>(_: &I) {}
+
++#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
+ #[test]
+ fn shared_from_iter_normal() {
+ // Exercise the base implementation for non-`TrustedLen` iterators.
diff --git a/debian/patches/u-ignore-reproducible-failure.patch b/debian/patches/u-ignore-reproducible-failure.patch
new file mode 100644
index 000000000..e0f9688b3
--- /dev/null
+++ b/debian/patches/u-ignore-reproducible-failure.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-ignore-reproducible-failure
+
+Bug: https://github.com/rust-lang/rust/issues/89911
+---
+ src/test/run-make-fulldeps/reproducible-build-2/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/test/run-make-fulldeps/reproducible-build-2/Makefile b/src/test/run-make-fulldeps/reproducible-build-2/Makefile
+index fd94516..957e1f4 100644
+--- a/src/test/run-make-fulldeps/reproducible-build-2/Makefile
++++ b/src/test/run-make-fulldeps/reproducible-build-2/Makefile
+@@ -14,7 +14,7 @@ fat_lto:
+ $(RUSTC) reproducible-build.rs -C lto=fat
+ cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a
+ $(RUSTC) reproducible-build.rs -C lto=fat
+- cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1
++ cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 0
+
+ sysroot:
+ rm -rf $(TMPDIR) && mkdir $(TMPDIR)
diff --git a/debian/patches/u-make-tests-work-without-rpath.patch b/debian/patches/u-make-tests-work-without-rpath.patch
new file mode 100644
index 000000000..97cd89233
--- /dev/null
+++ b/debian/patches/u-make-tests-work-without-rpath.patch
@@ -0,0 +1,23 @@
+From: Chris Coulson <chris.coulson@canonical.com>
+Date: Thu, 14 Jul 2022 13:17:38 +0200
+Subject: u-make-tests-work-without-rpath
+
+Forwarded: TODO
+
+===================================================================
+---
+ src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
+index 1e267fb..ac46c24 100644
+--- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
++++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
+@@ -1,2 +1,6 @@
++include ../tools.mk
++
++RUSTC := $(RUSTC_ORIGINAL)
++
+ all:
+- '$(PYTHON)' test.py
++ $(HOST_RPATH_ENV) '$(PYTHON)' test.py
diff --git a/debian/patches/u-reproducible-build.patch b/debian/patches/u-reproducible-build.patch
new file mode 100644
index 000000000..1167d1f08
--- /dev/null
+++ b/debian/patches/u-reproducible-build.patch
@@ -0,0 +1,25 @@
+From: Ximin Luo <infinity0@debian.org>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: Don't split dwarf debug for a fully-reproducible build
+
+Bug: https://github.com/rust-lang/rust/issues/34902
+---
+ compiler/rustc_llvm/build.rs | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
+index 7729ec6..b8f67ee 100644
+--- a/compiler/rustc_llvm/build.rs
++++ b/compiler/rustc_llvm/build.rs
+@@ -179,6 +179,11 @@ fn main() {
+ let mut cfg = cc::Build::new();
+ cfg.warnings(false);
+ for flag in cxxflags.split_whitespace() {
++ // Split-dwarf gives unreproducible DW_AT_GNU_dwo_id so don't do it
++ if flag == "-gsplit-dwarf" {
++ continue;
++ }
++
+ // Ignore flags like `-m64` when we're doing a cross build
+ if is_crossed && flag.starts_with("-m") {
+ continue;
diff --git a/debian/patches/u-reproducible-dl-stage0.patch b/debian/patches/u-reproducible-dl-stage0.patch
new file mode 100644
index 000000000..b6ba259ec
--- /dev/null
+++ b/debian/patches/u-reproducible-dl-stage0.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-reproducible-dl-stage0
+
+===================================================================
+---
+ src/bootstrap/bootstrap.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+index ab4338e..0227735 100644
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -92,7 +92,7 @@ def _download(path, url, probably_big, v
+ "-L", # Follow redirect.
+ "-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
+ "--connect-timeout", "30", # timeout if cannot connect within 30 seconds
+- "--retry", "3", "-Sf", "-o", path, url],
++ "--retry", "3", "-Sf", "-o", path, "-R", url],
+ verbose=verbose,
+ exception=True, # Will raise RuntimeError on failure
+ )
diff --git a/debian/patches/u-rustc-llvm-cross-flags.patch b/debian/patches/u-rustc-llvm-cross-flags.patch
new file mode 100644
index 000000000..95988249e
--- /dev/null
+++ b/debian/patches/u-rustc-llvm-cross-flags.patch
@@ -0,0 +1,22 @@
+From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
+Date: Thu, 14 Jul 2022 13:17:37 +0200
+Subject: u-rustc-llvm-cross-flags
+
+===================================================================
+---
+ compiler/rustc_llvm/build.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
+index b8f67ee..e9b1d0a 100644
+--- a/compiler/rustc_llvm/build.rs
++++ b/compiler/rustc_llvm/build.rs
+@@ -294,7 +294,7 @@ fn main() {
+ if let Some(stripped) = lib.strip_prefix("-LIBPATH:") {
+ println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target));
+ } else if let Some(stripped) = lib.strip_prefix("-L") {
+- println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target));
++ if stripped.contains(&host) { println!("cargo:rustc-link-search=native={}", stripped.replace(&host, &target)); }
+ }
+ } else if let Some(stripped) = lib.strip_prefix("-LIBPATH:") {
+ println!("cargo:rustc-link-search=native={}", stripped);
diff --git a/debian/patches/ubuntu-Revert-Use-constant-eval-to-do-strict-validity-check.patch b/debian/patches/ubuntu-Revert-Use-constant-eval-to-do-strict-validity-check.patch
new file mode 100644
index 000000000..c9b50d71f
--- /dev/null
+++ b/debian/patches/ubuntu-Revert-Use-constant-eval-to-do-strict-validity-check.patch
@@ -0,0 +1,569 @@
+From b9e588dfeecca821a4508166027afb6bda721ed6 Mon Sep 17 00:00:00 2001
+From: Simon Chopin <simon.chopin@canonical.com>
+Date: Wed, 18 Jan 2023 17:03:04 +0100
+Subject: [PATCH] Revert "Use constant eval to do strict validity checks"
+
+This reverts commit 27412d1e3e128349bc515c16ce882860e20f037d.
+
+This is likely a LLVM mis-optimization, but we're not really sure. It
+leads to ICE on riscv64.
+
+Bug: https://github.com/rust-lang/rust/issues/102155
+
+---
+ Cargo.lock | 1 -
+ .../src/intrinsics/mod.rs | 15 ++++-
+ compiler/rustc_codegen_ssa/Cargo.toml | 1 -
+ compiler/rustc_codegen_ssa/src/mir/block.rs | 9 +--
+ .../src/const_eval/machine.rs | 2 +-
+ .../src/interpret/intrinsics.rs | 56 ++++++++--------
+ compiler/rustc_const_eval/src/lib.rs | 6 --
+ .../src/might_permit_raw_init.rs | 40 -----------
+ compiler/rustc_middle/src/query/mod.rs | 8 ---
+ compiler/rustc_middle/src/ty/query.rs | 1 -
+ compiler/rustc_query_impl/src/keys.rs | 12 +---
+ compiler/rustc_target/src/abi/mod.rs | 38 ++++++-----
+ .../intrinsics/panic-uninitialized-zeroed.rs | 66 +++++++------------
+ 13 files changed, 94 insertions(+), 161 deletions(-)
+ delete mode 100644 compiler/rustc_const_eval/src/might_permit_raw_init.rs
+
+diff --git a/Cargo.lock b/Cargo.lock
+index 2569b3e1976..b88158f9ff8 100644
+--- a/Cargo.lock
++++ b/Cargo.lock
+@@ -3731,7 +3731,6 @@ dependencies = [
+ "rustc_arena",
+ "rustc_ast",
+ "rustc_attr",
+- "rustc_const_eval",
+ "rustc_data_structures",
+ "rustc_errors",
+ "rustc_fs_util",
+diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+index b2a83e1d4eb..4f9ced001d4 100644
+--- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
++++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+@@ -22,6 +22,7 @@ macro_rules! intrinsic_args {
+ use rustc_middle::ty::print::with_no_trimmed_paths;
+ use rustc_middle::ty::subst::SubstsRef;
+ use rustc_span::symbol::{kw, sym, Symbol};
++use rustc_target::abi::InitKind;
+
+ use crate::prelude::*;
+ use cranelift_codegen::ir::AtomicRmwOp;
+@@ -693,7 +694,12 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
+ return;
+ }
+
+- if intrinsic == sym::assert_zero_valid && !fx.tcx.permits_zero_init(layout) {
++ if intrinsic == sym::assert_zero_valid
++ && !layout.might_permit_raw_init(
++ fx,
++ InitKind::Zero,
++ fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
++
+ with_no_trimmed_paths!({
+ crate::base::codegen_panic(
+ fx,
+@@ -707,7 +713,12 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
+ return;
+ }
+
+- if intrinsic == sym::assert_uninit_valid && !fx.tcx.permits_uninit_init(layout) {
++ if intrinsic == sym::assert_uninit_valid
++ && !layout.might_permit_raw_init(
++ fx,
++ InitKind::Uninit,
++ fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
++
+ with_no_trimmed_paths!({
+ crate::base::codegen_panic(
+ fx,
+diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
+index 46d6344dbb2..e7ee424668b 100644
+--- a/compiler/rustc_codegen_ssa/Cargo.toml
++++ b/compiler/rustc_codegen_ssa/Cargo.toml
+@@ -40,7 +40,6 @@ rustc_metadata = { path = "../rustc_metadata" }
+ rustc_query_system = { path = "../rustc_query_system" }
+ rustc_target = { path = "../rustc_target" }
+ rustc_session = { path = "../rustc_session" }
+-rustc_const_eval = { path = "../rustc_const_eval" }
+
+ [dependencies.object]
+ version = "0.29.0"
+diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
+index 3eee58d9d1c..a9eb4ec6439 100644
+--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
++++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
+@@ -22,7 +22,7 @@
+ use rustc_span::{sym, Symbol};
+ use rustc_symbol_mangling::typeid::typeid_for_fnabi;
+ use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
+-use rustc_target::abi::{self, HasDataLayout, WrappingRange};
++use rustc_target::abi::{self, HasDataLayout, InitKind, WrappingRange};
+ use rustc_target::spec::abi::Abi;
+
+ /// Used by `FunctionCx::codegen_terminator` for emitting common patterns
+@@ -528,6 +528,7 @@ fn codegen_panic_intrinsic(
+ source_info: mir::SourceInfo,
+ target: Option<mir::BasicBlock>,
+ cleanup: Option<mir::BasicBlock>,
++ strict_validity: bool,
+ ) -> bool {
+ // Emit a panic or a no-op for `assert_*` intrinsics.
+ // These are intrinsics that compile to panics so that we can get a message
+@@ -546,13 +547,12 @@ enum AssertIntrinsic {
+ });
+ if let Some(intrinsic) = panic_intrinsic {
+ use AssertIntrinsic::*;
+-
+ let ty = instance.unwrap().substs.type_at(0);
+ let layout = bx.layout_of(ty);
+ let do_panic = match intrinsic {
+ Inhabited => layout.abi.is_uninhabited(),
+- ZeroValid => !bx.tcx().permits_zero_init(layout),
+- UninitValid => !bx.tcx().permits_uninit_init(layout),
++ ZeroValid => !layout.might_permit_raw_init(bx, InitKind::Zero, strict_validity),
++ UninitValid => !layout.might_permit_raw_init(bx, InitKind::Uninit, strict_validity),
+ };
+ if do_panic {
+ let msg_str = with_no_visible_paths!({
+@@ -687,6 +687,7 @@ fn codegen_call_terminator(
+ source_info,
+ target,
+ cleanup,
++ self.cx.tcx().sess.opts.unstable_opts.strict_init_checks,
+ ) {
+ return;
+ }
+diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs
+index fc2e6652a3d..ef6cff42ad9 100644
+--- a/compiler/rustc_const_eval/src/const_eval/machine.rs
++++ b/compiler/rustc_const_eval/src/const_eval/machine.rs
+@@ -104,7 +104,7 @@ pub struct CompileTimeInterpreter<'mir, 'tcx> {
+ }
+
+ impl<'mir, 'tcx> CompileTimeInterpreter<'mir, 'tcx> {
+- pub(crate) fn new(const_eval_limit: Limit, can_access_statics: bool) -> Self {
++ pub(super) fn new(const_eval_limit: Limit, can_access_statics: bool) -> Self {
+ CompileTimeInterpreter {
+ steps_remaining: const_eval_limit.0,
+ stack: Vec::new(),
+diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
+index 08209eb7932..e0ce6d9acc8 100644
+--- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs
++++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs
+@@ -15,7 +15,7 @@
+ use rustc_middle::ty::subst::SubstsRef;
+ use rustc_middle::ty::{Ty, TyCtxt};
+ use rustc_span::symbol::{sym, Symbol};
+-use rustc_target::abi::{Abi, Align, Primitive, Size};
++use rustc_target::abi::{Abi, Align, InitKind, Primitive, Size};
+
+ use super::{
+ util::ensure_monomorphic_enough, CheckInAllocMsg, ImmTy, InterpCx, Machine, OpTy, PlaceTy,
+@@ -435,33 +435,35 @@ pub fn emulate_intrinsic(
+ ),
+ )?;
+ }
+-
+- if intrinsic_name == sym::assert_zero_valid {
+- let should_panic = !self.tcx.permits_zero_init(layout);
+-
+- if should_panic {
+- M::abort(
+- self,
+- format!(
+- "aborted execution: attempted to zero-initialize type `{}`, which is invalid",
+- ty
+- ),
+- )?;
+- }
++ if intrinsic_name == sym::assert_zero_valid
++ && !layout.might_permit_raw_init(
++ self,
++ InitKind::Zero,
++ self.tcx.sess.opts.unstable_opts.strict_init_checks,
++ )
++ {
++ M::abort(
++ self,
++ format!(
++ "aborted execution: attempted to zero-initialize type `{}`, which is invalid",
++ ty
++ ),
++ )?;
+ }
+-
+- if intrinsic_name == sym::assert_uninit_valid {
+- let should_panic = !self.tcx.permits_uninit_init(layout);
+-
+- if should_panic {
+- M::abort(
+- self,
+- format!(
+- "aborted execution: attempted to leave type `{}` uninitialized, which is invalid",
+- ty
+- ),
+- )?;
+- }
++ if intrinsic_name == sym::assert_uninit_valid
++ && !layout.might_permit_raw_init(
++ self,
++ InitKind::Uninit,
++ self.tcx.sess.opts.unstable_opts.strict_init_checks,
++ )
++ {
++ M::abort(
++ self,
++ format!(
++ "aborted execution: attempted to leave type `{}` uninitialized, which is invalid",
++ ty
++ ),
++ )?;
+ }
+ }
+ sym::simd_insert => {
+diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs
+index 72ac6af685d..d65d4f7eb72 100644
+--- a/compiler/rustc_const_eval/src/lib.rs
++++ b/compiler/rustc_const_eval/src/lib.rs
+@@ -33,13 +33,11 @@
+ pub mod const_eval;
+ mod errors;
+ pub mod interpret;
+-mod might_permit_raw_init;
+ pub mod transform;
+ pub mod util;
+
+ use rustc_middle::ty;
+ use rustc_middle::ty::query::Providers;
+-use rustc_target::abi::InitKind;
+
+ pub fn provide(providers: &mut Providers) {
+ const_eval::provide(providers);
+@@ -61,8 +59,4 @@ pub fn provide(providers: &mut Providers) {
+ let (param_env, value) = param_env_and_value.into_parts();
+ const_eval::deref_mir_constant(tcx, param_env, value)
+ };
+- providers.permits_uninit_init =
+- |tcx, ty| might_permit_raw_init::might_permit_raw_init(tcx, ty, InitKind::Uninit);
+- providers.permits_zero_init =
+- |tcx, ty| might_permit_raw_init::might_permit_raw_init(tcx, ty, InitKind::Zero);
+ }
+diff --git a/compiler/rustc_const_eval/src/might_permit_raw_init.rs b/compiler/rustc_const_eval/src/might_permit_raw_init.rs
+deleted file mode 100644
+index f971c2238c7..00000000000
+--- a/compiler/rustc_const_eval/src/might_permit_raw_init.rs
++++ /dev/null
+@@ -1,40 +0,0 @@
+-use crate::const_eval::CompileTimeInterpreter;
+-use crate::interpret::{InterpCx, MemoryKind, OpTy};
+-use rustc_middle::ty::layout::LayoutCx;
+-use rustc_middle::ty::{layout::TyAndLayout, ParamEnv, TyCtxt};
+-use rustc_session::Limit;
+-use rustc_target::abi::InitKind;
+-
+-pub fn might_permit_raw_init<'tcx>(
+- tcx: TyCtxt<'tcx>,
+- ty: TyAndLayout<'tcx>,
+- kind: InitKind,
+-) -> bool {
+- let strict = tcx.sess.opts.unstable_opts.strict_init_checks;
+-
+- if strict {
+- let machine = CompileTimeInterpreter::new(Limit::new(0), false);
+-
+- let mut cx = InterpCx::new(tcx, rustc_span::DUMMY_SP, ParamEnv::reveal_all(), machine);
+-
+- let allocated = cx
+- .allocate(ty, MemoryKind::Machine(crate::const_eval::MemoryKind::Heap))
+- .expect("OOM: failed to allocate for uninit check");
+-
+- if kind == InitKind::Zero {
+- cx.write_bytes_ptr(
+- allocated.ptr,
+- std::iter::repeat(0_u8).take(ty.layout.size().bytes_usize()),
+- )
+- .expect("failed to write bytes for zero valid check");
+- }
+-
+- let ot: OpTy<'_, _> = allocated.into();
+-
+- // Assume that if it failed, it's a validation failure.
+- cx.validate_operand(&ot).is_ok()
+- } else {
+- let layout_cx = LayoutCx { tcx, param_env: ParamEnv::reveal_all() };
+- ty.might_permit_raw_init(&layout_cx, kind)
+- }
+-}
+diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
+index d8483e7e409..e498015a4a5 100644
+--- a/compiler/rustc_middle/src/query/mod.rs
++++ b/compiler/rustc_middle/src/query/mod.rs
+@@ -2049,12 +2049,4 @@
+ desc { |tcx| "looking up generator diagnostic data of `{}`", tcx.def_path_str(key) }
+ separate_provide_extern
+ }
+-
+- query permits_uninit_init(key: TyAndLayout<'tcx>) -> bool {
+- desc { "checking to see if {:?} permits being left uninit", key.ty }
+- }
+-
+- query permits_zero_init(key: TyAndLayout<'tcx>) -> bool {
+- desc { "checking to see if {:?} permits being left zeroed", key.ty }
+- }
+ }
+diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs
+index 2452bcf6a61..3d662ed5de4 100644
+--- a/compiler/rustc_middle/src/ty/query.rs
++++ b/compiler/rustc_middle/src/ty/query.rs
+@@ -28,7 +28,6 @@
+ use crate::traits::specialization_graph;
+ use crate::traits::{self, ImplSource};
+ use crate::ty::fast_reject::SimplifiedType;
+-use crate::ty::layout::TyAndLayout;
+ use crate::ty::subst::{GenericArg, SubstsRef};
+ use crate::ty::util::AlwaysRequiresDrop;
+ use crate::ty::GeneratorDiagnosticData;
+diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs
+index 49175e97f41..4d6bb02c38e 100644
+--- a/compiler/rustc_query_impl/src/keys.rs
++++ b/compiler/rustc_query_impl/src/keys.rs
+@@ -6,7 +6,7 @@
+ use rustc_middle::traits;
+ use rustc_middle::ty::fast_reject::SimplifiedType;
+ use rustc_middle::ty::subst::{GenericArg, SubstsRef};
+-use rustc_middle::ty::{self, layout::TyAndLayout, Ty, TyCtxt};
++use rustc_middle::ty::{self, Ty, TyCtxt};
+ use rustc_span::symbol::{Ident, Symbol};
+ use rustc_span::{Span, DUMMY_SP};
+
+@@ -395,16 +395,6 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
+ }
+ }
+
+-impl<'tcx> Key for TyAndLayout<'tcx> {
+- #[inline(always)]
+- fn query_crate_is_local(&self) -> bool {
+- true
+- }
+- fn default_span(&self, _: TyCtxt<'_>) -> Span {
+- DUMMY_SP
+- }
+-}
+-
+ impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>) {
+ #[inline(always)]
+ fn query_crate_is_local(&self) -> bool {
+diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
+index 92ce4d91d84..d103a06060d 100644
+--- a/compiler/rustc_target/src/abi/mod.rs
++++ b/compiler/rustc_target/src/abi/mod.rs
+@@ -1378,7 +1378,7 @@ pub struct PointeeInfo {
+
+ /// Used in `might_permit_raw_init` to indicate the kind of initialisation
+ /// that is checked to be valid
+-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
++#[derive(Copy, Clone, Debug)]
+ pub enum InitKind {
+ Zero,
+ Uninit,
+@@ -1493,18 +1493,14 @@ pub fn is_zst(&self) -> bool {
+ ///
+ /// `init_kind` indicates if the memory is zero-initialized or left uninitialized.
+ ///
+- /// This code is intentionally conservative, and will not detect
+- /// * zero init of an enum whose 0 variant does not allow zero initialization
+- /// * making uninitialized types who have a full valid range (ints, floats, raw pointers)
+- /// * Any form of invalid value being made inside an array (unless the value is uninhabited)
++ /// `strict` is an opt-in debugging flag added in #97323 that enables more checks.
+ ///
+- /// A strict form of these checks that uses const evaluation exists in
+- /// `rustc_const_eval::might_permit_raw_init`, and a tracking issue for making these checks
+- /// stricter is <https://github.com/rust-lang/rust/issues/66151>.
++ /// This is conservative: in doubt, it will answer `true`.
+ ///
+- /// FIXME: Once all the conservatism is removed from here, and the checks are ran by default,
+- /// we can use the const evaluation checks always instead.
+- pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
++ /// FIXME: Once we removed all the conservatism, we could alternatively
++ /// create an all-0/all-undef constant and run the const value validator to see if
++ /// this is a valid value for the given type.
++ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind, strict: bool) -> bool
+ where
+ Self: Copy,
+ Ty: TyAbiInterface<'a, C>,
+@@ -1517,8 +1513,13 @@ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
+ s.valid_range(cx).contains(0)
+ }
+ InitKind::Uninit => {
+- // The range must include all values.
+- s.is_always_valid(cx)
++ if strict {
++ // The type must be allowed to be uninit (which means "is a union").
++ s.is_uninit_valid()
++ } else {
++ // The range must include all values.
++ s.is_always_valid(cx)
++ }
+ }
+ }
+ };
+@@ -1539,12 +1540,19 @@ pub fn might_permit_raw_init<C>(self, cx: &C, init_kind: InitKind) -> bool
+ // If we have not found an error yet, we need to recursively descend into fields.
+ match &self.fields {
+ FieldsShape::Primitive | FieldsShape::Union { .. } => {}
+- FieldsShape::Array { .. } => {
++ FieldsShape::Array { count, .. } => {
+ // FIXME(#66151): For now, we are conservative and do not check arrays by default.
++ if strict
++ && *count > 0
++ && !self.field(cx, 0).might_permit_raw_init(cx, init_kind, strict)
++ {
++ // Found non empty array with a type that is unhappy about this kind of initialization
++ return false;
++ }
+ }
+ FieldsShape::Arbitrary { offsets, .. } => {
+ for idx in 0..offsets.len() {
+- if !self.field(cx, idx).might_permit_raw_init(cx, init_kind) {
++ if !self.field(cx, idx).might_permit_raw_init(cx, init_kind, strict) {
+ // We found a field that is unhappy with this kind of initialization.
+ return false;
+ }
+diff --git a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
+index 255151a9603..3ffd35ecdb8 100644
+--- a/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
++++ b/src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
+@@ -57,13 +57,6 @@ enum LR_NonZero {
+
+ struct ZeroSized;
+
+-#[allow(dead_code)]
+-#[repr(i32)]
+-enum ZeroIsValid {
+- Zero(u8) = 0,
+- One(NonNull<()>) = 1,
+-}
+-
+ fn test_panic_msg<T>(op: impl (FnOnce() -> T) + panic::UnwindSafe, msg: &str) {
+ let err = panic::catch_unwind(op).err();
+ assert_eq!(
+@@ -159,12 +152,33 @@ fn main() {
+ "attempted to zero-initialize type `*const dyn core::marker::Send`, which is invalid"
+ );
+
++ /* FIXME(#66151) we conservatively do not error here yet.
++ test_panic_msg(
++ || mem::uninitialized::<LR_NonZero>(),
++ "attempted to leave type `LR_NonZero` uninitialized, which is invalid"
++ );
++ test_panic_msg(
++ || mem::zeroed::<LR_NonZero>(),
++ "attempted to zero-initialize type `LR_NonZero`, which is invalid"
++ );
++
++ test_panic_msg(
++ || mem::uninitialized::<ManuallyDrop<LR_NonZero>>(),
++ "attempted to leave type `std::mem::ManuallyDrop<LR_NonZero>` uninitialized, \
++ which is invalid"
++ );
++ test_panic_msg(
++ || mem::zeroed::<ManuallyDrop<LR_NonZero>>(),
++ "attempted to zero-initialize type `std::mem::ManuallyDrop<LR_NonZero>`, \
++ which is invalid"
++ );
++ */
++
+ test_panic_msg(
+ || mem::uninitialized::<(NonNull<u32>, u32, u32)>(),
+ "attempted to leave type `(core::ptr::non_null::NonNull<u32>, u32, u32)` uninitialized, \
+ which is invalid"
+ );
+-
+ test_panic_msg(
+ || mem::zeroed::<(NonNull<u32>, u32, u32)>(),
+ "attempted to zero-initialize type `(core::ptr::non_null::NonNull<u32>, u32, u32)`, \
+@@ -182,23 +196,11 @@ fn main() {
+ which is invalid"
+ );
+
+- test_panic_msg(
+- || mem::uninitialized::<LR_NonZero>(),
+- "attempted to leave type `LR_NonZero` uninitialized, which is invalid"
+- );
+-
+- test_panic_msg(
+- || mem::uninitialized::<ManuallyDrop<LR_NonZero>>(),
+- "attempted to leave type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>` uninitialized, \
+- which is invalid"
+- );
+-
+ test_panic_msg(
+ || mem::uninitialized::<NoNullVariant>(),
+ "attempted to leave type `NoNullVariant` uninitialized, \
+ which is invalid"
+ );
+-
+ test_panic_msg(
+ || mem::zeroed::<NoNullVariant>(),
+ "attempted to zero-initialize type `NoNullVariant`, \
+@@ -210,12 +212,10 @@ fn main() {
+ || mem::uninitialized::<bool>(),
+ "attempted to leave type `bool` uninitialized, which is invalid"
+ );
+-
+ test_panic_msg(
+ || mem::uninitialized::<LR>(),
+ "attempted to leave type `LR` uninitialized, which is invalid"
+ );
+-
+ test_panic_msg(
+ || mem::uninitialized::<ManuallyDrop<LR>>(),
+ "attempted to leave type `core::mem::manually_drop::ManuallyDrop<LR>` uninitialized, which is invalid"
+@@ -229,7 +229,6 @@ fn main() {
+ let _val = mem::zeroed::<Option<&'static i32>>();
+ let _val = mem::zeroed::<MaybeUninit<NonNull<u32>>>();
+ let _val = mem::zeroed::<[!; 0]>();
+- let _val = mem::zeroed::<ZeroIsValid>();
+ let _val = mem::uninitialized::<MaybeUninit<bool>>();
+ let _val = mem::uninitialized::<[!; 0]>();
+ let _val = mem::uninitialized::<()>();
+@@ -260,33 +259,12 @@ fn main() {
+ || mem::zeroed::<[NonNull<()>; 1]>(),
+ "attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid"
+ );
+-
+- // FIXME(#66151) we conservatively do not error here yet (by default).
+- test_panic_msg(
+- || mem::zeroed::<LR_NonZero>(),
+- "attempted to zero-initialize type `LR_NonZero`, which is invalid"
+- );
+-
+- test_panic_msg(
+- || mem::zeroed::<ManuallyDrop<LR_NonZero>>(),
+- "attempted to zero-initialize type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>`, \
+- which is invalid"
+- );
+ } else {
+ // These are UB because they have not been officially blessed, but we await the resolution
+ // of <https://github.com/rust-lang/unsafe-code-guidelines/issues/71> before doing
+ // anything about that.
+ let _val = mem::uninitialized::<i32>();
+ let _val = mem::uninitialized::<*const ()>();
+-
+- // These are UB, but best to test them to ensure we don't become unintentionally
+- // stricter.
+-
+- // It's currently unchecked to create invalid enums and values inside arrays.
+- let _val = mem::zeroed::<LR_NonZero>();
+- let _val = mem::zeroed::<[LR_NonZero; 1]>();
+- let _val = mem::zeroed::<[NonNull<()>; 1]>();
+- let _val = mem::uninitialized::<[NonNull<()>; 1]>();
+ }
+ }
+ }
+--
+2.37.2
+
diff --git a/debian/patches/ubuntu-disable-ppc64el-asm-tests.patch b/debian/patches/ubuntu-disable-ppc64el-asm-tests.patch
new file mode 100644
index 000000000..bc841cc8b
--- /dev/null
+++ b/debian/patches/ubuntu-disable-ppc64el-asm-tests.patch
@@ -0,0 +1,39 @@
+--- a/compiler/rustc_lint_defs/src/builtin.rs
++++ b/compiler/rustc_lint_defs/src/builtin.rs
+@@ -2749,11 +2749,13 @@
+ ///
+ /// use std::arch::asm;
+ ///
++ /// #[cfg(not(any(target_arch = "powerpc64", target_arch = "s390x")))]
+ /// #[naked]
+ /// pub fn default_abi() -> u32 {
+ /// unsafe { asm!("", options(noreturn)); }
+ /// }
+ ///
++ /// #[cfg(not(any(target_arch = "powerpc64", target_arch = "s390x")))]
+ /// #[naked]
+ /// pub extern "Rust" fn rust_abi() -> u32 {
+ /// unsafe { asm!("", options(noreturn)); }
+--- a/src/test/run-make-fulldeps/intrinsic-unreachable/Makefile
++++ b/src/test/run-make-fulldeps/intrinsic-unreachable/Makefile
+@@ -1,6 +1,7 @@
+ -include ../tools.mk
+
+ # ignore-windows-msvc
++# needs-asm-support
+ #
+ # Because of Windows exception handling, the code is not necessarily any shorter.
+ # https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466
+--- a/compiler/rustc_lint/src/builtin.rs
++++ b/compiler/rustc_lint/src/builtin.rs
+@@ -3136,6 +3136,10 @@
+ /// ### Example
+ ///
+ /// ```rust,compile_fail
++ /// #![cfg_attr(
++ /// not(any(target_arch = "powerpc64", target_arch = "s390x")),
++ /// feature(asm_experimental_arch)
++ /// )]
+ /// use std::arch::asm;
+ ///
+ /// fn main() {
diff --git a/debian/patches/ubuntu-ignore-arm-doctest.patch b/debian/patches/ubuntu-ignore-arm-doctest.patch
new file mode 100644
index 000000000..b67b7d2ef
--- /dev/null
+++ b/debian/patches/ubuntu-ignore-arm-doctest.patch
@@ -0,0 +1,38 @@
+Description: Disable the doctests for the instruction_set errors
+ The fix is as described in the upstream issue.
+Author: Simon Chopin <simon.chopin@canonical.com>
+Bug: https://github.com/rust-lang/rust/issues/83453
+Last-Update: 2022-02-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/compiler/rustc_error_codes/src/error_codes/E0778.md
++++ b/compiler/rustc_error_codes/src/error_codes/E0778.md
+@@ -16,7 +16,7 @@
+ ```
+ #![feature(isa_attribute)]
+
+-#[cfg_attr(target_arch="arm", instruction_set(arm::a32))]
++#[cfg_attr(all(target_arch="arm", target_os="none"), instruction_set(arm::a32))]
+ fn something() {}
+ ```
+
+@@ -25,7 +25,7 @@
+ ```
+ #![feature(isa_attribute)]
+
+-#[cfg_attr(target_arch="arm", instruction_set(arm::t32))]
++#[cfg_attr(all(target_arch="arm", target_os="none"), instruction_set(arm::t32))]
+ fn something() {}
+ ```
+
+--- a/compiler/rustc_error_codes/src/error_codes/E0779.md
++++ b/compiler/rustc_error_codes/src/error_codes/E0779.md
+@@ -21,7 +21,7 @@
+ ```
+ #![feature(isa_attribute)]
+
+-#[cfg_attr(target_arch="arm", instruction_set(arm::a32))] // ok!
++#[cfg_attr(all(target_arch="arm", target_os="none"), instruction_set(arm::a32))] // ok!
+ pub fn something() {}
+ fn main() {}
+ ```