-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhasavx
executable file
·57 lines (46 loc) · 1.2 KB
/
hasavx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
Helpfile="hasavx [-q] file [file [file...]] : Find avx instructions in executables.
Args:
-h print this help message
-q don't print error messages for files which aren't executables
"
#Get command line arguments
while getopts "qh" flag
do
case "$flag" in
"q")
BeQuiet="y"
;;
"h")
SendHelpAndQuit="y"
;;
*)
echo "Invalid argument specified." >&2
exit 5
;;
esac
done
#Send the help message and exit if -h was specified.
if [[ "$SendHelpAndQuit" == "y" ]]; then
echo -e "$Helpfile"
exit
fi
shift $(( $OPTIND - 1 ))
if [ -z "$1" ]; then
echo "No arguments provided -- please provide a filename or use -h for options." >&2
exit 2
fi
while [ -n "$1" ]; do
filename="$1"
if file "$filename" 2>/dev/null | grep -P "(current ar archive|LSB (executable|shared object))" 2>/dev/null >/dev/null ; then
opcode_search=$(objdump -M intel -d $filename | /shared/ucl/apps/rcops_scripts/opcode -s AVX -m 1)
if [ -n "$opcode_search" ]; then
echo "$filename: has AVX instructions"
fi
else
if [ -z "$BeQuiet" ]; then
echo "$filename: not a recognised binary executable type" >&2
fi
fi
shift
done