2017-09-29 19:06:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
FILE=$1
|
2022-11-23 06:56:55 +00:00
|
|
|
BIN_DIR=$2
|
2017-09-29 19:06:48 +00:00
|
|
|
if [ ! -f $FILE ]; then
|
|
|
|
echo "ERROR: Not a file: $FILE"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
ret=0
|
|
|
|
|
|
|
|
DIS="$BIN_DIR/llvm-dis"
|
|
|
|
if [ ! -x $DIS ]; then
|
|
|
|
echo "ERROR: Disassembler '$DIS' is not executable"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
TMP_FILE=$(mktemp)
|
|
|
|
|
|
|
|
# Check for calls. Calls to llvm intrinsics are OK
|
|
|
|
$DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE"
|
2017-10-08 20:07:56 +00:00
|
|
|
COUNT=$(wc -l < "$TMP_FILE")
|
2017-09-29 19:06:48 +00:00
|
|
|
|
2017-10-08 20:07:56 +00:00
|
|
|
if [ "$COUNT" -ne "0" ]; then
|
|
|
|
echo "ERROR: $COUNT unresolved calls detected in $FILE"
|
2017-09-29 19:06:48 +00:00
|
|
|
cat $TMP_FILE
|
|
|
|
ret=1
|
|
|
|
else
|
|
|
|
echo "File $FILE is OK"
|
|
|
|
fi
|
|
|
|
exit $ret
|