The following shows how to do different random small things we encountered and thought could be useful.
CG_RUSTFLAGS="-Clink-args=-save-temps -v" ../y.sh cargo build
CG_RUSTFLAGS="-Clink-arg=-save-temps -v -Clink-arg=-dA" ../y.sh cargo build
cargo build -v --target x86_64-unknown-linux-gnu -Zbuild-std # Take the command from the output and add --emit=llvm-ir
Run with:
COLLECT_NO_DEMANGLE=1
rustup toolchain link debug-current build/x86_64-unknown-linux-gnu/stage2
).debug-current
in the file rust-toolchain
.If you wish to build a custom sysroot, pass the path of your sysroot source to --sysroot-source
during the prepare
step, like so:
./y.sh prepare --sysroot-source /path/to/custom/source
rustc
needs to be built without jemalloc
so that mem-trace
can overload malloc
since jemalloc
is linked statically, so a LD_PRELOAD
-ed library won't a chance to intercept the calls to malloc
.
If you need to check what gccjit is generating (GIMPLE), then take a look at how to generate it in gimple.md.
./y.sh prepare --cross
so that the sysroot is patched for the cross-compiling case.gcc-path
(in config.toml
).m68k-unknown-linux-gnu-gcc
) in your $PATH
. Currently, the linker name is hardcoded as being $TARGET-gcc
. Specify the target when building the sysroot: ./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu
.OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu
.If the target is not yet supported by the Rust compiler, create a target specification file (note that the arch
specified in this file must be supported by the rust compiler). Then, you can use it the following way:
--target
as an absolute path to build the sysroot: ./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json
OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json
.If you get the following error:
/usr/bin/ld: unrecognised emulation mode: m68kelf
Make sure you set gcc-path
(in config.toml
) to the install directory.