aboutsummaryrefslogtreecommitdiff
path: root/scripts/wrapper/qemu/riscv64-unknown-linux-gnu-run
blob: 439164c46a87c621cba8d0c3b85cd6ceb2e0d1d1 (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-riscv$xlen "${qemu_args[@]}" -L ${RISC_V_SYSROOT} "$@"