diff options
author | Alex Kiernan <alex.kiernan@gmail.com> | 2023-01-07 09:48:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-12 23:08:58 +0000 |
commit | cc9244ca70957cf1ed11ee987fc6496e3ea92567 (patch) | |
tree | 51b3b2d65a40431cf37d63cd9a63b367a38baa2a /meta/recipes-devtools/rust/files/hardcodepaths.patch | |
parent | d2410b591f3feb5264747b25ef0793516161d087 (diff) | |
download | poky-cc9244ca70957cf1ed11ee987fc6496e3ea92567.tar.gz |
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 <alex.kiernan@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust/files/hardcodepaths.patch')
-rw-r--r-- | meta/recipes-devtools/rust/files/hardcodepaths.patch | 70 |
1 files changed, 70 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..178f354cf8 --- /dev/null +++ b/meta/recipes-devtools/rust/files/hardcodepaths.patch | |||
@@ -0,0 +1,70 @@ | |||
1 | When building for the target, some build paths end up embedded in the binaries. | ||
2 | These changes remove that. Further investigation is needed to work out the way | ||
3 | to resolve these issues properly upstream. | ||
4 | |||
5 | Upstream-Status: Inappropriate [patches need rework] | ||
6 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
7 | |||
8 | Index: rustc-1.66.0-src/src/tools/clippy/src/driver.rs | ||
9 | =================================================================== | ||
10 | --- rustc-1.66.0-src.orig/src/tools/clippy/src/driver.rs | ||
11 | +++ rustc-1.66.0-src/src/tools/clippy/src/driver.rs | ||
12 | @@ -259,7 +259,6 @@ pub fn main() { | ||
13 | .and_then(|out| String::from_utf8(out.stdout).ok()) | ||
14 | .map(|s| PathBuf::from(s.trim())) | ||
15 | }) | ||
16 | - .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) | ||
17 | .or_else(|| { | ||
18 | let home = option_env!("RUSTUP_HOME") | ||
19 | .or(option_env!("MULTIRUST_HOME")) | ||
20 | Index: rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs | ||
21 | =================================================================== | ||
22 | --- rustc-1.66.0-src.orig/compiler/rustc_codegen_llvm/src/context.rs | ||
23 | +++ rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs | ||
24 | @@ -160,46 +160,6 @@ pub unsafe fn create_module<'ll>( | ||
25 | } | ||
26 | } | ||
27 | |||
28 | - // Ensure the data-layout values hardcoded remain the defaults. | ||
29 | - if sess.target.is_builtin { | ||
30 | - let tm = crate::back::write::create_informational_target_machine(tcx.sess); | ||
31 | - llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); | ||
32 | - llvm::LLVMRustDisposeTargetMachine(tm); | ||
33 | - | ||
34 | - let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod); | ||
35 | - let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes()) | ||
36 | - .expect("got a non-UTF8 data-layout from LLVM"); | ||
37 | - | ||
38 | - // Unfortunately LLVM target specs change over time, and right now we | ||
39 | - // don't have proper support to work with any more than one | ||
40 | - // `data_layout` than the one that is in the rust-lang/rust repo. If | ||
41 | - // this compiler is configured against a custom LLVM, we may have a | ||
42 | - // differing data layout, even though we should update our own to use | ||
43 | - // that one. | ||
44 | - // | ||
45 | - // As an interim hack, if CFG_LLVM_ROOT is not an empty string then we | ||
46 | - // disable this check entirely as we may be configured with something | ||
47 | - // that has a different target layout. | ||
48 | - // | ||
49 | - // Unsure if this will actually cause breakage when rustc is configured | ||
50 | - // as such. | ||
51 | - // | ||
52 | - // FIXME(#34960) | ||
53 | - let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or(""); | ||
54 | - let custom_llvm_used = cfg_llvm_root.trim() != ""; | ||
55 | - | ||
56 | - if !custom_llvm_used && target_data_layout != llvm_data_layout { | ||
57 | - bug!( | ||
58 | - "data-layout for target `{rustc_target}`, `{rustc_layout}`, \ | ||
59 | - differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`", | ||
60 | - rustc_target = sess.opts.target_triple, | ||
61 | - rustc_layout = target_data_layout, | ||
62 | - llvm_target = sess.target.llvm_target, | ||
63 | - llvm_layout = llvm_data_layout | ||
64 | - ); | ||
65 | - } | ||
66 | - } | ||
67 | - | ||
68 | let data_layout = SmallCStr::new(&target_data_layout); | ||
69 | llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr()); | ||
70 | |||