The nightlier
feature enables 8 and 16-bit atomics, but requires patching LLVM.
Building the compiler is computationally expensive, so it may take quite a bit
of time. See the system requirements
for building the rust compiler for more specifics.
-
Clone the rust source and checkout this specific commit:
git clone https://github.com/rust-lang/rust.git cd rust git checkout 3a8e71385940c2f02ec4b23876c0a36fd09bdefe
-
Configure the build script to use
rust-lld
and optionally remove unnecessary targets to speed up the LLVM build:cp config.toml.example config.toml # Set lld to true sed -i 's/#lld = false/lld = true/' config.toml # Only build the MIPS and X86 targets sed -i 's/#targets.*$/targets = "Mips;X86"/' config.toml # Don't build any experimental targets sed -i 's/#experimental-targets.*$/experimental-targets = ""/' config.toml
-
Patch LLVM.
git submodule update --init --progress src/llvm-project cd src/llvm-project git apply /path/to/patches/llvm_atomic_fence.patch
-
Build the rust compiler:
# For the initial build ./x.py build -i library/std # To rebuild ./x.py build -i library/std --keep-stage 1
-
Create a new toolchain with the patched compiler:
rustup toolchain link psx build/x86_64-unknown-linux-gnu/stage1
where
psx
is the name for the new toolchain. -
When using
cargo-psx
, make sure to set the toolchain argument topsx
.cargo psx run --toolchain psx