From cc9244ca70957cf1ed11ee987fc6496e3ea92567 Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Sat, 7 Jan 2023 09:48:39 +0000 Subject: rust: Merge all rustc-source patches into rust-source.inc With the dim-sum approach to patching we had the same patch applied in many places, but not all, so that there were no guarantees that we were actually building agaginst the same thing in all recipes. (From OE-Core rev: 550c273f38d8e6d2d431908023e213c6b018d7ed) Signed-off-by: Alex Kiernan Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- .../rust/files/hardcodepaths.patch | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 meta/recipes-devtools/rust/files/hardcodepaths.patch (limited to 'meta/recipes-devtools/rust/files/hardcodepaths.patch') diff --git a/meta/recipes-devtools/rust/files/hardcodepaths.patch b/meta/recipes-devtools/rust/files/hardcodepaths.patch new file mode 100644 index 0000000000..178f354cf8 --- /dev/null +++ b/meta/recipes-devtools/rust/files/hardcodepaths.patch @@ -0,0 +1,70 @@ +When building for the target, some build paths end up embedded in the binaries. +These changes remove that. Further investigation is needed to work out the way +to resolve these issues properly upstream. + +Upstream-Status: Inappropriate [patches need rework] +Signed-off-by: Richard Purdie + +Index: rustc-1.66.0-src/src/tools/clippy/src/driver.rs +=================================================================== +--- rustc-1.66.0-src.orig/src/tools/clippy/src/driver.rs ++++ rustc-1.66.0-src/src/tools/clippy/src/driver.rs +@@ -259,7 +259,6 @@ pub fn main() { + .and_then(|out| String::from_utf8(out.stdout).ok()) + .map(|s| PathBuf::from(s.trim())) + }) +- .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) + .or_else(|| { + let home = option_env!("RUSTUP_HOME") + .or(option_env!("MULTIRUST_HOME")) +Index: rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs +=================================================================== +--- rustc-1.66.0-src.orig/compiler/rustc_codegen_llvm/src/context.rs ++++ rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs +@@ -160,46 +160,6 @@ pub unsafe fn create_module<'ll>( + } + } + +- // Ensure the data-layout values hardcoded remain the defaults. +- if sess.target.is_builtin { +- let tm = crate::back::write::create_informational_target_machine(tcx.sess); +- llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); +- llvm::LLVMRustDisposeTargetMachine(tm); +- +- let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod); +- let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes()) +- .expect("got a non-UTF8 data-layout from LLVM"); +- +- // Unfortunately LLVM target specs change over time, and right now we +- // don't have proper support to work with any more than one +- // `data_layout` than the one that is in the rust-lang/rust repo. If +- // this compiler is configured against a custom LLVM, we may have a +- // differing data layout, even though we should update our own to use +- // that one. +- // +- // As an interim hack, if CFG_LLVM_ROOT is not an empty string then we +- // disable this check entirely as we may be configured with something +- // that has a different target layout. +- // +- // Unsure if this will actually cause breakage when rustc is configured +- // as such. +- // +- // FIXME(#34960) +- let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or(""); +- let custom_llvm_used = cfg_llvm_root.trim() != ""; +- +- if !custom_llvm_used && target_data_layout != llvm_data_layout { +- bug!( +- "data-layout for target `{rustc_target}`, `{rustc_layout}`, \ +- differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`", +- rustc_target = sess.opts.target_triple, +- rustc_layout = target_data_layout, +- llvm_target = sess.target.llvm_target, +- llvm_layout = llvm_data_layout +- ); +- } +- } +- + let data_layout = SmallCStr::new(&target_data_layout); + llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr()); + -- cgit v1.2.3-54-g00ecf