aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-06-05 07:44:53 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:13 +0200
commite35e9f4c88be4ca7bf08970109c1ff8d90018b02 (patch)
treef42c91d10cb071df9aec84e9733c3edfadd9025f
parentbd6a21a61e456539a04bc5474091104ff4eb8e9b (diff)
toolchain: replace xbuild with build-std
for a no_std build with custom target, we need to build the rust compoments including core, alloc and compiler builtins. Previously we do this with the cargo xbuild tool. however it has some bugs with newer toolchains. The official build-std feature is not stable but looks promising! Also we could reduce a lot of build dependencies. References: https://github.com/rust-in-action/code/issues/14 Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
-rw-r--r--.builds/x86_64.yml1
-rw-r--r--.cargo/config.toml3
-rw-r--r--Cargo.toml8
-rw-r--r--Makefile2
4 files changed, 4 insertions, 10 deletions
diff --git a/.builds/x86_64.yml b/.builds/x86_64.yml
index 4168b03..7445364 100644
--- a/.builds/x86_64.yml
+++ b/.builds/x86_64.yml
@@ -13,7 +13,6 @@ tasks:
cd rustubs
rustup default nightly
rustup component add rust-src
- cargo install cargo-xbuild
- build: |
cd rustubs
mkdir build
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..2abd771
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,3 @@
+[unstable]
+build-std = ["core","alloc", "compiler_builtins"]
+build-std-features = ["compiler-builtins-mem"]
diff --git a/Cargo.toml b/Cargo.toml
index b421406..b858d96 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,18 +9,10 @@ license = "eupl-1.2"
spin = "0.9.8"
bitflags = "2.4.2"
-# rebuild components, instead of using the prebuilt ones.
-# see https://os.phil-opp.com/heap-allocation/#the-allocator-interface
-# [unstable]
-# build-std = ["core", "compiler_builtins", "alloc"]
-
[dependencies.lazy_static]
version = "1.4"
features = ["spin_no_std"]
-# [build]
-# target = "x86_64-rustubs"
-
[lib]
crate-type = ["staticlib"]
diff --git a/Makefile b/Makefile
index 8575032..82555a4 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,7 @@ $(BUILD)/_%.o : %.s | $(BUILD)
# define this, the linker will have troubles, especially when we use a "no_std" build
rust_kernel: check
@echo "---BUILDING RUST KERNEL---"
- @RUSTFLAGS="$(RUSTC_FLAGS)" cargo xbuild --target $(CARGO_XBUILD_TARGET) $(CARGO_XBUILD_FLAGS)
+ RUSTFLAGS="$(RUSTC_FLAGS)" cargo build --target $(CARGO_XBUILD_TARGET) $(CARGO_XBUILD_FLAGS)
# need nasm
# TODO make this arch dependent