Skip to content

Commit ae6244e

Browse files
committed
Auto merge of #127561 - tgross35:builtins-experimental, r=<try>
[experiment] try fixing compiler_builtins android bug #125016 has android bugs, try patching in fixes from rust-lang/compiler-builtins#640. try-job: arm-android try-job: dist-android r? `@ghost`
2 parents 52f3c71 + 28ae9dd commit ae6244e

File tree

16 files changed

+51
-11
lines changed

16 files changed

+51
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,8 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
794794

795795
[[package]]
796796
name = "compiler_builtins"
797-
version = "0.1.109"
798-
source = "registry+https://github.com/rust-lang/crates.io-index"
799-
checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e"
797+
version = "0.1.113"
798+
source = "git+https://github.com/tgross35/compiler-builtins.git?rev=e7fd5be54ae5b636d16de041e6700c80624131bf#e7fd5be54ae5b636d16de041e6700c80624131bf"
800799
dependencies = [
801800
"cc",
802801
"rustc-std-workspace-core",

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ strip = true
115115
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
116116
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
117117
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
118+
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "e7fd5be54ae5b636d16de041e6700c80624131bf" }

compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn build_clif_sysroot_for_triple(
272272
if channel == "release" {
273273
build_cmd.arg("--release");
274274
}
275-
build_cmd.arg("--features").arg("backtrace panic-unwind");
275+
build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128");
276276
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
277277
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
278278
if compiler.triple.contains("apple") {

compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-st
2222
[profile.release]
2323
debug = "limited"
2424
#lto = "fat" # TODO(antoyo): re-enable when the failing LTO tests regarding proc-macros are fixed.
25+
26+
27+
[patch.crates-io]
28+
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "e7fd5be54ae5b636d16de041e6700c80624131bf" }

compiler/rustc_codegen_gcc/build_system/src/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,14 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
141141
rustflags.push_str(" -Csymbol-mangling-version=v0");
142142
}
143143

144-
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
144+
let mut args: Vec<&dyn AsRef<OsStr>> = vec![
145+
&"cargo",
146+
&"build",
147+
&"--target",
148+
&config.target,
149+
&"--features",
150+
&"compiler-builtins-no-f16-f128",
151+
];
145152

146153
if config.no_default_features {
147154
rustflags.push_str(" -Csymbol-mangling-version=v0");

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ impl LlvmType for Reg {
121121
match self.kind {
122122
RegKind::Integer => cx.type_ix(self.size.bits()),
123123
RegKind::Float => match self.size.bits() {
124+
16 => cx.type_f16(),
124125
32 => cx.type_f32(),
125126
64 => cx.type_f64(),
127+
128 => cx.type_f128(),
126128
_ => bug!("unsupported float: {:?}", self),
127129
},
128130
RegKind::Vector => cx.type_vector(cx.type_i8(), self.size.bytes()),

compiler/rustc_target/src/abi/call/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ impl Reg {
237237
_ => panic!("unsupported integer: {self:?}"),
238238
},
239239
RegKind::Float => match self.size.bits() {
240+
16 => dl.f16_align.abi,
240241
32 => dl.f32_align.abi,
241242
64 => dl.f64_align.abi,
243+
128 => dl.f128_align.abi,
242244
_ => panic!("unsupported float: {self:?}"),
243245
},
244246
RegKind::Vector => dl.vector_align(self.size).abi,

library/alloc/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ edition = "2021"
1010

1111
[dependencies]
1212
core = { path = "../core" }
13-
compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
13+
compiler_builtins = { version = "0.1.112", features = ['rustc-dep-of-std'] }
14+
15+
[target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
16+
compiler_builtins = { version = "0.1.112", features = ["no-f16-f128"] }
1417

1518
[dev-dependencies]
1619
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
@@ -38,8 +41,8 @@ harness = false
3841
compiler-builtins-mem = ['compiler_builtins/mem']
3942
compiler-builtins-c = ["compiler_builtins/c"]
4043
compiler-builtins-no-asm = ["compiler_builtins/no-asm"]
44+
compiler-builtins-no-f16-f128 = ["compiler_builtins/no-f16-f128"]
4145
compiler-builtins-mangled-names = ["compiler_builtins/mangled-names"]
42-
compiler-builtins-weak-intrinsics = ["compiler_builtins/weak-intrinsics"]
4346
# Make panics and failed asserts immediately abort without formatting any message
4447
panic_immediate_abort = ["core/panic_immediate_abort"]
4548
# Choose algorithms that are optimized for binary size instead of runtime performance
@@ -53,3 +56,6 @@ check-cfg = [
5356
'cfg(no_rc)',
5457
'cfg(no_sync)',
5558
]
59+
60+
[patch.crates-io]
61+
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "e7fd5be54ae5b636d16de041e6700c80624131bf" }

library/panic_abort/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ compiler_builtins = "0.1.0"
1919

2020
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2121
libc = { version = "0.2", default-features = false }
22+
23+
[patch.crates-io]
24+
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", ref = "e7fd5be54ae5b636d16de041e6700c80624131bf" }

library/panic_unwind/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
2020

2121
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
2222
libc = { version = "0.2", default-features = false }
23+
24+
[patch.crates-io]
25+
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "e7fd5be54ae5b636d16de041e6700c80624131bf"}

0 commit comments

Comments
 (0)