summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/files/custom-target-cfg.patch
diff options
context:
space:
mode:
authorYash Shinde <Yash.Shinde@windriver.com>2024-08-08 03:00:34 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-09 22:33:38 +0100
commitbe70d81a3cc2775c38270653570e9089f0a68701 (patch)
tree6a4126dd08aaabcd8aba8dc452f0d4b7695e8d27 /meta/recipes-devtools/rust/files/custom-target-cfg.patch
parentab1bd4a04bc7d392d3910cb9adf2f950508dd684 (diff)
downloadpoky-be70d81a3cc2775c38270653570e9089f0a68701.tar.gz
rust: Upgrade 1.75.0->1.76.0
* Drop "--doc" option for rust oe-selftest since it is not supported on bootstrap builds for cross-targets. * Drop the following backported patches which are merged with rust v1.76 upgrade. - custom-target-cfg.patch - rustc-bootstrap.patch - rv32-missing-syscalls.patch - target-build-value.patch https://blog.rust-lang.org/2024/02/08/Rust-1.76.0.html * Drop 'rust-rustdoc' and 'rust-dbg' from 'exclude_packages' list to check for rust reproducibility. (From OE-Core rev: 71d17ed3c7be029fc68e9dd3f5d6c4aa72ef861a) Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust/files/custom-target-cfg.patch')
-rw-r--r--meta/recipes-devtools/rust/files/custom-target-cfg.patch90
1 files changed, 0 insertions, 90 deletions
diff --git a/meta/recipes-devtools/rust/files/custom-target-cfg.patch b/meta/recipes-devtools/rust/files/custom-target-cfg.patch
deleted file mode 100644
index 15a7f252cc..0000000000
--- a/meta/recipes-devtools/rust/files/custom-target-cfg.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1Detect and fetch custom target configurations when rustc is
2bootstrapped in rust oe-selftest.
3
4Upstream-Status: Backport [https://github.com/rust-lang/rust/pull/119619/commits/26c71cbcf1a9bce6ceb962d753c467d098f63cf6]
5
6Signed-off-by: onur-ozkan <work@onurozkan.dev>
7Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
8---
9diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
10index e85f6319936..c45c0b3c652 100644
11--- a/src/tools/compiletest/src/common.rs
12+++ b/src/tools/compiletest/src/common.rs
13@@ -479,6 +479,7 @@ fn new(config: &Config) -> TargetCfgs {
14 let mut targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
15 config,
16 &["--print=all-target-specs-json", "-Zunstable-options"],
17+ Default::default(),
18 ))
19 .unwrap();
20
21@@ -491,16 +492,33 @@ fn new(config: &Config) -> TargetCfgs {
22 let mut all_families = HashSet::new();
23 let mut all_pointer_widths = HashSet::new();
24
25- // Handle custom target specs, which are not included in `--print=all-target-specs-json`.
26- if config.target.ends_with(".json") {
27- targets.insert(
28- config.target.clone(),
29- serde_json::from_str(&rustc_output(
30- config,
31- &["--print=target-spec-json", "-Zunstable-options", "--target", &config.target],
32- ))
33- .unwrap(),
34- );
35+ // If current target is not included in the `--print=all-target-specs-json` output,
36+ // we check whether it is a custom target from the user or a synthetic target from bootstrap.
37+ if !targets.contains_key(&config.target) {
38+ let mut envs: HashMap<String, String> = HashMap::new();
39+
40+ if let Ok(t) = std::env::var("RUST_TARGET_PATH") {
41+ envs.insert("RUST_TARGET_PATH".into(), t);
42+ }
43+
44+ // This returns false only when the target is neither a synthetic target
45+ // nor a custom target from the user, indicating it is most likely invalid.
46+ if config.target.ends_with(".json") || !envs.is_empty() {
47+ targets.insert(
48+ config.target.clone(),
49+ serde_json::from_str(&rustc_output(
50+ config,
51+ &[
52+ "--print=target-spec-json",
53+ "-Zunstable-options",
54+ "--target",
55+ &config.target,
56+ ],
57+ envs,
58+ ))
59+ .unwrap(),
60+ );
61+ }
62 }
63
64 for (target, cfg) in targets.iter() {
65@@ -545,7 +563,9 @@ fn get_current_target_config(
66 // code below extracts them from `--print=cfg`: make sure to only override fields that can
67 // actually be changed with `-C` flags.
68 for config in
69- rustc_output(config, &["--print=cfg", "--target", &config.target]).trim().lines()
70+ rustc_output(config, &["--print=cfg", "--target", &config.target], Default::default())
71+ .trim()
72+ .lines()
73 {
74 let (name, value) = config
75 .split_once("=\"")
76@@ -624,11 +644,12 @@ pub enum Endian {
77 Big,
78 }
79
80-fn rustc_output(config: &Config, args: &[&str]) -> String {
81+fn rustc_output(config: &Config, args: &[&str], envs: HashMap<String, String>) -> String {
82 let mut command = Command::new(&config.rustc_path);
83 add_dylib_path(&mut command, iter::once(&config.compile_lib_path));
84 command.args(&config.target_rustcflags).args(args);
85 command.env("RUSTC_BOOTSTRAP", "1");
86+ command.envs(envs);
87
88 let output = match command.output() {
89 Ok(output) => output,
90