Removed Rust and updated sources

Rust isn't cooperating as well as I had hoped. It's still a goal to have this as part of the system, but with the issues and lack of progres I've been facing, the overall development of the system can't suffer as a result.
This commit is contained in:
Alexander Hill
2025-09-06 23:51:50 -04:00
parent 9a96db5d6d
commit d953c8fca2
2 changed files with 38 additions and 135 deletions

View File

@@ -377,100 +377,6 @@ ln -sf ld.lld $MAPLE/bin/ld
mv $MAPLE/maple/tools/include/$HOST/c++/v1/__config_site $MAPLE/maple/tools/include/c++/v1/
cd ..
# Rust Build
tar xf ../sources/rustc-*.tar*
cd rustc-*/
./configure \
--build=$BUILD \
--enable-clang \
--enable-extended \
--enable-lld \
--enable-local-rust \
--enable-profiler \
--enable-sanitizers \
--enable-use-libcxx \
--llvm-root=$MAPLE/maple/tools
# NOTE: The target for Alpine is missing musl-root, so we define it here. ~ahill
sed -i "/\[target.$BUILD\]/a musl-root='/usr'" bootstrap.toml
# TODO: Also required for the "rust" section as well. Further research needed. ~ahill
sed -i "/\[rust\]/a musl-root='/usr'" bootstrap.toml
# NOTE: Next, we tell Rust to use our custom LLVM toolchain. ~ahill
sed -i "/\[target.'$HOST.json'\]/a ar = '$MAPLE/maple/tools/bin/llvm-ar'" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a cc = '$CC'" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a crt-static = false" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a cxx = '$CXX'" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a musl-root = '$MAPLE'" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a linker = '$CC'" bootstrap.toml
sed -i "/\[target.'$HOST.json'\]/a llvm-config = '$MAPLE/maple/tools/bin/llvm-config'" bootstrap.toml
# TODO: Do we need to define llvm-has-rust-patches here? ~ahill
sed -i "/\[target.'$HOST.json'\]/a ranlib = '$MAPLE/maple/tools/bin/llvm-ranlib'" bootstrap.toml
# NOTE: Setting change-id to "ignore" doesn't really have any special
# significance here. I just got tired of it complaining about the lack of
# a change-id. ~ahill
sed -i "1i change-id = 'ignore'" bootstrap.toml
# NOTE: Rust requires a JSON specification in addition to the TOML specified
# above. Since we're using x86_64-unknown-linux-musl as a template, we'll
# use compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
# as a reference. ~ahill
# See also: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html
echo "{" > $HOST.json
echo "\"arch\": \"$(echo $HOST | cut -d"-" -f0)\"," >> $HOST.json
# FIXME: How would we even automatically detect this one? ~ahill
echo "\"data-layout\": \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"," >> $HOST.json
echo "\"llvm-target\": \"$HOST\"," >> $HOST.json
echo "\"metadata\": {}," >> $HOST.json
echo "\"options\": {" >> $HOST.json
# TARGET OPTIONS BEGINS HERE
echo "\"crt-static-respected\": true," >> $HOST.json
echo "\"dynamic-linking\": true," >> $HOST.json
echo "\"env\": \"musl\"," >> $HOST.json
echo "\"families\": [\"unix\"]," >> $HOST.json
echo "\"has-rpath\": true," >> $HOST.json
echo "\"has-thread-local\": true," >> $HOST.json
echo "\"link-self-contained\": \"musl\"," >> $HOST.json
echo "\"os\": \"linux\"," >> $HOST.json
echo "\"position-independent-executables\": true," >> $HOST.json
echo "\"post-link-objects-self-contained\": {" >> $HOST.json
echo "\"dynamic-no-pic-exe\": [\"crt1.o\", \"crti.o\", \"crtbegin.o\"]," >> $HOST.json
echo "\"dynamic-pic-exe\": [\"Scrt1.o\", \"crti.o\", \"crtbeginS.o\"]," >> $HOST.json
echo "\"static-no-pic-exe\": [\"crt1.o\", \"crti.o\", \"crtbegin.o\"]," >> $HOST.json
echo "\"static-pic-exe\": [\"rcrt1.o\", \"crti.o\", \"crtbeginS.o\"]," >> $HOST.json
echo "\"dynamic-dylib\": [\"crti.o\", \"crtbeginS.o\"]," >> $HOST.json
echo "\"static-dylib\": [\"crti.o\", \"crtbeginS.o\"]" >> $HOST.json
echo "}," >> $HOST.json
echo "\"pre-link-objects-self-contained\": {" >> $HOST.json
echo "\"dynamic-no-pic-exe\": [\"crtend.o\", \"crtn.o\"]," >> $HOST.json
echo "\"dynamic-pic-exe\": [\"crtendS.o\", \"crtn.o\"]," >> $HOST.json
echo "\"static-no-pic-exe\": [\"crtend.o\", \"crtn.o\"]," >> $HOST.json
echo "\"static-pic-exe\": [\"crtendS.o\", \"crtn.o\"]," >> $HOST.json
echo "\"dynamic-dylib\": [\"crtendS.o\", \"crtn.o\"]," >> $HOST.json
echo "\"static-dylib\": [\"crtendS.o\", \"crtn.o\"]" >> $HOST.json
echo "}," >> $HOST.json
echo "\"relro-level\": \"full\"," >> $HOST.json
echo "\"supported-split-debuginfo\": [\"packed\", \"unpacked\", \"off\"]" >> $HOST.json
# END OF TARGET OPTIONS
echo "}," >> $HOST.json
# FIXME: How do we automatically detect the pointer width? ~ahill
echo "\"target-pointer-width\": \"64\"" >> $HOST.json
echo "}" >> $HOST.json
# NOTE: Rust has an interesting convention when it comes to the CC and CXX
# variables. It treats CC and CXX as the native compiler, leaving CC_$HOST
# and CXX_$HOST as the cross-compilers. Interesting strategy. ~ahill
export $(echo CC_$HOST | sed "s/-/_/g")=$CC
export $(echo CFLAGS_$HOST | sed "s/-/_/g")="$CFLAGS --sysroot=$MAPLE"
export $(echo CXX_$HOST | sed "s/-/_/g")=$CXX
export $(echo CXXFLAGS_$HOST | sed "s/-/_/g")="$CXXFLAGS --sysroot=$MAPLE"
export CC=clang
export CXX=clang++
# NOTE: This was supposedly fixed already, but here I am defining this myself. ~ahill
# See also: https://github.com/llvm/llvm-project/issues/96536
sed -i "/static char \*CountersLast/a static char *BitmapLast = NULL;" src/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
sed -i "/static char \*CountersLast/a static char *BitmapFirst = NULL;" src/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
./x.py build --stage 0 --target $HOST.json
# ...
# DESTDIR on ./x.py install?
cd ..
cd ..
# Copy the necessary configuration files to the bootstrap