Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
remove asm inline and fix build script
Browse files Browse the repository at this point in the history
  • Loading branch information
smsxgli committed Sep 19, 2021
1 parent b3168bc commit fe84a10
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 68 deletions.
45 changes: 14 additions & 31 deletions assemble.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,23 @@ Remove-Item -Force bin/*.a

$crate = "riscv-rt"

riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32i asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32i-unknown-none-elf.a bin/$crate.o
$extension_sets = @("i", "im", "ic", "imc", "if", "ifc", "imf", "imfc", "ifd", "ifdc", "imfd", "imfdc")

riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32ic asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32ic-unknown-none-elf.a bin/$crate.o
$pwd = Get-Location

riscv64-unknown-elf-gcc -c -mabi=lp64 -march=rv64i asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64i-unknown-none-elf.a bin/$crate.o
foreach ($ext in $extension_sets)
{
$abi = ""
if ($ext.contains("d"))
{$abi = "d"}
elseif ($ext.contains("f"))
{$abi = "f"}

riscv64-unknown-elf-gcc -c -mabi=lp64 -march=rv64ic asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64ic-unknown-none-elf.a bin/$crate.o
riscv64-unknown-elf-gcc -ggdb3 -fdebug-prefix-map=$pwd=/riscv-rt -c "-mabi=ilp32$abi" "-march=rv32$ext" asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32$ext-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32f -march=rv32if asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32if-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32f -march=rv32ifc asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32ifc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64f -march=rv64if asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64if-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64f -march=rv64ifc asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64ifc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32d -march=rv32ifd asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32ifd-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32d -march=rv32ifdc asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32ifdc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64d -march=rv64ifd asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64ifd-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64d -march=rv64ifdc asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64ifdc-unknown-none-elf.a bin/$crate.o
riscv64-unknown-elf-gcc -ggdb3 -fdebug-prefix-map=$pwd=/riscv-rt -c "-mabi=lp64$abi" "-march=rv64$ext" asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64$ext-unknown-none-elf.a bin/$crate.o
}

Remove-Item bin/$crate.o
60 changes: 25 additions & 35 deletions assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,30 @@ crate=riscv-rt
# remove existing blobs because otherwise this will append object files to the old blobs
rm -f bin/*.a

riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32i asm.S -o bin/$crate.o
ar crs bin/riscv32i-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32 -march=rv32ic asm.S -o bin/$crate.o
ar crs bin/riscv32ic-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64 -march=rv64i asm.S -o bin/$crate.o
ar crs bin/riscv64i-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64 -march=rv64ic asm.S -o bin/$crate.o
ar crs bin/riscv64ic-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32f -march=rv32if asm.S -o bin/$crate.o
ar crs bin/riscv32if-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32f -march=rv32ifc asm.S -o bin/$crate.o
ar crs bin/riscv32ifc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64f -march=rv64if asm.S -o bin/$crate.o
ar crs bin/riscv64if-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64f -march=rv64ifc asm.S -o bin/$crate.o
ar crs bin/riscv64ifc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32d -march=rv32ifd asm.S -o bin/$crate.o
ar crs bin/riscv32ifd-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=ilp32d -march=rv32ifdc asm.S -o bin/$crate.o
ar crs bin/riscv32ifdc-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64d -march=rv64ifd asm.S -o bin/$crate.o
ar crs bin/riscv64ifd-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -c -mabi=lp64d -march=rv64ifdc asm.S -o bin/$crate.o
ar crs bin/riscv64ifdc-unknown-none-elf.a bin/$crate.o
exts=('i' 'ic' 'im' 'imc' 'if' 'ifc' 'imf' 'imfc' 'ifd' 'ifdc' 'imfd' 'imfdc')

for ext in ${exts[@]}
do
case $ext in

*'d'*)
abi='d'
;;

*'f'*)
abi='f'
;;

*)
abi=''
;;
esac

riscv64-unknown-elf-gcc -ggdb3 -fdebug-prefix-map=$(pwd)=/riscv-rt -c -mabi=ilp32${abi} -march=rv32${ext} asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv32${ext}-unknown-none-elf.a bin/$crate.o

riscv64-unknown-elf-gcc -ggdb3 -fdebug-prefix-map=$(pwd)=/riscv-rt -c -mabi=lp64${abi} -march=rv64${ext} asm.S -o bin/$crate.o
riscv64-unknown-elf-ar crs bin/riscv64${ext}-unknown-none-elf.a bin/$crate.o
done

rm bin/$crate.o
Binary file modified bin/riscv32i-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv32ic-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv32if-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv32ifc-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv32ifd-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv32ifdc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32im-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32imc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32imf-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32imfc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32imfd-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv32imfdc-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64i-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64ic-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64if-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64ifc-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64ifd-unknown-none-elf.a
Binary file not shown.
Binary file modified bin/riscv64ifdc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64im-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64imc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64imf-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64imfc-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64imfd-unknown-none-elf.a
Binary file not shown.
Binary file added bin/riscv64imfdc-unknown-none-elf.a
Binary file not shown.
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let name = env::var("CARGO_PKG_NAME").unwrap();

if target.starts_with("riscv") && env::var_os("CARGO_FEATURE_INLINE_ASM").is_none() {
if target.starts_with("riscv") {
let mut target = Target::from_target_str(&target);
target.retain_extensions("ifdc");
target.retain_extensions("imfdc");

let target = target.to_string();

Expand Down

0 comments on commit fe84a10

Please sign in to comment.