diff options
Diffstat (limited to 'debian/patches')
18 files changed, 640 insertions, 321 deletions
diff --git a/debian/patches/d-0000-ignore-removed-submodules.patch b/debian/patches/d-0000-ignore-removed-submodules.patch index 2f1c323c3..588e53b3b 100644 --- a/debian/patches/d-0000-ignore-removed-submodules.patch +++ b/debian/patches/d-0000-ignore-removed-submodules.patch @@ -14,11 +14,11 @@ Subject: d-0000-ignore-removed-submodules src/tools/tidy/src/deps.rs | 4 +++- 9 files changed, 15 insertions(+), 62 deletions(-) -diff --git a/Cargo.toml b/Cargo.toml -index 15cbb26..c012319 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -18,29 +18,15 @@ members = [ +Index: rust/Cargo.toml +=================================================================== +--- rust.orig/Cargo.toml ++++ rust/Cargo.toml +@@ -18,28 +18,15 @@ members = [ "src/tools/tidy", "src/tools/tier-check", "src/tools/build-manifest", @@ -44,11 +44,10 @@ index 15cbb26..c012319 100644 "src/tools/jsondoclint", "src/tools/html-checker", - "src/tools/bump-stage0", -- "src/tools/replace-version-placeholder", + "src/tools/replace-version-placeholder", "src/tools/lld-wrapper", "src/tools/collect-license-metadata", - "src/tools/generate-copyright", -@@ -105,9 +91,6 @@ miniz_oxide.debug = 0 +@@ -106,9 +93,6 @@ miniz_oxide.debug = 0 object.debug = 0 [patch.crates-io] @@ -58,11 +57,11 @@ index 15cbb26..c012319 100644 # 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 013d1ab..f6fd37b 100644 ---- a/src/bootstrap/bootstrap.py -+++ b/src/bootstrap/bootstrap.py -@@ -777,10 +777,6 @@ class RustBuild(object): +Index: rust/src/bootstrap/bootstrap.py +=================================================================== +--- rust.orig/src/bootstrap/bootstrap.py ++++ rust/src/bootstrap/bootstrap.py +@@ -781,10 +781,6 @@ class RustBuild(object): args = [self.cargo(), "build", "--manifest-path", os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")] args.extend("--verbose" for _ in range(verbose_count)) @@ -73,23 +72,73 @@ index 013d1ab..f6fd37b 100644 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 b33fc02..4492577 100644 ---- a/src/bootstrap/builder.rs -+++ b/src/bootstrap/builder.rs -@@ -629,8 +629,6 @@ impl<'a> Builder<'a> { - tool::RemoteTestClient, +Index: rust/src/bootstrap/builder.rs +=================================================================== +--- rust.orig/src/bootstrap/builder.rs ++++ rust/src/bootstrap/builder.rs +@@ -491,20 +491,20 @@ impl<'a> ShouldRun<'a> { + static SUBMODULES_PATHS: OnceCell<Vec<String>> = OnceCell::new(); + + let init_submodules_paths = |src: &PathBuf| { +- let file = File::open(src.join(".gitmodules")).unwrap(); ++ //let file = File::open(src.join(".gitmodules")).unwrap(); + + let mut submodules_paths = vec![]; +- for line in BufReader::new(file).lines() { +- if let Ok(line) = line { +- let line = line.trim(); +- +- if line.starts_with("path") { +- let actual_path = +- line.split(' ').last().expect("Couldn't get value of path"); +- submodules_paths.push(actual_path.to_owned()); +- } +- } +- } ++ //for line in BufReader::new(file).lines() { ++ // if let Ok(line) = line { ++ // let line = line.trim(); ++ ++ // if line.starts_with("path") { ++ // let actual_path = ++ // line.split(' ').last().expect("Couldn't get value of path"); ++ // submodules_paths.push(actual_path.to_owned()); ++ // } ++ // } ++ //} + + submodules_paths + }; +@@ -658,24 +658,13 @@ impl<'a> Builder<'a> { + tool::Linkchecker, + tool::CargoTest, + tool::Compiletest, +- tool::RemoteTestServer, +- tool::RemoteTestClient, tool::RustInstaller, - tool::Cargo, +- tool::Cargo, - tool::Rls, - tool::RustAnalyzer, tool::RustAnalyzerProcMacroSrv, tool::RustDemangler, tool::Rustdoc, -@@ -651,10 +649,6 @@ impl<'a> Builder<'a> { + tool::Clippy, + tool::CargoClippy, +- llvm::Llvm, +- llvm::Sanitizers, + tool::Rustfmt, +- tool::Miri, +- tool::CargoMiri, +- llvm::Lld, +- llvm::CrtBeginEnd + ), + Kind::Check | Kind::Clippy | Kind::Fix => describe!( + check::Std, +@@ -683,11 +672,6 @@ impl<'a> Builder<'a> { + check::Rustdoc, check::CodegenBackend, check::Clippy, - check::Miri, +- check::Miri, - check::CargoMiri, - check::MiroptTestTools, - check::Rls, @@ -97,15 +146,24 @@ index b33fc02..4492577 100644 check::Rustfmt, check::Bootstrap ), -@@ -684,7 +678,6 @@ impl<'a> Builder<'a> { +@@ -717,8 +701,6 @@ impl<'a> Builder<'a> { + test::TierCheck, test::ReplacePlaceholderTest, test::Cargotest, - test::Cargo, +- test::Cargo, - test::RustAnalyzer, test::ErrorIndex, test::Distcheck, test::RunMakeFullDeps, -@@ -732,11 +725,8 @@ impl<'a> Builder<'a> { +@@ -734,7 +716,6 @@ impl<'a> Builder<'a> { + test::EmbeddedBook, + test::EditionGuide, + test::Rustfmt, +- test::Miri, + test::Clippy, + test::RustDemangler, + test::CompiletestTest, +@@ -767,11 +748,8 @@ impl<'a> Builder<'a> { doc::RustdocBook, doc::RustByExample, doc::RustcBook, @@ -117,24 +175,42 @@ index b33fc02..4492577 100644 doc::EmbeddedBook, doc::EditionGuide, doc::StyleGuide, -@@ -752,8 +742,6 @@ impl<'a> Builder<'a> { +@@ -787,13 +765,9 @@ impl<'a> Builder<'a> { + dist::RustcDev, dist::Analysis, dist::Src, - dist::Cargo, +- dist::Cargo, - dist::Rls, - dist::RustAnalyzer, dist::Rustfmt, dist::RustDemangler, dist::Clippy, -@@ -774,7 +762,6 @@ impl<'a> Builder<'a> { +- dist::Miri, + dist::LlvmTools, + dist::RustDev, + dist::Bootstrap, +@@ -809,12 +783,9 @@ impl<'a> Builder<'a> { + Kind::Install => describe!( install::Docs, install::Std, - install::Cargo, +- install::Cargo, - install::RustAnalyzer, install::Rustfmt, install::RustDemangler, install::Clippy, -@@ -1878,10 +1865,7 @@ impl<'a> Builder<'a> { +- install::Miri, + install::LlvmTools, + install::Src, + install::Rustc +@@ -824,7 +795,6 @@ impl<'a> Builder<'a> { + run::BuildManifest, + run::BumpStage0, + run::ReplaceVersionPlaceholder, +- run::Miri, + run::CollectLicenseMetadata, + run::GenerateCopyright, + ), +@@ -1949,10 +1919,7 @@ impl<'a> Builder<'a> { } } @@ -146,10 +222,10 @@ index b33fc02..4492577 100644 cargo.arg("--frozen"); } -diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs -index cc80763..19754a2 100644 ---- a/src/bootstrap/doc.rs -+++ b/src/bootstrap/doc.rs +Index: rust/src/bootstrap/doc.rs +=================================================================== +--- rust.orig/src/bootstrap/doc.rs ++++ rust/src/bootstrap/doc.rs @@ -76,7 +76,6 @@ macro_rules! book { // FIXME: Make checking for a submodule automatic somehow (maybe by having a list of all submodules // and checking against it?). @@ -158,11 +234,11 @@ index cc80763..19754a2 100644 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 b4f1506..27236f3 100644 ---- a/src/bootstrap/test.rs -+++ b/src/bootstrap/test.rs -@@ -2024,17 +2024,7 @@ impl Step for RustcGuide { +Index: rust/src/bootstrap/test.rs +=================================================================== +--- rust.orig/src/bootstrap/test.rs ++++ rust/src/bootstrap/test.rs +@@ -2070,17 +2070,7 @@ impl Step for RustcGuide { } fn run(self, builder: &Builder<'_>) { @@ -181,10 +257,10 @@ index b4f1506..27236f3 100644 } } -diff --git a/src/tools/clippy/Cargo.toml b/src/tools/clippy/Cargo.toml -index 70d1268..c7c6c3e 100644 ---- a/src/tools/clippy/Cargo.toml -+++ b/src/tools/clippy/Cargo.toml +Index: rust/src/tools/clippy/Cargo.toml +=================================================================== +--- rust.orig/src/tools/clippy/Cargo.toml ++++ rust/src/tools/clippy/Cargo.toml @@ -36,11 +36,6 @@ walkdir = "2.3" # This is used by the `collect-metadata` alias. filetime = "0.2" @@ -197,10 +273,10 @@ index 70d1268..c7c6c3e 100644 # UI test dependencies clap = { version = "4.1.4", features = ["derive"] } clippy_utils = { path = "clippy_utils" } -diff --git a/src/tools/rust-analyzer/Cargo.toml b/src/tools/rust-analyzer/Cargo.toml -index 333f03c..2a0faa2 100644 ---- a/src/tools/rust-analyzer/Cargo.toml -+++ b/src/tools/rust-analyzer/Cargo.toml +Index: rust/src/tools/rust-analyzer/Cargo.toml +=================================================================== +--- rust.orig/src/tools/rust-analyzer/Cargo.toml ++++ rust/src/tools/rust-analyzer/Cargo.toml @@ -1,5 +1,14 @@ [workspace] -members = ["xtask/", "lib/*", "crates/*"] @@ -217,10 +293,10 @@ index 333f03c..2a0faa2 100644 exclude = ["crates/proc-macro-test/imp"] [workspace.package] -diff --git a/src/tools/rustfmt/Cargo.toml b/src/tools/rustfmt/Cargo.toml -index 87ce59d..12ed654 100644 ---- a/src/tools/rustfmt/Cargo.toml -+++ b/src/tools/rustfmt/Cargo.toml +Index: rust/src/tools/rustfmt/Cargo.toml +=================================================================== +--- rust.orig/src/tools/rustfmt/Cargo.toml ++++ rust/src/tools/rustfmt/Cargo.toml @@ -59,11 +59,6 @@ unicode_categories = "0.1" rustfmt-config_proc_macro = { version = "0.3", path = "config_proc_macro" } @@ -233,11 +309,11 @@ index 87ce59d..12ed654 100644 # 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 bddfdcf..9bac4b7 100644 ---- a/src/tools/tidy/src/deps.rs -+++ b/src/tools/tidy/src/deps.rs -@@ -333,7 +333,7 @@ const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[ +Index: rust/src/tools/tidy/src/deps.rs +=================================================================== +--- rust.orig/src/tools/tidy/src/deps.rs ++++ rust/src/tools/tidy/src/deps.rs +@@ -337,7 +337,7 @@ const FORBIDDEN_TO_HAVE_DUPLICATES: &[&s // This crate takes 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. @@ -246,7 +322,7 @@ index bddfdcf..9bac4b7 100644 ]; /// Dependency checks. -@@ -609,6 +609,8 @@ fn direct_deps_of<'a>(metadata: &'a Metadata, pkg_id: &'a PackageId) -> Vec<&'a +@@ -613,6 +613,8 @@ fn direct_deps_of<'a>(metadata: &'a Meta } fn check_rustfix(metadata: &Metadata, bad: &mut bool) { diff --git a/debian/patches/d-0002-mdbook-strip-embedded-libs.patch b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch index cd17dc2e6..81a0e2792 100644 --- a/debian/patches/d-0002-mdbook-strip-embedded-libs.patch +++ b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch @@ -4,14 +4,14 @@ 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 | 97 +--------------------- - vendor/mdbook/src/theme/mod.rs | 27 ------ - vendor/mdbook/src/theme/searcher/mod.rs | 2 - - 7 files changed, 37 insertions(+), 205 deletions(-) + src/tools/linkchecker/main.rs | 28 +++++- + vendor/mdbook/src/book/init.rs | 19 ---- + .../src/renderer/html_handlebars/hbs_renderer.rs | 110 ++++----------------- + .../mdbook/src/renderer/html_handlebars/search.rs | 2 - + vendor/mdbook/src/theme/index.hbs | 99 +------------------ + vendor/mdbook/src/theme/mod.rs | 27 ----- + vendor/mdbook/src/theme/searcher/mod.rs | 2 - + 7 files changed, 47 insertions(+), 240 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 4170c32..d7dcda7 100644 @@ -67,10 +67,10 @@ index 4170c32..d7dcda7 100644 report.links_ignored_exception += 1; } else { diff --git a/vendor/mdbook/src/book/init.rs b/vendor/mdbook/src/book/init.rs -index dd3fa8b..a088517 100644 +index ebcdd93..41dab42 100644 --- a/vendor/mdbook/src/book/init.rs +++ b/vendor/mdbook/src/book/init.rs -@@ -152,12 +152,6 @@ impl BookBuilder { +@@ -153,25 +153,6 @@ impl BookBuilder { let mut js = File::create(themedir.join("book.js"))?; js.write_all(theme::JS)?; @@ -80,14 +80,27 @@ index dd3fa8b..a088517 100644 - let mut highlight_js = File::create(themedir.join("highlight.js"))?; - highlight_js.write_all(theme::HIGHLIGHT_JS)?; - +- write_file(&themedir.join("fonts"), "fonts.css", theme::fonts::CSS)?; +- for (file_name, contents) in theme::fonts::LICENSES { +- write_file(&themedir, file_name, contents)?; +- } +- for (file_name, contents) in theme::fonts::OPEN_SANS.iter() { +- write_file(&themedir, file_name, contents)?; +- } +- write_file( +- &themedir, +- theme::fonts::SOURCE_CODE_PRO.0, +- theme::fonts::SOURCE_CODE_PRO.1, +- )?; +- Ok(()) } diff --git a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs -index 1b648da..5fe813c 100644 +index e170e2f..caa2eff 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}; +@@ -3,13 +3,14 @@ use crate::config::{BookConfig, Config, HtmlConfig, Playground, RustEdition}; use crate::errors::*; use crate::renderer::html_handlebars::helpers; use crate::renderer::{RenderContext, Renderer}; @@ -96,15 +109,14 @@ index 1b648da..5fe813c 100644 use crate::utils; use std::borrow::Cow; -@@ -11,6 +11,7 @@ use std::collections::BTreeMap; + 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 std::path::{Path, PathBuf}; use crate::utils::fs::get_404_output_file; - use handlebars::Handlebars; -@@ -235,80 +236,13 @@ impl HtmlHandlebars { +@@ -235,105 +236,28 @@ impl HtmlHandlebars { if let Some(contents) = &theme.favicon_svg { write_file(destination, "favicon.svg", contents)?; } @@ -127,27 +139,42 @@ index 1b648da..5fe813c 100644 - destination, - "FontAwesome/fonts/fontawesome-webfont.svg", - theme::FONT_AWESOME_SVG, -- )?; ++ symlink( ++ "/usr/share/fonts-font-awesome/css/font-awesome.min.css", ++ destination.join("css/font-awesome.min.css"), + )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.ttf", - theme::FONT_AWESOME_TTF, -- )?; ++ symlink( ++ "/usr/share/fonts-font-awesome/fonts", ++ destination.join("fonts"), + )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.woff", - theme::FONT_AWESOME_WOFF, -- )?; ++ symlink( ++ "/usr/share/javascript/highlight.js/styles/atelier-dune-light.css", ++ destination.join("highlight.css"), + )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.woff2", - theme::FONT_AWESOME_WOFF2, -- )?; ++ symlink( ++ "/usr/share/javascript/highlight.js/highlight.js", ++ destination.join("highlight.js"), + )?; - write_file( - destination, - "FontAwesome/fonts/FontAwesome.ttf", - theme::FONT_AWESOME_TTF, -- )?; ++ symlink( ++ "/usr/share/javascript/mathjax/MathJax.js", ++ destination.join("MathJax.js"), + )?; - if html_config.copy_fonts { - write_file(destination, "fonts/fonts.css", theme::fonts::CSS)?; - for (file_name, contents) in theme::fonts::LICENSES.iter() { @@ -162,6 +189,31 @@ index 1b648da..5fe813c 100644 - theme::fonts::SOURCE_CODE_PRO.1, - )?; - } +- if let Some(fonts_css) = &theme.fonts_css { +- if !fonts_css.is_empty() { +- if html_config.copy_fonts { +- warn!( +- "output.html.copy_fonts is deprecated.\n\ +- Set copy_fonts=false and ensure the fonts you want are in \ +- the `theme/fonts/` directory." +- ); +- } +- write_file(destination, "fonts/fonts.css", &fonts_css)?; +- } +- } +- if !html_config.copy_fonts && theme.fonts_css.is_none() { +- warn!( +- "output.html.copy_fonts is deprecated.\n\ +- This book appears to have copy_fonts=false without a fonts.css file.\n\ +- Add an empty `theme/fonts/fonts.css` file to squelch this warning." +- ); +- } +- for font_file in &theme.font_files { +- let contents = fs::read(font_file)?; +- let filename = font_file.file_name().unwrap(); +- let filename = Path::new("fonts").join(filename); +- write_file(destination, filename, &contents)?; +- } - - let playground_config = &html_config.playground; - @@ -182,11 +234,6 @@ index 1b648da..5fe813c 100644 - 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(()) } @@ -204,7 +251,7 @@ index a9e2f5c..3e3f69c 100644 } diff --git a/vendor/mdbook/src/theme/index.hbs b/vendor/mdbook/src/theme/index.hbs -index 147eb9a..27d358b 100644 +index 6f3948c..7e5c54c 100644 --- a/vendor/mdbook/src/theme/index.hbs +++ b/vendor/mdbook/src/theme/index.hbs @@ -33,10 +33,7 @@ @@ -228,7 +275,7 @@ index 147eb9a..27d358b 100644 {{/if}} </head> <body> -@@ -60,46 +57,6 @@ +@@ -61,48 +58,6 @@ var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}"; </script> @@ -263,10 +310,12 @@ index 147eb9a..27d358b 100644 - <!-- Hide / unhide sidebar before it is displayed --> - <script> - var html = document.querySelector('html'); -- var sidebar = 'hidden'; +- var sidebar = null; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; +- } else { +- sidebar = 'hidden'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); @@ -275,7 +324,7 @@ index 147eb9a..27d358b 100644 <nav id="sidebar" class="sidebar" aria-label="Table of contents"> <div class="sidebar-scrollbox"> {{#toc}}{{/toc}} -@@ -237,54 +194,8 @@ +@@ -240,54 +195,8 @@ </script> {{/if}} @@ -333,7 +382,7 @@ index 147eb9a..27d358b 100644 <!-- Custom JS scripts --> {{#each additional_js}} diff --git a/vendor/mdbook/src/theme/mod.rs b/vendor/mdbook/src/theme/mod.rs -index 7af5e2b..3086fcf 100644 +index 6e6b509..ef8886b 100644 --- a/vendor/mdbook/src/theme/mod.rs +++ b/vendor/mdbook/src/theme/mod.rs @@ -1,9 +1,5 @@ @@ -366,7 +415,7 @@ index 7af5e2b..3086fcf 100644 /// 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 { +@@ -59,11 +44,8 @@ pub struct Theme { pub favicon_png: Option<Vec<u8>>, pub favicon_svg: Option<Vec<u8>>, pub js: Vec<u8>, @@ -378,7 +427,7 @@ index 7af5e2b..3086fcf 100644 } impl Theme { -@@ -91,9 +73,6 @@ impl Theme { +@@ -93,9 +75,6 @@ impl Theme { theme_dir.join("css/variables.css"), &mut theme.variables_css, ), @@ -388,7 +437,7 @@ index 7af5e2b..3086fcf 100644 ( theme_dir.join("tomorrow-night.css"), &mut theme.tomorrow_night_css, -@@ -156,11 +135,8 @@ impl Default for Theme { +@@ -183,11 +162,8 @@ impl Default for Theme { favicon_png: Some(FAVICON_PNG.to_owned()), favicon_svg: Some(FAVICON_SVG.to_owned()), js: JS.to_owned(), @@ -400,7 +449,7 @@ index 7af5e2b..3086fcf 100644 } } } -@@ -243,11 +219,8 @@ mod tests { +@@ -273,11 +249,8 @@ mod tests { favicon_png: Some(Vec::new()), favicon_svg: Some(Vec::new()), js: Vec::new(), diff --git a/debian/patches/d-0004-clippy-feature-sync.patch b/debian/patches/d-0004-clippy-feature-sync.patch index 23667ffde..f4a863a8e 100644 --- a/debian/patches/d-0004-clippy-feature-sync.patch +++ b/debian/patches/d-0004-clippy-feature-sync.patch @@ -10,7 +10,7 @@ this is what rustc_workspace_hack does in the upstream build. 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/clippy/Cargo.toml b/src/tools/clippy/Cargo.toml -index c7c6c3e..7e453c7 100644 +index a24d2f4..3681c85 100644 --- a/src/tools/clippy/Cargo.toml +++ b/src/tools/clippy/Cargo.toml @@ -44,7 +44,7 @@ if_chain = "1.0" diff --git a/debian/patches/d-bootstrap-disable-git.patch b/debian/patches/d-bootstrap-disable-git.patch index 3e744b599..6f7f3f2e4 100644 --- a/debian/patches/d-bootstrap-disable-git.patch +++ b/debian/patches/d-bootstrap-disable-git.patch @@ -15,7 +15,7 @@ Forwarded: not-needed @@ -36,6 +36,12 @@ impl GitInfo { - pub fn new(ignore_git: bool, dir: &Path) -> GitInfo { + pub fn new(omit_git_hash: bool, dir: &Path) -> GitInfo { + // + // Debian: returning early because the Debian package is also in a git + // repository, but we don't want to parse gitinfo. This is @@ -27,7 +27,7 @@ Forwarded: not-needed match read_commit_info_file(dir) { --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs -@@ -968,7 +968,10 @@ +@@ -995,7 +995,10 @@ } // If we're building from git sources, we need to vendor a complete distribution. diff --git a/debian/patches/d-bootstrap-old-cargo-compat.patch b/debian/patches/d-bootstrap-old-cargo-compat.patch index 463e70369..a077e0c8f 100644 --- a/debian/patches/d-bootstrap-old-cargo-compat.patch +++ b/debian/patches/d-bootstrap-old-cargo-compat.patch @@ -17,7 +17,7 @@ Subject: Backwards-compat for cargo 0.47 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs -@@ -598,7 +598,6 @@ +@@ -612,7 +612,6 @@ .arg(&*target_dir.to_string_lossy()) .arg("-p") .arg(package) @@ -25,15 +25,15 @@ Subject: Backwards-compat for cargo 0.47 .arg("--") .arg("-Z") .arg("unstable-options") -@@ -695,7 +694,6 @@ +@@ -712,7 +711,6 @@ cargo.rustdocflag("--generate-link-to-definition"); - compile::rustc_cargo(builder, &mut cargo, target); + compile::rustc_cargo(builder, &mut cargo, target, compiler.stage); 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`. -@@ -811,7 +809,6 @@ +@@ -845,7 +843,6 @@ &[], ); diff --git a/debian/patches/d-disable-download-tests.patch b/debian/patches/d-disable-download-tests.patch new file mode 100644 index 000000000..41531a87f --- /dev/null +++ b/debian/patches/d-disable-download-tests.patch @@ -0,0 +1,26 @@ +Index: rust/src/bootstrap/config/tests.rs +=================================================================== +--- rust.orig/src/bootstrap/config/tests.rs ++++ rust/src/bootstrap/config/tests.rs +@@ -11,6 +11,9 @@ fn parse(config: &str) -> Config { + + #[test] + fn download_ci_llvm() { ++ // Debian: this will attempt to download LLVM ++ return; ++ + if crate::llvm::is_ci_llvm_modified(&parse("")) { + eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change"); + return; +@@ -39,7 +42,11 @@ fn download_ci_llvm() { + // - https://github.com/rust-lang/rust/pull/109162#issuecomment-1496782487 + #[test] + fn detect_src_and_out() { ++ // Debian: this will attempt to download a toolchain ++ return; ++ + fn test(cfg: Config, build_dir: Option<&str>) { ++ + // This will bring absolute form of `src/bootstrap` path + let current_dir = std::env::current_dir().unwrap(); + diff --git a/debian/patches/d-fix-rustix-outline.patch b/debian/patches/d-fix-rustix-outline.patch index 91b8530de..f141bad58 100644 --- a/debian/patches/d-fix-rustix-outline.patch +++ b/debian/patches/d-fix-rustix-outline.patch @@ -5,9 +5,9 @@ outline asm. --- a/vendor/rustix/Cargo.toml +++ b/vendor/rustix/Cargo.toml -@@ -115,9 +115,9 @@ +@@ -125,9 +125,9 @@ [dev-dependencies.tempfile] - version = "3.2.0" + version = "3.4.0" -[build-dependencies.cc] +[build-dependencies.cc_dep] @@ -17,7 +17,7 @@ outline asm. [features] all-apis = [ -@@ -230,6 +230,7 @@ +@@ -242,6 +242,7 @@ "Win32_NetworkManagement_IpHelper", "Win32_System_Threading", ] @@ -34,6 +34,57 @@ outline asm. use std::env::var; use std::io::Write; +@@ -158,16 +157,16 @@ + 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(); + // Add `-gdwarf-3` so that we always get the same output, regardless of +--- a/vendor/rustix-0.36.5/Cargo.toml ++++ b/vendor/rustix-0.36.5/Cargo.toml +@@ -116,9 +116,9 @@ + [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 = [ +@@ -231,6 +231,7 @@ + "Win32_NetworkManagement_IpHelper", + "Win32_System_Threading", + ] ++cc = [] + + [target."cfg(windows)".dev-dependencies.ctor] + version = "0.1.21" +--- a/vendor/rustix-0.36.5/build.rs ++++ b/vendor/rustix-0.36.5/build.rs +@@ -1,5 +1,4 @@ +-#[cfg(feature = "cc")] +-use cc::Build; ++use cc_dep::Build; + use std::env::var; + use std::io::Write; + @@ -118,16 +117,16 @@ println!("cargo:rerun-if-changed={}", to); diff --git a/debian/patches/d-rust-gdb-paths b/debian/patches/d-rust-gdb-paths index 4be3024ea..119365af3 100644 --- a/debian/patches/d-rust-gdb-paths +++ b/debian/patches/d-rust-gdb-paths @@ -13,19 +13,6 @@ just hardcode path in wrapper script. 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 @@ -35,5 +22,5 @@ index 9744913..613737d 100755 -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 + # Get the commit hash for path remapping + RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')" diff --git a/debian/patches/d-rust-lldb-paths b/debian/patches/d-rust-lldb-paths index bea7a3844..41f3b87b4 100644 --- a/debian/patches/d-rust-lldb-paths +++ b/debian/patches/d-rust-lldb-paths @@ -23,7 +23,7 @@ index bce72f1..793f593 100755 RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" -lldb=lldb -+lldb=lldb-15 ++lldb=lldb-16 if [ -f "$RUST_LLDB" ]; then lldb="$RUST_LLDB" else diff --git a/debian/patches/d-rustc-i686-baseline.patch b/debian/patches/d-rustc-i686-baseline.patch index b856d9391..bc1e55d91 100644 --- a/debian/patches/d-rustc-i686-baseline.patch +++ b/debian/patches/d-rustc-i686-baseline.patch @@ -7,9 +7,11 @@ Subject: d-rustc-i686-baseline compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---- a/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs -+++ b/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs -@@ -2,7 +2,7 @@ +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::{Cc, LinkerFlavor, Lld, pub fn target() -> Target { let mut base = super::linux_gnu_base::opts(); @@ -18,3 +20,30 @@ Subject: d-rustc-i686-baseline base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); +Index: rust/tests/ui/sse2.rs +=================================================================== +--- rust.orig/tests/ui/sse2.rs ++++ rust/tests/ui/sse2.rs +@@ -15,7 +15,7 @@ fn main() { + } + Err(_) => return, + } +- if cfg!(any(target_arch = "x86", target_arch = "x86_64")) { ++ if cfg!(any(target_arch = "x86_64")) { + assert!(cfg!(target_feature = "sse2"), + "SSE2 was not detected as available on an x86 platform"); + } +Index: rust/tests/ui/abi/homogenous-floats-target-feature-mixup.rs +=================================================================== +--- rust.orig/tests/ui/abi/homogenous-floats-target-feature-mixup.rs ++++ rust/tests/ui/abi/homogenous-floats-target-feature-mixup.rs +@@ -24,7 +24,8 @@ fn main() { + match std::env::var("TARGET") { + Ok(s) => { + // Skip this tests on i586-unknown-linux-gnu where sse2 is disabled +- if s.contains("i586") { ++ // Debian: our i686 doesn't have SSE 2.. ++ if s.contains("i586") || s.contains("i686") { + return + } + } diff --git a/debian/patches/series b/debian/patches/series index c848c82e1..855cac4b6 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,24 +1,22 @@ # Patches for upstream # pending, or forwarded -u-ignore-reproducible-failure.patch u-reproducible-build.patch u-ignore-endian-big-diff.patch u-fix-get-toml-when-test.patch -u-fix-sysroot-detection-logic.patch - -# can be dropped once upstream updates rustix -u-fix-rustix-for-sparc64.patch +u-disable-fp-precision-test-on-i386.patch +u-riscv-disable-unpacked-split-debuginfo.patch +u-profiler.patch # not forwarded, or forwarded but unlikely to be merged u-ignore-ppc-hangs.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 +d-disable-download-tests.patch ## Patches needed by debian/prune-unused-deps, for building bootstrap d-0000-ignore-removed-submodules.patch diff --git a/debian/patches/u-disable-fp-precision-test-on-i386.patch b/debian/patches/u-disable-fp-precision-test-on-i386.patch new file mode 100644 index 000000000..cb6144650 --- /dev/null +++ b/debian/patches/u-disable-fp-precision-test-on-i386.patch @@ -0,0 +1,26 @@ +From: liushuyu <liushuyu011@gmail.com> +Date: Tue, 25 Jul 2023 09:48:12 +0800 +Subject: [PATCH] core library: Disable fpmath tests for i386 ... + +This patch disables the floating-point epsilon test for i386 since +x87 registers are too imprecise and can't produce the expected +results. + +Forwarded: https://github.com/rust-lang/rust/pull/114042 +--- + library/core/src/num/f32.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs +index d050d21c8c57..f5c2d1c6bf68 100644 +--- a/library/core/src/num/f32.rs ++++ b/library/core/src/num/f32.rs +@@ -800,7 +800,7 @@ impl f32 { + /// let angle = std::f32::consts::PI; + /// + /// let abs_difference = (angle.to_degrees() - 180.0).abs(); +- /// ++ /// # #[cfg(not(target_arch = "x86"))] + /// assert!(abs_difference <= f32::EPSILON); + /// ``` + #[must_use = "this returns the result of the operation, \ diff --git a/debian/patches/u-fix-rustix-for-sparc64.patch b/debian/patches/u-fix-rustix-for-sparc64.patch deleted file mode 100644 index d0c636e3b..000000000 --- a/debian/patches/u-fix-rustix-for-sparc64.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- a/vendor/rustix/src/termios/constants.rs -+++ b/vendor/rustix/src/termios/constants.rs -@@ -33,6 +33,8 @@ - )))] - pub use backend::termios::types::B1500000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -96,6 +98,8 @@ - )))] - pub use backend::termios::types::B4000000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "haiku", - target_os = "ios", -@@ -104,6 +108,8 @@ - )))] - pub use backend::termios::types::B460800; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -116,6 +122,8 @@ - )))] - pub use backend::termios::types::B500000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -732,6 +740,8 @@ - )))] - backend::termios::types::B500000 => Some(500_000), - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -744,6 +754,8 @@ - )))] - backend::termios::types::B576000 => Some(576_000), - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "haiku", - target_os = "ios", -@@ -752,6 +764,8 @@ - )))] - backend::termios::types::B921600 => Some(921_600), - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", ---- a/vendor/rustix/src/termios/mod.rs -+++ b/vendor/rustix/src/termios/mod.rs -@@ -41,6 +41,8 @@ - )))] - pub use constants::B1500000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -104,6 +106,8 @@ - )))] - pub use constants::B4000000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "haiku", - target_os = "ios", -@@ -112,6 +116,8 @@ - )))] - pub use constants::B460800; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", -@@ -124,6 +130,8 @@ - )))] - pub use constants::B500000; - #[cfg(not(any( -+ target_arch = "sparc", -+ target_arch = "sparc64", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "haiku", diff --git a/debian/patches/u-fix-sysroot-detection-logic.patch b/debian/patches/u-fix-sysroot-detection-logic.patch deleted file mode 100644 index 64cc291f7..000000000 --- a/debian/patches/u-fix-sysroot-detection-logic.patch +++ /dev/null @@ -1,46 +0,0 @@ -Description: Fix sysroot detection which would result in /usr/lib/lib/rustlib - This patch is a mixture of two upstream fix attempts. The first from - https://github.com/rust-lang/rust/pull/108376 didn't actually solve the - problem in Debian's case. After reporting that in $Bug, a second attempt is - made at https://github.com/rust-lang/rust/pull/110281, which worked. -Bug: https://github.com/rust-lang/rust/issues/109994 ---- a/compiler/rustc_session/src/filesearch.rs -+++ b/compiler/rustc_session/src/filesearch.rs -@@ -179,7 +179,7 @@ - ))?; - - // if `dir` points target's dir, move up to the sysroot -- if dir.ends_with(crate::config::host_triple()) { -+ let mut sysroot_dir = if dir.ends_with(crate::config::host_triple()) { - dir.parent() // chop off `$target` - .and_then(|p| p.parent()) // chop off `rustlib` - .and_then(|p| { -@@ -194,13 +194,25 @@ - } - }) - .map(|s| s.to_owned()) -- .ok_or(format!( -+ .ok_or_else(|| format!( - "Could not move 3 levels upper using `parent()` on {}", - dir.display() -- )) -+ ))? - } else { -- Ok(dir.to_owned()) -+ dir.to_owned() -+ }; -+ -+ // On multiarch linux systems, there will be multiarch directory named -+ // with the architecture(e.g `x86_64-linux-gnu`) under the `lib` directory. -+ // Which cause us to mistakenly end up in the lib directory instead of the sysroot directory. -+ if sysroot_dir.ends_with("lib") { -+ sysroot_dir = -+ sysroot_dir.parent().map(|real_sysroot| real_sysroot.to_owned()).ok_or_else( -+ || format!("Could not move to parent path of {}", sysroot_dir.display()), -+ )? - } -+ -+ Ok(sysroot_dir) - } - - // Use env::args().next() to get the path of the executable without diff --git a/debian/patches/u-ignore-reproducible-failure.patch b/debian/patches/u-ignore-reproducible-failure.patch deleted file mode 100644 index 6ea14023d..000000000 --- a/debian/patches/u-ignore-reproducible-failure.patch +++ /dev/null @@ -1,22 +0,0 @@ -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/tests/run-make-fulldeps/reproducible-build-2/Makefile b/tests/run-make-fulldeps/reproducible-build-2/Makefile -index fd94516..957e1f4 100644 ---- a/tests/run-make-fulldeps/reproducible-build-2/Makefile -+++ b/tests/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 deleted file mode 100644 index edd2127a9..000000000 --- a/debian/patches/u-make-tests-work-without-rpath.patch +++ /dev/null @@ -1,23 +0,0 @@ -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/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile -index 1e267fb..ac46c24 100644 ---- a/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile -+++ b/tests/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-profiler.patch b/debian/patches/u-profiler.patch new file mode 100644 index 000000000..37f63af69 --- /dev/null +++ b/debian/patches/u-profiler.patch @@ -0,0 +1,131 @@ +From d0b58f40a0e669897fafb614299d2a989997eda7 Mon Sep 17 00:00:00 2001 +From: Josh Stone <jistone@redhat.com> +Date: Tue, 25 Jul 2023 13:11:50 -0700 +Subject: [PATCH] Allow using external builds of the compiler-rt profile lib + +This changes the bootstrap config `target.*.profiler` from a plain bool +to also allow a string, which will be used as a path to the pre-built +profiling runtime for that target. Then `profiler_builtins/build.rs` +reads that in a `LLVM_PROFILER_RT_LIB` environment variable. +--- + config.example.toml | 6 ++++-- + library/profiler_builtins/build.rs | 6 ++++++ + src/bootstrap/compile.rs | 4 ++++ + src/bootstrap/config.rs | 30 ++++++++++++++++++++++++------ + 4 files changed, 38 insertions(+), 8 deletions(-) + +--- a/config.example.toml ++++ b/config.example.toml +@@ -745,8 +745,10 @@ changelog-seen = 2 + # This option will override the same option under [build] section. + #sanitizers = build.sanitizers (bool) + +-# Build the profiler runtime for this target(required when compiling with options that depend +-# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`). ++# When true, build the profiler runtime for this target(required when compiling ++# with options that depend on this runtime, such as `-C profile-generate` or ++# `-C instrument-coverage`). This may also be given a path to an existing build ++# of the profiling runtime library from LLVM's compiler-rt. + # This option will override the same option under [build] section. + #profiler = build.profiler (bool) + +--- a/library/profiler_builtins/build.rs ++++ b/library/profiler_builtins/build.rs +@@ -6,6 +6,12 @@ use std::env; + use std::path::Path; + + fn main() { ++ println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB"); ++ if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") { ++ println!("cargo:rustc-link-lib=static:+verbatim={rt}"); ++ return; ++ } ++ + let target = env::var("TARGET").expect("TARGET was not set"); + let cfg = &mut cc::Build::new(); + +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -314,6 +314,10 @@ pub fn std_cargo(builder: &Builder<'_>, + cargo.env("MACOSX_DEPLOYMENT_TARGET", target); + } + ++ if let Some(path) = builder.config.profiler_path(target) { ++ cargo.env("LLVM_PROFILER_RT_LIB", path); ++ } ++ + // Determine if we're going to compile in optimized C intrinsics to + // the `compiler-builtins` crate. These intrinsics live in LLVM's + // `compiler-rt` repository, but our `src/llvm-project` submodule isn't +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -454,7 +454,7 @@ pub struct Target { + pub linker: Option<PathBuf>, + pub ndk: Option<PathBuf>, + pub sanitizers: Option<bool>, +- pub profiler: Option<bool>, ++ pub profiler: Option<StringOrBool>, + pub crt_static: Option<bool>, + pub musl_root: Option<PathBuf>, + pub musl_libdir: Option<PathBuf>, +@@ -715,9 +715,9 @@ define_config! { + } + } + +-#[derive(Debug, Deserialize)] ++#[derive(Clone, Debug, Deserialize)] + #[serde(untagged)] +-enum StringOrBool { ++pub enum StringOrBool { + String(String), + Bool(bool), + } +@@ -728,6 +728,12 @@ impl Default for StringOrBool { + } + } + ++impl StringOrBool { ++ fn is_string_or_true(&self) -> bool { ++ matches!(self, Self::String(_) | Self::Bool(true)) ++ } ++} ++ + define_config! { + /// TOML representation of how the Rust build is configured. + struct Rust { +@@ -799,7 +805,7 @@ define_config! { + llvm_libunwind: Option<String> = "llvm-libunwind", + android_ndk: Option<String> = "android-ndk", + sanitizers: Option<bool> = "sanitizers", +- profiler: Option<bool> = "profiler", ++ profiler: Option<StringOrBool> = "profiler", + crt_static: Option<bool> = "crt-static", + musl_root: Option<String> = "musl-root", + musl_libdir: Option<String> = "musl-libdir", +@@ -1616,12 +1622,24 @@ impl Config { + self.target_config.values().any(|t| t.sanitizers == Some(true)) || self.sanitizers + } + ++ pub fn profiler_path(&self, target: TargetSelection) -> Option<&str> { ++ match self.target_config.get(&target)?.profiler.as_ref()? { ++ StringOrBool::String(s) => Some(s), ++ StringOrBool::Bool(_) => None, ++ } ++ } ++ + pub fn profiler_enabled(&self, target: TargetSelection) -> bool { +- self.target_config.get(&target).map(|t| t.profiler).flatten().unwrap_or(self.profiler) ++ self.target_config ++ .get(&target) ++ .and_then(|t| t.profiler.as_ref()) ++ .map(StringOrBool::is_string_or_true) ++ .unwrap_or(self.profiler) + } + + pub fn any_profiler_enabled(&self) -> bool { +- self.target_config.values().any(|t| t.profiler == Some(true)) || self.profiler ++ self.target_config.values().any(|t| matches!(&t.profiler, Some(p) if p.is_string_or_true())) ++ || self.profiler + } + + pub fn llvm_enabled(&self) -> bool { diff --git a/debian/patches/u-riscv-disable-unpacked-split-debuginfo.patch b/debian/patches/u-riscv-disable-unpacked-split-debuginfo.patch new file mode 100644 index 000000000..429501b39 --- /dev/null +++ b/debian/patches/u-riscv-disable-unpacked-split-debuginfo.patch @@ -0,0 +1,140 @@ +Description: explicitly disable split unpacked debuginfo for now on riscv64, + it's broken and we don't want cargo to auto-enable it.. + https://github.com/llvm/llvm-project/issues/56642 + https://github.com/rust-lang/rust/issues/110224Z + +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs +index 8281bac10f..ad1fc624ad 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs +@@ -1,4 +1,5 @@ +-use crate::spec::{CodeModel, Target, TargetOptions}; ++use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -12,6 +13,7 @@ pub fn target() -> Target { + features: "+m,+a,+f,+d,+c".into(), + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..super::freebsd_base::opts() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs +index 0585ed76fe..69d11081ac 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs +@@ -1,4 +1,5 @@ +-use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions}; ++use crate::spec::{CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -13,6 +14,7 @@ pub fn target() -> Target { + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), + supported_sanitizers: SanitizerSet::SHADOWCALLSTACK, ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..super::fuchsia_base::opts() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs +index 90dccb2806..8114e024d1 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs +@@ -1,4 +1,5 @@ +-use crate::spec::{CodeModel, Target, TargetOptions}; ++use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -12,6 +13,7 @@ pub fn target() -> Target { + features: "+m,+a,+f,+d,+c".into(), + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..super::linux_gnu_base::opts() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs +index 1a56c78e68..67dbd2f740 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_musl.rs +@@ -1,4 +1,5 @@ +-use crate::spec::{CodeModel, Target, TargetOptions}; ++use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -12,6 +13,7 @@ pub fn target() -> Target { + features: "+m,+a,+f,+d,+c".into(), + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..super::linux_musl_base::opts() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs +index ab3c14e3fe..a47b63dc94 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs +@@ -1,5 +1,6 @@ + use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; +-use crate::spec::{RelocModel, Target, TargetOptions}; ++use crate::spec::{RelocModel, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + use super::SanitizerSet; + +@@ -23,6 +24,7 @@ pub fn target() -> Target { + emit_debug_gdb_scripts: false, + eh_frame_header: false, + supported_sanitizers: SanitizerSet::KERNELADDRESS, ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..Default::default() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_openbsd.rs +index ade9d77624..b04cea8850 100644 +--- a/compiler/rustc_target/src/spec/riscv64gc_unknown_openbsd.rs ++++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_openbsd.rs +@@ -1,4 +1,5 @@ +-use crate::spec::{CodeModel, Target, TargetOptions}; ++use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -12,6 +13,7 @@ pub fn target() -> Target { + features: "+m,+a,+f,+d,+c".into(), + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..super::openbsd_base::opts() + }, + } +diff --git a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs +index 0f1821c998..1bec356dcd 100644 +--- a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs ++++ b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs +@@ -1,5 +1,6 @@ + use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; +-use crate::spec::{RelocModel, SanitizerSet, Target, TargetOptions}; ++use crate::spec::{RelocModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions}; ++use std::borrow::Cow; + + pub fn target() -> Target { + Target { +@@ -20,6 +21,7 @@ pub fn target() -> Target { + emit_debug_gdb_scripts: false, + eh_frame_header: false, + supported_sanitizers: SanitizerSet::KERNELADDRESS, ++ supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..Default::default() + }, + } |