Merge branch 'rust-linking' into 'master'

Update and Fix rust linking

See merge request redox-os/cookbook!560
This commit is contained in:
Jeremy Soller 2025-07-26 06:55:30 -06:00
commit eada032d5a
2 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,8 @@
[llvm]
download-ci-llvm = false
static-libstdcpp = false
targets = "X86"
experimental-targets = ""
# TODO: This currently must need to be set manually.
# If you like to build llvm with sccache, uncomment:
# ccache = "sccache"
@ -19,7 +21,6 @@ sysconfdir = "etc"
[rust]
backtrace = false
rpath = false
codegen-tests = false
[target.x86_64-unknown-redox]
@ -29,4 +30,5 @@ ar = "x86_64-unknown-redox-ar"
linker = "x86_64-unknown-redox-gcc"
# Nasty path, please fix
llvm-config = "../../../../bin/x86_64-unknown-redox-llvm-config"
rpath = false
crt-static = false

View File

@ -1,8 +1,8 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/rust.git"
branch = "redox-2024-05-11"
branch = "redox-2025-01-12"
# due to heavy git operation, this will only clone once and will not refetch
# if you want to refetch or changing the branch, please do ucr.rust
# if you want to refetch or changing the branch, please run `make ucr.rust`
shallow_clone = true
[build]
@ -13,23 +13,25 @@ dependencies = [
]
script = """
DYNAMIC_INIT
HOST_STRIP=$STRIP
# Linker flags for stage2 compiler (host -> target)
export MAGIC_EXTRA_RUSTFLAGS="${LDFLAGS} -C link-args=-lz"
export LDFLAGS_x86_64_unknown_redox="${LDFLAGS}" # LLVM
export CARGO_TARGET_X86_64_UNKNOWN_REDOX_RUSTFLAGS="\
-Clink-args=-L${COOKBOOK_SYSROOT}/lib \
-Clink-args=-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib \
-Clink-args=-lz"
# Don't poison the stage1 compiler (host -> host)
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF STRIP
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP
python3 "${COOKBOOK_SOURCE}/x.py" install \
--config "${COOKBOOK_RECIPE}/config.toml" \
--jobs $(nproc)
rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}/"
"${HOST_STRIP}" -v "${COOKBOOK_STAGE}/bin/rustc"
mkdir -p "${COOKBOOK_STAGE}"/usr
rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/
# TODO: rustdoc
"""
[package]
dependencies = [
"gcc13",
"cargo"
]
# TODO: Not implemented