summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/files/hardcodepaths.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/rust/files/hardcodepaths.patch')
-rw-r--r--meta/recipes-devtools/rust/files/hardcodepaths.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/files/hardcodepaths.patch b/meta/recipes-devtools/rust/files/hardcodepaths.patch
new file mode 100644
index 0000000000..696654227e
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/hardcodepaths.patch
@@ -0,0 +1,46 @@
+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 <richard.purdie@linuxfoundation.org>
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+
+diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
+index b4b2ab1e1f8a..8bb3e3f0557c 100644
+--- a/compiler/rustc_codegen_llvm/src/context.rs
++++ b/compiler/rustc_codegen_llvm/src/context.rs
+@@ -34,7 +34,6 @@
+ use smallvec::SmallVec;
+
+ use libc::c_uint;
+-use std::borrow::Borrow;
+ use std::cell::{Cell, RefCell};
+ use std::ffi::CStr;
+ use std::str;
+@@ -155,25 +154,6 @@
+ }
+ }
+
+- // Ensure the data-layout values hardcoded remain the defaults.
+- {
+- let tm = crate::back::write::create_informational_target_machine(tcx.sess);
+- llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, &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");
+-
+- if target_data_layout != llvm_data_layout {
+- tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {
+- rustc_target: sess.opts.target_triple.to_string().as_str(),
+- rustc_layout: target_data_layout.as_str(),
+- llvm_target: sess.target.llvm_target.borrow(),
+- llvm_layout: llvm_data_layout,
+- });
+- }
+- }
+-
+ let data_layout = SmallCStr::new(&target_data_layout);
+ llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
+