aboutsummaryrefslogtreecommitdiff
path: root/scripts/wrapper/qemu/riscv64-unknown-linux-gnu-run
blob: f0943f451d26a46bc45d374bbf18a951393805da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

qemu_args=()
while [[ "$1" != "" ]]
do
    case "$1" in
    -Wq,*) qemu_args+=("$(echo "$1" | cut -d, -f2-)");;
    *) break;;
    esac
    shift
done

xlen="$(readelf -h $1 | grep 'Class' | cut -d: -f 2 | xargs echo | sed 's/^ELF//')"

QEMU_CPU="$(march-to-cpu-opt --get-riscv-tag $1)" qemu-riscv$xlen -r 5.10 "${qemu_args[@]}" -L ${RISC_V_SYSROOT} "$@"