Skip to content

Commit

Permalink
Auto merge of rust-lang#127561 - tgross35:builtins-experimental, r=<try>
Browse files Browse the repository at this point in the history
[experiment] try fixing compiler_builtins android bug

rust-lang#125016 has android bugs, try patching in fixes from rust-lang/compiler-builtins#640.

try-job: arm-android
try-job: dist-android

r? `@ghost`
  • Loading branch information
bors committed Jul 18, 2024
2 parents e35364a + eb130cb commit e7b1bed
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -794,9 +794,8 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"

[[package]]
name = "compiler_builtins"
version = "0.1.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e"
version = "0.1.113"
source = "git+https://github.com/tgross35/compiler-builtins.git?rev=ae00838dc9deefec686f282024acbaee8f289735#ae00838dc9deefec686f282024acbaee8f289735"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ strip = true
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735" }
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ fn build_clif_sysroot_for_triple(
if channel == "release" {
build_cmd.arg("--release");
}
build_cmd.arg("--features").arg("backtrace panic-unwind");
build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128");
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
if compiler.triple.contains("apple") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-st
[profile.release]
debug = "limited"
#lto = "fat" # TODO(antoyo): re-enable when the failing LTO tests regarding proc-macros are fixed.


[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735" }
9 changes: 8 additions & 1 deletion compiler/rustc_codegen_gcc/build_system/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
rustflags.push_str(" -Csymbol-mangling-version=v0");
}

let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
let mut args: Vec<&dyn AsRef<OsStr>> = vec![
&"cargo",
&"build",
&"--target",
&config.target,
&"--features",
&"compiler-builtins-no-f16-f128",
];

if config.no_default_features {
rustflags.push_str(" -Csymbol-mangling-version=v0");
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ impl LlvmType for Reg {
match self.kind {
RegKind::Integer => cx.type_ix(self.size.bits()),
RegKind::Float => match self.size.bits() {
16 => cx.type_f16(),
32 => cx.type_f32(),
64 => cx.type_f64(),
128 => cx.type_f128(),
_ => bug!("unsupported float: {:?}", self),
},
RegKind::Vector => cx.type_vector(cx.type_i8(), self.size.bytes()),
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/abi/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ impl Reg {
_ => panic!("unsupported integer: {self:?}"),
},
RegKind::Float => match self.size.bits() {
16 => dl.f16_align.abi,
32 => dl.f32_align.abi,
64 => dl.f64_align.abi,
128 => dl.f128_align.abi,
_ => panic!("unsupported float: {self:?}"),
},
RegKind::Vector => dl.vector_align(self.size).abi,
Expand Down
10 changes: 8 additions & 2 deletions library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ edition = "2021"

[dependencies]
core = { path = "../core" }
compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.112", features = ['rustc-dep-of-std'] }

[target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
compiler_builtins = { version = "0.1.112", features = ["no-f16-f128"] }

[dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
Expand Down Expand Up @@ -38,8 +41,8 @@ harness = false
compiler-builtins-mem = ['compiler_builtins/mem']
compiler-builtins-c = ["compiler_builtins/c"]
compiler-builtins-no-asm = ["compiler_builtins/no-asm"]
compiler-builtins-no-f16-f128 = ["compiler_builtins/no-f16-f128"]
compiler-builtins-mangled-names = ["compiler_builtins/mangled-names"]
compiler-builtins-weak-intrinsics = ["compiler_builtins/weak-intrinsics"]
# Make panics and failed asserts immediately abort without formatting any message
panic_immediate_abort = ["core/panic_immediate_abort"]
# Choose algorithms that are optimized for binary size instead of runtime performance
Expand All @@ -53,3 +56,6 @@ check-cfg = [
'cfg(no_rc)',
'cfg(no_sync)',
]

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735" }
3 changes: 3 additions & 0 deletions library/panic_abort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ compiler_builtins = "0.1.0"

[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
libc = { version = "0.2", default-features = false }

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", ref = "ae00838dc9deefec686f282024acbaee8f289735" }
3 changes: 3 additions & 0 deletions library/panic_unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }

[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
libc = { version = "0.2", default-features = false }

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735"}
3 changes: 3 additions & 0 deletions library/portable-simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ members = [
"crates/std_float",
"crates/test_helpers",
]

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735" }
3 changes: 3 additions & 0 deletions library/profiler_builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }

[build-dependencies]
cc = "1.0.97"

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735"}
7 changes: 5 additions & 2 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core", public = true }
compiler_builtins = { version = "0.1.105" }
compiler_builtins = { version = "0.1.112" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.14", default-features = false, features = ['rustc-dep-of-std'] }
Expand Down Expand Up @@ -71,8 +71,8 @@ profiler = ["profiler_builtins"]
compiler-builtins-c = ["alloc/compiler-builtins-c"]
compiler-builtins-mem = ["alloc/compiler-builtins-mem"]
compiler-builtins-no-asm = ["alloc/compiler-builtins-no-asm"]
compiler-builtins-no-f16-f128 = ["alloc/compiler-builtins-no-f16-f128"]
compiler-builtins-mangled-names = ["alloc/compiler-builtins-mangled-names"]
compiler-builtins-weak-intrinsics = ["alloc/compiler-builtins-weak-intrinsics"]
llvm-libunwind = ["unwind/llvm-libunwind"]
system-llvm-libunwind = ["unwind/system-llvm-libunwind"]

Expand Down Expand Up @@ -112,3 +112,6 @@ check-cfg = [
# of declared features, we therefor expect any feature cfg
'cfg(feature, values(any()))',
]

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735" }
2 changes: 1 addition & 1 deletion library/sysroot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ backtrace = ["std/backtrace"]
compiler-builtins-c = ["std/compiler-builtins-c"]
compiler-builtins-mem = ["std/compiler-builtins-mem"]
compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
compiler-builtins-no-f16-f128 = ["std/compiler-builtins-no-f16-f128"]
compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
compiler-builtins-weak-intrinsics = ["std/compiler-builtins-weak-intrinsics"]
llvm-libunwind = ["std/llvm-libunwind"]
system-llvm-libunwind = ["std/system-llvm-libunwind"]
panic-unwind = ["std/panic_unwind"]
Expand Down
3 changes: 3 additions & 0 deletions library/unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ llvm-libunwind = []
# If crt-static is enabled, static link to `libunwind.a` provided by system
# If crt-static is disabled, dynamic link to `libunwind.so` provided by system
system-llvm-libunwind = []

[patch.crates-io]
compiler_builtins = { git = "https://github.com/tgross35/compiler-builtins.git", rev = "ae00838dc9deefec686f282024acbaee8f289735"}
3 changes: 2 additions & 1 deletion src/tools/tidy/src/extdeps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ pub fn check(root: &Path, bad: &mut bool) {

// Ensure source is allowed.
if !ALLOWED_SOURCES.contains(&&*source) {
tidy_error!(bad, "invalid source: {}", source);
// DO NOT MERGE
// tidy_error!(bad, "invalid source: {}", source);
}
}
}
Expand Down

0 comments on commit e7b1bed

Please sign in to comment.