Add the rust std as a custom sysroot
This commit is contained in:
17
library/.gitignore
vendored
Normal file
17
library/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
portable-simd
|
||||
core_arch
|
||||
core
|
||||
compiler-builtins
|
||||
alloc
|
||||
stdarch
|
||||
unwind
|
||||
std_detect
|
||||
panic_abort
|
||||
panic_unwind
|
||||
rustc-std-workspace-alloc
|
||||
rustc-std-workspace-core
|
||||
rustc-std-workspace-std
|
||||
windows_link
|
||||
profiler_builtins
|
||||
test
|
||||
proc_macro
|
||||
88
library/Cargo.toml
Normal file
88
library/Cargo.toml
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
cargo-features = ["profile-rustflags"]
|
||||
|
||||
[workspace]
|
||||
resolver = "1"
|
||||
members = [
|
||||
"std",
|
||||
# "sysroot",
|
||||
# "coretests",
|
||||
# "alloctests",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
# stdarch has its own Cargo workspace
|
||||
"stdarch",
|
||||
"windows_link"
|
||||
]
|
||||
|
||||
[profile.release.package.compiler_builtins]
|
||||
# For compiler-builtins we always use a high number of codegen units.
|
||||
# The goal here is to place every single intrinsic into its own object
|
||||
# file to avoid symbol clashes with the system libgcc if possible. Note
|
||||
# that this number doesn't actually produce this many object files, we
|
||||
# just don't create more than this number of object files.
|
||||
#
|
||||
# It's a bit of a bummer that we have to pass this here, unfortunately.
|
||||
# Ideally this would be specified through an env var to Cargo so Cargo
|
||||
# knows how many CGUs are for this specific crate, but for now
|
||||
# per-crate configuration isn't specifiable in the environment.
|
||||
codegen-units = 10000
|
||||
|
||||
# These dependencies of the standard library implement symbolication for
|
||||
# backtraces on most platforms. Their debuginfo causes both linking to be slower
|
||||
# (more data to chew through) and binaries to be larger without really all that
|
||||
# much benefit. This section turns them all to down to have no debuginfo which
|
||||
# helps to improve link times a little bit.
|
||||
[profile.release.package]
|
||||
addr2line.debug = 0
|
||||
addr2line.opt-level = "s"
|
||||
adler2.debug = 0
|
||||
gimli.debug = 0
|
||||
gimli.opt-level = "s"
|
||||
miniz_oxide.debug = 0
|
||||
miniz_oxide.opt-level = "s"
|
||||
# `opt-level = "s"` for `object` led to a size regression when tried previously
|
||||
object.debug = 0
|
||||
rustc-demangle.debug = 0
|
||||
rustc-demangle.opt-level = "s"
|
||||
|
||||
# panic_abort must always be compiled with panic=abort, even when the rest of the
|
||||
# sysroot is panic=unwind.
|
||||
[profile.dev.package.panic_abort]
|
||||
rustflags = ["-Cpanic=abort"]
|
||||
|
||||
[profile.release.package.panic_abort]
|
||||
rustflags = ["-Cpanic=abort"]
|
||||
|
||||
# The "dist" profile is used by bootstrap for prebuilt libstd artifacts
|
||||
# These settings ensure that the prebuilt artifacts support a variety of features
|
||||
# in the user's profile.
|
||||
[profile.dist]
|
||||
inherits = "release"
|
||||
codegen-units = 1
|
||||
debug = 1 # "limited"
|
||||
rustflags = [
|
||||
# `profile.lto=off` implies `-Cembed-bitcode=no`, but unconditionally embedding
|
||||
# bitcode is necessary for when users enable LTO.
|
||||
# Required until Cargo can re-build the standard library based on the value
|
||||
# of `profile.lto` in the user's profile.
|
||||
"-Cembed-bitcode=yes",
|
||||
# Enable frame pointers
|
||||
"-Zunstable-options",
|
||||
"-Cforce-frame-pointers=non-leaf",
|
||||
]
|
||||
|
||||
[profile.dist.package.panic_abort]
|
||||
rustflags = [
|
||||
"-Cpanic=abort",
|
||||
"-Cembed-bitcode=yes",
|
||||
"-Zunstable-options",
|
||||
"-Cforce-frame-pointers=non-leaf",
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on here
|
||||
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
|
||||
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
|
||||
# rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
|
||||
1
library/backtrace
Submodule
1
library/backtrace
Submodule
Submodule library/backtrace added at 28ec93b503
319
library/justfile
Normal file
319
library/justfile
Normal file
@@ -0,0 +1,319 @@
|
||||
SRC_DIR := "std/src"
|
||||
PATCH_DIR := "std/patches"
|
||||
RUST_SRC := `rustc --print sysroot` / "lib/rustlib/src/rust/library"
|
||||
|
||||
patch-std:
|
||||
@echo "Start patching the std..."
|
||||
@find {{ PATCH_DIR }} -type f | while read -r patch_file; do \
|
||||
relative_path="${patch_file#{{ PATCH_DIR }}/}"; \
|
||||
target_file="${relative_path%.sed}.rs"; \
|
||||
if [ -f "{{ SRC_DIR }}/$target_file" ]; then \
|
||||
echo " [SED] $target_file"; \
|
||||
sed -i -f "$patch_file" "{{ SRC_DIR }}/$target_file"; \
|
||||
else \
|
||||
echo "⚠ [WARN] target doesn't exist: $target_file"; \
|
||||
fi; \
|
||||
done
|
||||
@echo "✅ Patching done."
|
||||
|
||||
update-std:
|
||||
@just setup-std
|
||||
@just patch-std
|
||||
|
||||
cp_std path:
|
||||
@echo "Linking {{ path }}"
|
||||
@mkdir {{ "std/src" / parent_directory(path) }} -p
|
||||
@ln -fs {{ RUST_SRC / "std/src" / path }} {{ "std/src" / parent_directory(path) }}
|
||||
|
||||
real_cp_std path:
|
||||
@echo "Copying {{ path }}"
|
||||
@mkdir {{ "std/src" / parent_directory(path) }} -p
|
||||
@cp {{ RUST_SRC / "std/src" / path }} {{ "std/src" / path }}
|
||||
|
||||
setup-std:
|
||||
ln -fs {{ RUST_SRC / "std_detect" }} "."
|
||||
ln -fs {{ RUST_SRC / "panic_abort" }} "."
|
||||
ln -fs {{ RUST_SRC / "panic_unwind" }} "."
|
||||
ln -fs {{ RUST_SRC / "windows_link" }} "."
|
||||
ln -fs {{ RUST_SRC / "unwind" }} "."
|
||||
ln -fs {{ RUST_SRC / "alloc" }} "."
|
||||
ln -fs {{ RUST_SRC / "rustc-std-workspace-alloc" }} "."
|
||||
ln -fs {{ RUST_SRC / "rustc-std-workspace-core" }} "."
|
||||
ln -fs {{ RUST_SRC / "rustc-std-workspace-std" }} "."
|
||||
ln -fs {{ RUST_SRC / "compiler-builtins" }} "."
|
||||
ln -fs {{ RUST_SRC / "core" }} "."
|
||||
ln -fs {{ RUST_SRC / "stdarch" }} "."
|
||||
ln -fs {{ RUST_SRC / "portable-simd" }} "."
|
||||
ln -fs {{ RUST_SRC / "proc_macro" }} "."
|
||||
ln -fs {{ RUST_SRC / "profiler_builtins" }} "."
|
||||
ln -fs {{ RUST_SRC / "test" }} "."
|
||||
|
||||
@just cp_std "../build.rs"
|
||||
@sed -i "59a\ || target_os == \"survos\"" std/build.rs
|
||||
|
||||
@just cp_std "alloc.rs"
|
||||
@just cp_std "ascii.rs"
|
||||
@just cp_std "backtrace.rs"
|
||||
@just cp_std "bstr.rs"
|
||||
@just cp_std "env.rs"
|
||||
@just cp_std "error.rs"
|
||||
@just cp_std "fs.rs"
|
||||
@just cp_std "keyword_docs.rs"
|
||||
@just cp_std "lib.rs"
|
||||
@just cp_std "macros.rs"
|
||||
@just cp_std "panic.rs"
|
||||
@just cp_std "panicking.rs"
|
||||
@just cp_std "pat.rs"
|
||||
@just cp_std "path.rs"
|
||||
@just cp_std "process.rs"
|
||||
@just cp_std "random.rs"
|
||||
@just cp_std "rt.rs"
|
||||
@just cp_std "tests_helpers.rs"
|
||||
@just cp_std "time.rs"
|
||||
|
||||
@just cp_std "backtrace"
|
||||
|
||||
@just cp_std "collections"
|
||||
|
||||
@just cp_std "ffi"
|
||||
|
||||
@just cp_std "fs"
|
||||
|
||||
@just cp_std "hash"
|
||||
|
||||
@just cp_std "io"
|
||||
|
||||
@just cp_std "net"
|
||||
|
||||
@just cp_std "num"
|
||||
|
||||
@just cp_std "os/raw/mod.rs"
|
||||
@just cp_std "os/raw/tests.rs"
|
||||
@just cp_std "os/mod.rs"
|
||||
|
||||
@just cp_std "prelude"
|
||||
|
||||
@just cp_std "process"
|
||||
|
||||
@just cp_std "sync"
|
||||
|
||||
@just cp_std "sys/alloc/mod.rs"
|
||||
|
||||
@just real_cp_std "sys/args/mod.rs"
|
||||
@just cp_std "sys/args/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/env/mod.rs"
|
||||
@just cp_std "sys/env/common.rs"
|
||||
@just cp_std "sys/env/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/fd/mod.rs"
|
||||
|
||||
@just cp_std "sys/fs/mod.rs"
|
||||
@just cp_std "sys/fs/common.rs"
|
||||
@just cp_std "sys/fs/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/helpers/mod.rs"
|
||||
@just cp_std "sys/helpers/small_c_string.rs"
|
||||
@just cp_std "sys/helpers/tests.rs"
|
||||
@just cp_std "sys/helpers/wstr.rs"
|
||||
|
||||
@just cp_std "sys/io/error/generic.rs"
|
||||
@just real_cp_std "sys/io/error/mod.rs"
|
||||
@just cp_std "sys/io/io_slice/unsupported.rs"
|
||||
@just cp_std "sys/io/is_terminal/unsupported.rs"
|
||||
@just cp_std "sys/io/kernel_copy/mod.rs"
|
||||
@just cp_std "sys/io/mod.rs"
|
||||
|
||||
@just cp_std "sys/net/connection/mod.rs"
|
||||
@just cp_std "sys/net/connection/unsupported.rs"
|
||||
@just cp_std "sys/net/hostname/mod.rs"
|
||||
@just cp_std "sys/net/hostname/unsupported.rs"
|
||||
@just cp_std "sys/net/mod.rs"
|
||||
|
||||
@just cp_std "sys/os_str/bytes/tests.rs"
|
||||
@just cp_std "sys/os_str/bytes.rs"
|
||||
@just cp_std "sys/os_str/mod.rs"
|
||||
|
||||
@just real_cp_std "sys/pal/mod.rs"
|
||||
@just cp_std "sys/pal/unsupported/mod.rs"
|
||||
@just cp_std "sys/pal/unsupported/common.rs"
|
||||
@just cp_std "sys/pal/unsupported/os.rs"
|
||||
|
||||
@just cp_std "sys/path/mod.rs"
|
||||
@just cp_std "sys/path/unix.rs"
|
||||
|
||||
@just cp_std "sys/personality/dwarf/eh.rs"
|
||||
@just cp_std "sys/personality/dwarf/mod.rs"
|
||||
@just cp_std "sys/personality/dwarf/tests.rs"
|
||||
@just cp_std "sys/personality/mod.rs"
|
||||
|
||||
@just cp_std "sys/pipe/mod.rs"
|
||||
@just cp_std "sys/pipe/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/platform_version/mod.rs"
|
||||
|
||||
@just cp_std "sys/process/mod.rs"
|
||||
@just cp_std "sys/process/env.rs"
|
||||
@just cp_std "sys/process/unsupported.rs"
|
||||
|
||||
@just real_cp_std "sys/random/mod.rs"
|
||||
@just cp_std "sys/random/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/stdio/mod.rs"
|
||||
@just cp_std "sys/stdio/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/sync/condvar/mod.rs"
|
||||
@just cp_std "sys/sync/condvar/no_threads.rs"
|
||||
@just cp_std "sys/sync/mutex/mod.rs"
|
||||
@just cp_std "sys/sync/mutex/no_threads.rs"
|
||||
@just cp_std "sys/sync/once/mod.rs"
|
||||
@just cp_std "sys/sync/once/no_threads.rs"
|
||||
@just cp_std "sys/sync/rwlock/mod.rs"
|
||||
@just cp_std "sys/sync/rwlock/no_threads.rs"
|
||||
@just cp_std "sys/sync/thread_parking/mod.rs"
|
||||
@just cp_std "sys/sync/thread_parking/unsupported.rs"
|
||||
@just cp_std "sys/sync/mod.rs"
|
||||
@just cp_std "sys/sync/once_box.rs"
|
||||
|
||||
@just cp_std "sys/thread/mod.rs"
|
||||
@just cp_std "sys/thread/unsupported.rs"
|
||||
|
||||
@just real_cp_std "sys/thread_local/mod.rs"
|
||||
@just cp_std "sys/thread_local/no_threads.rs"
|
||||
@just cp_std "sys/thread_local/os.rs"
|
||||
|
||||
@just cp_std "sys/time/mod.rs"
|
||||
@just cp_std "sys/time/unsupported.rs"
|
||||
|
||||
@just cp_std "sys/backtrace.rs"
|
||||
@just cp_std "sys/cmath.rs"
|
||||
@just cp_std "sys/configure_builtins.rs"
|
||||
@just cp_std "sys/env_consts.rs"
|
||||
@just cp_std "sys/exit.rs"
|
||||
@just cp_std "sys/mod.rs"
|
||||
|
||||
@just cp_std "thread"
|
||||
|
||||
STD_FILES := "alloc.rs \
|
||||
ascii.rs \
|
||||
backtrace.rs \
|
||||
bstr.rs \
|
||||
env.rs \
|
||||
error.rs \
|
||||
fs.rs \
|
||||
keyword_docs.rs \
|
||||
lib.rs \
|
||||
macros.rs \
|
||||
panic.rs \
|
||||
panicking.rs \
|
||||
pat.rs \
|
||||
path.rs \
|
||||
process.rs \
|
||||
random.rs \
|
||||
rt.rs \
|
||||
tests_helpers.rs \
|
||||
time.rs \
|
||||
backtrace \
|
||||
collections \
|
||||
ffi \
|
||||
fs \
|
||||
hash \
|
||||
io \
|
||||
net \
|
||||
num \
|
||||
os/raw/mod.rs \
|
||||
os/raw/tests.rs \
|
||||
os/mod.rs \
|
||||
prelude \
|
||||
process \
|
||||
sync \
|
||||
sys/alloc/mod.rs \
|
||||
sys/args/mod.rs \
|
||||
sys/args/unsupported.rs \
|
||||
sys/env/mod.rs \
|
||||
sys/env/common.rs \
|
||||
sys/env/unsupported.rs \
|
||||
sys/fd/mod.rs \
|
||||
sys/fs/mod.rs \
|
||||
sys/fs/common.rs \
|
||||
sys/fs/unsupported.rs \
|
||||
sys/helpers/mod.rs \
|
||||
sys/helpers/small_c_string.rs \
|
||||
sys/helpers/tests.rs \
|
||||
sys/helpers/wstr.rs \
|
||||
sys/io/error/generic.rs \
|
||||
sys/io/error/mod.rs \
|
||||
sys/io/io_slice/unsupported.rs \
|
||||
sys/io/is_terminal/unsupported.rs \
|
||||
sys/io/kernel_copy/mod.rs \
|
||||
sys/io/mod.rs \
|
||||
sys/net/connection/mod.rs \
|
||||
sys/net/connection/unsupported.rs \
|
||||
sys/net/hostname/mod.rs \
|
||||
sys/net/hostname/unsupported.rs \
|
||||
sys/net/mod.rs \
|
||||
sys/os_str/bytes/tests.rs \
|
||||
sys/os_str/bytes.rs \
|
||||
sys/os_str/mod.rs \
|
||||
sys/pal/mod.rs \
|
||||
sys/pal/unsupported/mod.rs \
|
||||
sys/pal/unsupported/common.rs \
|
||||
sys/pal/unsupported/os.rs \
|
||||
sys/path/mod.rs \
|
||||
sys/path/unix.rs \
|
||||
sys/personality/dwarf/eh.rs \
|
||||
sys/personality/dwarf/mod.rs \
|
||||
sys/personality/dwarf/tests.rs \
|
||||
sys/personality/mod.rs \
|
||||
sys/pipe/mod.rs \
|
||||
sys/pipe/unsupported.rs \
|
||||
sys/platform_version/mod.rs \
|
||||
sys/process/mod.rs \
|
||||
sys/process/env.rs \
|
||||
sys/process/unsupported.rs \
|
||||
sys/random/mod.rs \
|
||||
sys/random/unsupported.rs \
|
||||
sys/stdio/mod.rs \
|
||||
sys/stdio/unsupported.rs \
|
||||
sys/sync/condvar/mod.rs \
|
||||
sys/sync/condvar/no_threads.rs \
|
||||
sys/sync/mutex/mod.rs \
|
||||
sys/sync/mutex/no_threads.rs \
|
||||
sys/sync/once/mod.rs \
|
||||
sys/sync/once/no_threads.rs \
|
||||
sys/sync/rwlock/mod.rs \
|
||||
sys/sync/rwlock/no_threads.rs \
|
||||
sys/sync/thread_parking/mod.rs \
|
||||
sys/sync/thread_parking/unsupported.rs \
|
||||
sys/sync/mod.rs \
|
||||
sys/sync/once_box.rs \
|
||||
sys/thread/mod.rs \
|
||||
sys/thread/unsupported.rs \
|
||||
sys/thread_local/mod.rs \
|
||||
sys/thread_local/no_threads.rs \
|
||||
sys/thread_local/os.rs \
|
||||
sys/time/mod.rs \
|
||||
sys/time/unsupported.rs \
|
||||
sys/backtrace.rs \
|
||||
sys/cmath.rs \
|
||||
sys/configure_builtins.rs \
|
||||
sys/env_consts.rs \
|
||||
sys/exit.rs \
|
||||
sys/mod.rs \
|
||||
thread"
|
||||
|
||||
build-sysroot: update-std
|
||||
RUSTFLAGS="-Zforce-unstable-if-unmarked -C relocation-model=pic -C link-arg=-pie" cargo build --target ../riscv64.json
|
||||
mkdir ../sysroot/lib/rustlib/riscv64/lib -p
|
||||
rm ../sysroot/lib/rustlib/riscv64/lib/* -rf
|
||||
cp target/riscv64/debug/deps/*.rlib ../sysroot/lib/rustlib/riscv64/lib
|
||||
|
||||
clean:
|
||||
# cargo clean
|
||||
rm ../sysroot/lib/rustlib/riscv64/lib/* -rf
|
||||
|
||||
for file in {{ STD_FILES }}; do \
|
||||
rm -rf std/src/$file; \
|
||||
done
|
||||
|
||||
rm -rf std/build.rs
|
||||
109
library/std/.gitignore
vendored
Normal file
109
library/std/.gitignore
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
build.rs
|
||||
|
||||
src/alloc.rs
|
||||
src/ascii.rs
|
||||
src/backtrace.rs
|
||||
src/bstr.rs
|
||||
src/env.rs
|
||||
src/error.rs
|
||||
src/fs.rs
|
||||
src/keyword_docs.rs
|
||||
src/lib.rs
|
||||
src/macros.rs
|
||||
src/panic.rs
|
||||
src/panicking.rs
|
||||
src/pat.rs
|
||||
src/path.rs
|
||||
src/process.rs
|
||||
src/random.rs
|
||||
src/rt.rs
|
||||
src/tests_helpers.rs
|
||||
src/time.rs
|
||||
src/backtrace
|
||||
src/collections
|
||||
src/ffi
|
||||
src/fs
|
||||
src/hash
|
||||
src/io
|
||||
src/net
|
||||
src/num
|
||||
src/os/raw/mod.rs
|
||||
src/os/raw/tests.rs
|
||||
src/os/mod.rs
|
||||
src/prelude
|
||||
src/process
|
||||
src/sync
|
||||
src/sys/alloc/mod.rs
|
||||
src/sys/args/mod.rs
|
||||
src/sys/args/unsupported.rs
|
||||
src/sys/env/mod.rs
|
||||
src/sys/env/common.rs
|
||||
src/sys/env/unsupported.rs
|
||||
src/sys/fd/mod.rs
|
||||
src/sys/fs/mod.rs
|
||||
src/sys/fs/common.rs
|
||||
src/sys/fs/unsupported.rs
|
||||
src/sys/helpers/mod.rs
|
||||
src/sys/helpers/small_c_string.rs
|
||||
src/sys/helpers/tests.rs
|
||||
src/sys/helpers/wstr.rs
|
||||
src/sys/io/error/generic.rs
|
||||
src/sys/io/error/mod.rs
|
||||
src/sys/io/io_slice/unsupported.rs
|
||||
src/sys/io/is_terminal/unsupported.rs
|
||||
src/sys/io/kernel_copy/mod.rs
|
||||
src/sys/io/mod.rs
|
||||
src/sys/net/connection/mod.rs
|
||||
src/sys/net/connection/unsupported.rs
|
||||
src/sys/net/hostname/mod.rs
|
||||
src/sys/net/hostname/unsupported.rs
|
||||
src/sys/net/mod.rs
|
||||
src/sys/os_str/bytes/tests.rs
|
||||
src/sys/os_str/bytes.rs
|
||||
src/sys/os_str/mod.rs
|
||||
src/sys/pal/mod.rs
|
||||
src/sys/pal/unsupported/mod.rs
|
||||
src/sys/pal/unsupported/common.rs
|
||||
src/sys/pal/unsupported/os.rs
|
||||
src/sys/path/mod.rs
|
||||
src/sys/path/unix.rs
|
||||
src/sys/personality/dwarf/eh.rs
|
||||
src/sys/personality/dwarf/mod.rs
|
||||
src/sys/personality/dwarf/tests.rs
|
||||
src/sys/personality/mod.rs
|
||||
src/sys/pipe/mod.rs
|
||||
src/sys/pipe/unsupported.rs
|
||||
src/sys/platform_version/mod.rs
|
||||
src/sys/process/mod.rs
|
||||
src/sys/process/env.rs
|
||||
src/sys/process/unsupported.rs
|
||||
src/sys/random/mod.rs
|
||||
src/sys/random/unsupported.rs
|
||||
src/sys/stdio/mod.rs
|
||||
src/sys/stdio/unsupported.rs
|
||||
src/sys/sync/condvar/mod.rs
|
||||
src/sys/sync/condvar/no_threads.rs
|
||||
src/sys/sync/mutex/mod.rs
|
||||
src/sys/sync/mutex/no_threads.rs
|
||||
src/sys/sync/once/mod.rs
|
||||
src/sys/sync/once/no_threads.rs
|
||||
src/sys/sync/rwlock/mod.rs
|
||||
src/sys/sync/rwlock/no_threads.rs
|
||||
src/sys/sync/thread_parking/mod.rs
|
||||
src/sys/sync/thread_parking/unsupported.rs
|
||||
src/sys/sync/mod.rs
|
||||
src/sys/sync/once_box.rs
|
||||
src/sys/thread/mod.rs
|
||||
src/sys/thread/unsupported.rs
|
||||
src/sys/thread_local/mod.rs
|
||||
src/sys/thread_local/no_threads.rs
|
||||
src/sys/thread_local/os.rs
|
||||
src/sys/time/mod.rs
|
||||
src/sys/time/unsupported.rs
|
||||
src/sys/backtrace.rs
|
||||
src/sys/cmath.rs
|
||||
src/sys/configure_builtins.rs
|
||||
src/sys/env_consts.rs
|
||||
src/sys/exit.rs
|
||||
src/sys/mod.rs
|
||||
src/thread
|
||||
177
library/std/Cargo.toml
Normal file
177
library/std/Cargo.toml
Normal file
@@ -0,0 +1,177 @@
|
||||
cargo-features = ["public-dependency"]
|
||||
|
||||
[package]
|
||||
name = "std"
|
||||
version = "0.0.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-lang/rust.git"
|
||||
description = "The Rust Standard Library"
|
||||
edition = "2024"
|
||||
autobenches = false
|
||||
|
||||
[lib]
|
||||
crate-type = ["dylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
alloc = { path = "../alloc", public = true }
|
||||
# std no longer uses cfg-if directly, but the included copy of backtrace does.
|
||||
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 }
|
||||
unwind = { path = "../unwind" }
|
||||
hashbrown = { version = "0.16.1", default-features = false, features = [
|
||||
'rustc-dep-of-std',
|
||||
] }
|
||||
std_detect = { path = "../std_detect", public = true }
|
||||
|
||||
# Dependencies of the `backtrace` crate
|
||||
rustc-demangle = { version = "0.1.27", features = ['rustc-dep-of-std'] }
|
||||
|
||||
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
|
||||
miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
|
||||
addr2line = { version = "0.25.0", optional = true, default-features = false }
|
||||
|
||||
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
|
||||
libc = { version = "0.2.178", default-features = false, features = [
|
||||
'rustc-dep-of-std',
|
||||
], public = true }
|
||||
|
||||
[target.'cfg(all(not(target_os = "aix"), not(all(windows, target_env = "msvc", not(target_vendor = "uwp")))))'.dependencies]
|
||||
object = { version = "0.37.1", default-features = false, optional = true, features = [
|
||||
'read_core',
|
||||
'elf',
|
||||
'macho',
|
||||
'pe',
|
||||
'unaligned',
|
||||
'archive',
|
||||
] }
|
||||
|
||||
[target.'cfg(target_os = "aix")'.dependencies]
|
||||
object = { version = "0.37.1", default-features = false, optional = true, features = [
|
||||
'read_core',
|
||||
'xcoff',
|
||||
'unaligned',
|
||||
'archive',
|
||||
] }
|
||||
|
||||
[target.'cfg(any(windows, target_os = "cygwin"))'.dependencies.windows-link]
|
||||
path = "../windows_link"
|
||||
|
||||
[dev-dependencies]
|
||||
rand = { version = "0.9.0", default-features = false, features = ["alloc"] }
|
||||
rand_xorshift = "0.4.0"
|
||||
|
||||
[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", target_os = "vexos", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
|
||||
dlmalloc = { version = "0.2.10", features = ['rustc-dep-of-std'] }
|
||||
|
||||
[target.x86_64-fortanix-unknown-sgx.dependencies]
|
||||
fortanix-sgx-abi = { version = "0.6.1", features = [
|
||||
'rustc-dep-of-std',
|
||||
], public = true }
|
||||
|
||||
[target.'cfg(target_os = "motor")'.dependencies]
|
||||
moto-rt = { version = "0.16", features = ['rustc-dep-of-std'], public = true }
|
||||
|
||||
[target.'cfg(target_os = "hermit")'.dependencies]
|
||||
hermit-abi = { version = "0.5.0", features = [
|
||||
'rustc-dep-of-std',
|
||||
], public = true }
|
||||
|
||||
[target.'cfg(all(target_os = "wasi", target_env = "p1"))'.dependencies]
|
||||
wasi = { version = "0.11.0", features = [
|
||||
'rustc-dep-of-std',
|
||||
], default-features = false }
|
||||
|
||||
[target.'cfg(all(target_os = "wasi", target_env = "p2"))'.dependencies]
|
||||
wasip2 = { version = '0.14.4', features = [
|
||||
'rustc-dep-of-std',
|
||||
], default-features = false, package = 'wasi' }
|
||||
|
||||
[target.'cfg(all(target_os = "wasi", target_env = "p3"))'.dependencies]
|
||||
wasip2 = { version = '0.14.4', features = [
|
||||
'rustc-dep-of-std',
|
||||
], default-features = false, package = 'wasi' }
|
||||
|
||||
[target.'cfg(target_os = "uefi")'.dependencies]
|
||||
r-efi = { version = "5.2.0", features = ['rustc-dep-of-std'] }
|
||||
r-efi-alloc = { version = "2.0.0", features = ['rustc-dep-of-std'] }
|
||||
|
||||
[target.'cfg(target_os = "vexos")'.dependencies]
|
||||
vex-sdk = { version = "0.27.0", features = [
|
||||
'rustc-dep-of-std',
|
||||
], default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["compiler-builtins-mem"]
|
||||
backtrace = [
|
||||
'addr2line/rustc-dep-of-std',
|
||||
'object/rustc-dep-of-std',
|
||||
'miniz_oxide/rustc-dep-of-std',
|
||||
]
|
||||
# Disable symbolization in backtraces. For use with -Zbuild-std.
|
||||
# FIXME: Ideally this should be an additive backtrace-symbolization feature
|
||||
backtrace-trace-only = []
|
||||
|
||||
panic-unwind = ["dep:panic_unwind"]
|
||||
compiler-builtins-c = ["alloc/compiler-builtins-c"]
|
||||
compiler-builtins-mem = ["alloc/compiler-builtins-mem"]
|
||||
llvm-libunwind = ["unwind/llvm-libunwind"]
|
||||
system-llvm-libunwind = ["unwind/system-llvm-libunwind"]
|
||||
|
||||
# Choose algorithms that are optimized for binary size instead of runtime performance
|
||||
optimize_for_size = ["core/optimize_for_size", "alloc/optimize_for_size"]
|
||||
|
||||
# Make `RefCell` store additional debugging information, which is printed out when
|
||||
# a borrow error occurs
|
||||
debug_refcell = ["core/debug_refcell"]
|
||||
|
||||
llvm_enzyme = ["core/llvm_enzyme"]
|
||||
|
||||
# Enable using raw-dylib for Windows imports.
|
||||
# This will eventually be the default.
|
||||
windows_raw_dylib = ["windows-link/windows_raw_dylib"]
|
||||
|
||||
[package.metadata.fortanix-sgx]
|
||||
# Maximum possible number of threads when testing
|
||||
threads = 125
|
||||
# Maximum heap size
|
||||
heap_size = 0x8000000
|
||||
|
||||
[[test]]
|
||||
name = "pipe-subprocess"
|
||||
path = "tests/pipe_subprocess.rs"
|
||||
harness = false
|
||||
|
||||
[[test]]
|
||||
name = "sync"
|
||||
path = "tests/sync/lib.rs"
|
||||
|
||||
[[test]]
|
||||
name = "thread_local"
|
||||
path = "tests/thread_local/lib.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "stdbenches"
|
||||
path = "benches/lib.rs"
|
||||
test = true
|
||||
|
||||
[lints.rust.unexpected_cfgs]
|
||||
level = "warn"
|
||||
check-cfg = [
|
||||
# std use #[path] imports to portable-simd `std_float` crate
|
||||
# and to the `backtrace` crate which messes-up with Cargo list
|
||||
# of declared features, we therefor expect any feature cfg
|
||||
'cfg(feature, values(any()))',
|
||||
# Internal features aren't marked known config by default, we use these to
|
||||
# gate tests.
|
||||
'cfg(target_has_reliable_f16)',
|
||||
'cfg(target_has_reliable_f16_math)',
|
||||
'cfg(target_has_reliable_f128)',
|
||||
'cfg(target_has_reliable_f128_math)',
|
||||
]
|
||||
|
||||
|
||||
|
||||
# shared = { path = "../shared", features = ["user"] }
|
||||
# io_crate = { package = "io", path = "../io", features = ["alloc_crate"] }
|
||||
4
library/std/patches/sys/args/mod.sed
Normal file
4
library/std/patches/sys/args/mod.sed
Normal file
@@ -0,0 +1,4 @@
|
||||
# 55a \ target_os = "survos" => { \
|
||||
# mod survos; \
|
||||
# pub use survos::*; \
|
||||
# }
|
||||
1
library/std/patches/sys/io/error/mod.sed
Normal file
1
library/std/patches/sys/io/error/mod.sed
Normal file
@@ -0,0 +1 @@
|
||||
45a \ target_os = "survos",
|
||||
6
library/std/patches/sys/pal/mod.sed
Normal file
6
library/std/patches/sys/pal/mod.sed
Normal file
@@ -0,0 +1,6 @@
|
||||
62a \ target_os = "survos" => { \
|
||||
mod unsupported; \
|
||||
pub use self::unsupported::*; \
|
||||
mod survos; \
|
||||
pub use self::survos::*; \
|
||||
}
|
||||
2
library/std/patches/sys/random/mod.sed
Normal file
2
library/std/patches/sys/random/mod.sed
Normal file
@@ -0,0 +1,2 @@
|
||||
108a \target_os = "survos",
|
||||
124a \target_os = "survos",
|
||||
6
library/std/patches/sys/thread_local/mod.sed
Normal file
6
library/std/patches/sys/thread_local/mod.sed
Normal file
@@ -0,0 +1,6 @@
|
||||
32a \ target_os = "survos",
|
||||
|
||||
129a \ target_os = "survos" => { \
|
||||
// todo \
|
||||
pub(crate) fn enable() {} \
|
||||
}
|
||||
22
library/std/riscv64.json
Normal file
22
library/std/riscv64.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"llvm-target": "riscv64",
|
||||
"llvm-abiname": "lp64",
|
||||
"abi": "lp64",
|
||||
"data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": 64,
|
||||
"arch": "riscv64",
|
||||
"os": "survos",
|
||||
"vendor": "unknown",
|
||||
"env": "",
|
||||
"features": "+i,+m,+a,+zicsr",
|
||||
"linker": "ld.lld",
|
||||
"linker-flavor": "ld",
|
||||
"executables": true,
|
||||
"panic-strategy": "abort",
|
||||
"relocation-model": "static",
|
||||
"disable-redzone": true,
|
||||
"emit-debug-gdb-scripts": false,
|
||||
"eh-frame-header": false,
|
||||
"code-model": "medium"
|
||||
}
|
||||
11
library/std/src/sys/pal/survos.rs
Normal file
11
library/std/src/sys/pal/survos.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
/// # Safety
|
||||
/// `argc` and `argv` are passed by the kernel
|
||||
#[unsafe(no_mangle)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe extern "C" fn _start(argc: isize, argv: *const *const u8) -> isize {
|
||||
unsafe extern "C" {
|
||||
fn main(argc: isize, argv: *const *const u8) -> isize;
|
||||
}
|
||||
|
||||
unsafe { main(argc, argv) }
|
||||
}
|
||||
Reference in New Issue
Block a user