aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/check-software-div.sh
blob: 210e6e3c32d07057294427f4254911bc8779dd49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# Check if a binary appears to have a software library divide operator

CFGFILE="$1"
ELFOBJ="$2"
OBJDUMP=objdump

objdump -t ${ELFOBJ} | grep -Eq '\<(__[a-z0-9]*div|__[a-z0-9]*mod)'
if [ $? -eq 0 ]; then

    if grep -Eq '^CONFIG_HAVE_SOFTWARE_DIVIDE_REQUIRED=y$' ${CFGFILE}; then
        echo ""
        echo "Software divide detected and that is normal for this chip"
        echo ""
        exit 0
    fi

    echo ""
    echo "ERROR: A software run-time divide operation was found"
    echo ""
    exit 99
fi