2023-05-01 21:36:25 +00:00
|
|
|
#!/bin/sh
|
2023-10-15 03:57:15 +00:00
|
|
|
COSMO=${COSMO:-/opt/cosmo}
|
|
|
|
|
|
|
|
if [ -n "$OBJDUMP" ]; then
|
|
|
|
exec "$OBJDUMP" "$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
find_objdump() {
|
|
|
|
if [ -x o/third_party/gcc/bin/$1-linux-cosmo-objdump ]; then
|
|
|
|
OBJDUMP=o/third_party/gcc/bin/$1-linux-cosmo-objdump
|
|
|
|
elif [ -x o/third_party/gcc/bin/$1-linux-musl-objdump ]; then
|
|
|
|
OBJDUMP=o/third_party/gcc/bin/$1-linux-musl-objdump
|
|
|
|
elif [ -x "$COSMO/o/third_party/gcc/bin/$1-linux-cosmo-objdump" ]; then
|
|
|
|
OBJDUMP="$COSMO/o/third_party/gcc/bin/$1-linux-cosmo-objdump"
|
|
|
|
elif [ -x "$COSMO/o/third_party/gcc/bin/$1-linux-musl-objdump" ]; then
|
|
|
|
OBJDUMP="$COSMO/o/third_party/gcc/bin/$1-linux-musl-objdump"
|
|
|
|
else
|
|
|
|
echo "error: toolchain not found (try running 'cosmocc --update' or 'make' in the cosmo monorepo)" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-06-03 15:12:13 +00:00
|
|
|
if printf '%s\n' "$*" | grep aarch64 >/dev/null 2>&1; then
|
2023-10-15 03:57:15 +00:00
|
|
|
find_objdump aarch64
|
|
|
|
exec "$OBJDUMP" "$@"
|
2023-05-01 21:36:25 +00:00
|
|
|
else
|
2023-10-15 03:57:15 +00:00
|
|
|
find_objdump x86_64
|
|
|
|
exec "$OBJDUMP" "$@"
|
2023-05-01 21:36:25 +00:00
|
|
|
fi
|