Skip to content

Commit

Permalink
Remove supplementary definitions of __bswapsi2
Browse files Browse the repository at this point in the history
Build compiler-builtins with the "c" feature by default

Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed May 7, 2024
1 parent 0859d99 commit 1860004
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
9 changes: 0 additions & 9 deletions crates/private/tests/root-task/ring-test-harness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,3 @@ mod dummy_custom_getrandom {

getrandom::register_custom_getrandom!(dummy_custom_getrandom);
}

mod compiler_builtins_supplement {
// https://github.com/rust-lang/compiler-builtins/pull/563
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
#[no_mangle]
pub extern "C" fn __bswapsi2(u: u32) -> u32 {
u.swap_bytes()
}
}

This file was deleted.

1 change: 0 additions & 1 deletion crates/sel4-async/network/rustls/utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

extern crate alloc;

mod compiler_builtins_supplement;
mod dummy_custom_getrandom;
mod no_server_cert_verifier;
mod time_provider_impl;
Expand Down
28 changes: 24 additions & 4 deletions hacking/nix/rust-utils/build-sysroot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#

{ lib, stdenv, buildPlatform, hostPlatform, buildPackages
, runCommand, linkFarm
, runCommand, runCommandCC, linkFarm
, fetchurl
, vendorLockfile, crateUtils, symlinkToRegularFile
, defaultRustToolchain, defaultRustTargetInfo
, rustToolchain ? defaultRustToolchain
Expand All @@ -27,6 +28,7 @@ in
, rustTargetInfo ? defaultRustTargetInfo
, alloc ? true
, compilerBuiltinsMem ? true
, compilerBuiltinsC ? true
}:

let
Expand Down Expand Up @@ -80,15 +82,33 @@ let

features = lib.concatStringsSep "," (lib.optionals compilerBuiltinsMem [
"compiler-builtins-mem"
] ++ lib.optionals compilerBuiltinsC [
"compiler-builtins-c"
]);

compilerRTSource = let
v = "18.0-2024-02-13";
name = "compiler-rt";
llvmSourceTarball = fetchurl {
name = "llvm-project.tar.gz";
url = "https://github.com/rust-lang/llvm-project/archive/rustc/${v}.tar.gz";
sha256 = "sha256-fMc84lCWfNy0Xiq1X7nrT53MQPlfRqGEb4qBAmqehAA=";
};
in
runCommand name {} ''
tar xzf ${llvmSourceTarball} --strip-components 1 llvm-project-rustc-${v}/${name}
mv ${name} $out
'';

in
runCommand "sysroot" {
(if compilerBuiltinsC then runCommandCC else runCommand) "sysroot" ({
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ rustToolchain ];

RUST_TARGET_PATH = rustTargetInfo.path;
} ''
} // lib.optionalAttrs compilerBuiltinsC {
"CC_${rustTargetInfo.name}" = "${stdenv.cc.targetPrefix}gcc";
RUST_COMPILER_RT_ROOT = compilerRTSource;
}) ''
cargo build \
-Z unstable-options \
--offline \
Expand Down

0 comments on commit 1860004

Please sign in to comment.