Skip to content

Commit c849e64

Browse files
dmakarovLucasSte
authored andcommitted
[SOL] Adjust BPF customization after upgrading to rust 1.62.0
1 parent 0c3afbd commit c849e64

File tree

21 files changed

+120
-319
lines changed

21 files changed

+120
-319
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ jobs:
202202
- name: disable git crlf conversion
203203
run: git config --global core.autocrlf false
204204
- name: checkout the source code
205-
uses: actions/checkout@v2
205+
uses: actions/checkout@v3
206206
with:
207207
fetch-depth: 2
208208
- name: configure the PR in which the error message will be posted
@@ -247,6 +247,9 @@ jobs:
247247
- name: disable git crlf conversion
248248
run: src/ci/scripts/disable-git-crlf-conversion.sh
249249
if: success() && !env.SKIP_JOB
250+
- name: checkout submodules
251+
run: src/ci/scripts/checkout-submodules.sh
252+
if: success() && !env.SKIP_JOB
250253
- name: install MSYS2
251254
run: src/ci/scripts/install-msys2.sh
252255
if: success() && !env.SKIP_JOB
@@ -262,9 +265,6 @@ jobs:
262265
- name: disable git crlf conversion
263266
run: src/ci/scripts/disable-git-crlf-conversion.sh
264267
if: success() && !env.SKIP_JOB
265-
- name: checkout submodules
266-
run: src/ci/scripts/checkout-submodules.sh
267-
if: success() && !env.SKIP_JOB
268268
- name: ensure line endings are correct
269269
run: src/ci/scripts/verify-line-endings.sh
270270
if: success() && !env.SKIP_JOB

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'a> GccLinker<'a> {
343343
} else {
344344
self.linker_arg("--entry=entrypoint");
345345
}
346-
if self.sess.opts.cg.target_cpu.as_ref().unwrap_or(&self.sess.target.cpu) == "sbfv2"
346+
if self.sess.opts.cg.target_cpu.as_ref().unwrap_or(&self.sess.target.cpu.as_ref().to_string()) == "sbfv2"
347347
{
348348
self.linker_arg("--section-start=.text=0x100000000");
349349
self.linker_arg("--pack-dyn-relocs=relr");

compiler/rustc_target/src/spec/bpfel_unknown_unknown.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use crate::spec::sbf_base;
33

44
pub fn target() -> Target {
55
Target {
6-
llvm_target: "bpfel".to_string(),
6+
llvm_target: "bpfel".into(),
77
pointer_width: 64,
8-
arch: "bpf".to_string(),
9-
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".to_string(),
8+
arch: "bpf".into(),
9+
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".into(),
1010
options: sbf_base::opts(),
1111
}
1212
}

compiler/rustc_target/src/spec/sbf_base.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::abi::Endian;
2-
use super::{LinkerFlavor, PanicStrategy, TargetOptions, LldFlavor};
3-
use std::{collections::BTreeMap};
2+
use super::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions, LldFlavor};
43

54
pub fn opts() -> TargetOptions {
65
let linker_script = r"
@@ -30,38 +29,38 @@ SECTIONS
3029
}
3130
";
3231
let mut lld_args = Vec::new();
33-
lld_args.push("--threads=1".to_string());
34-
lld_args.push("-z".to_string());
35-
lld_args.push("notext".to_string());
36-
let mut pre_link_args = BTreeMap::new();
32+
lld_args.push("--threads=1".into());
33+
lld_args.push("-z".into());
34+
lld_args.push("notext".into());
35+
let mut pre_link_args = LinkArgs::new();
3736
pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), lld_args);
3837

3938
TargetOptions {
4039
allow_asm: true,
41-
c_int_width: "64".to_string(),
42-
dll_prefix: "".to_string(),
40+
c_int_width: "64".into(),
41+
dll_prefix: "".into(),
4342
dynamic_linking: true,
4443
eh_frame_header: false,
4544
emit_debug_gdb_scripts: false,
4645
endian: Endian::Little,
47-
env: String::new(),
46+
env: "".into(),
4847
executables: true,
49-
features: "+solana".to_string(),
50-
link_script: Some(linker_script.to_string()),
51-
linker: Some("rust-lld".to_owned()),
48+
features: "+solana".into(),
49+
link_script: Some(linker_script.into()),
50+
linker: Some("rust-lld".into()),
5251
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
5352
linker_is_gnu: true,
5453
main_needs_argc_argv: false,
5554
max_atomic_width: Some(64),
5655
no_default_libraries: true,
5756
only_cdylib: true,
58-
os: "solana".to_string(),
57+
os: "solana".into(),
5958
panic_strategy: PanicStrategy::Abort,
6059
position_independent_executables: true,
6160
pre_link_args,
6261
requires_lto: false,
6362
singlethread: true,
64-
vendor: "solana".to_string(),
63+
vendor: "solana".into(),
6564
.. Default::default()
6665
}
6766
}

compiler/rustc_target/src/spec/sbf_solana_solana.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use crate::spec::sbf_base;
33

44
pub fn target() -> Target {
55
Target {
6-
llvm_target: "sbf".to_string(),
6+
llvm_target: "sbf".into(),
77
pointer_width: 64,
8-
arch: "sbf".to_string(),
9-
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".to_string(),
8+
arch: "sbf".into(),
9+
data_layout: "e-m:e-p:64:64-i64:64-n32:64-S128".into(),
1010
options: sbf_base::opts(),
1111
}
1212
}

library/core/benches/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// wasm32 does not support benches (no time).
2-
#![cfg(not(target_arch = "wasm32"))]
32
// Disabling in Miri as these would take too long.
43
#![cfg(not(miri))]
4+
#![cfg(not(any(target_arch = "wasm32", target_arch = "bpf", target_arch = "sbf")))]
55
#![feature(flt2dec)]
66
#![feature(test)]
77
#![feature(trusted_random_access)]

0 commit comments

Comments
 (0)