Skip to content

Commit 3b337af

Browse files
committed
Add a target spec file for rx-none-elf
1 parent c99157b commit 3b337af

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

build_sysroot/build_sysroot.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ eval 'export CARGO_TARGET_${target_triple_upper}_RUSTFLAGS="$CARGO_TARGET_'${tar
2727
# Build libs
2828
if [[ "$1" == "--release" ]]; then
2929
sysroot_channel='release'
30-
cargo build --target $TARGET_TRIPLE --release --verbose
30+
cargo build --target $TARGET_SPEC --release --verbose
3131
else
3232
sysroot_channel='debug'
33-
cargo build --target $TARGET_TRIPLE --features compiler_builtins/c
33+
cargo build --target $TARGET_SPEC --features compiler_builtins/c
3434
fi
3535

3636
# Copy files to sysroot

config.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
3232
TARGET_TRIPLE="mips-unknown-linux-gnu"
3333
linker='-Clinker=m68k-linux-gcc'
3434
elif [[ "$TARGET_TRIPLE" == "rx-elf" ]]; then
35-
TARGET_TRIPLE="mips-unknown-linux-gnu"
35+
TARGET_TRIPLE="rx-none-elf"
36+
TARGET_SPEC="$(pwd)/rx-none-elf.json"
3637
linker='-Clinker=rx-elf-gcc'
3738
export CC_${TARGET_TRIPLE//-/_}="rx-elf-gcc"
3839
elif [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
@@ -44,6 +45,11 @@ if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
4445
fi
4546
fi
4647

48+
if [ -z "$TARGET_SPEC" ]; then
49+
TARGET_SPEC="$TARGET_TRIPLE"
50+
fi
51+
export TARGET_SPEC
52+
4753
target_triple_upper="$(echo "$TARGET_TRIPLE" | tr '[:lower:]-' '[:upper:]_')"
4854

4955
codegen_dylib="$(pwd)/target/${CHANNEL:-debug}/librustc_codegen_gcc.$dylib_ext"

rx-none-elf.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"arch": "mips",
3+
"abi": "actually_rx",
4+
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
5+
"emit-debug-gdb-scripts": false,
6+
"executables": true,
7+
"frame-pointer": "always",
8+
"linker": "rx-elf-gcc",
9+
"linker-flavor": "gcc",
10+
"llvm-target": "thumbv7m-none-eabi",
11+
"max-atomic-width": 32,
12+
"panic-strategy": "abort",
13+
"relocation-model": "static",
14+
"target-pointer-width": "32"
15+
}

0 commit comments

Comments
 (0)