diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2025-04-07 12:45:54 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2025-04-17 12:09:19 -0400 |
commit | 4e7fcc27040da2ae72bf44b445a97bf9a981dd98 (patch) | |
tree | a3ec987444eb67b93ef7ea696f39347aeee4d78a /scripts | |
parent | 871637d3f2362ce839f3018040eda670f6a10dd9 (diff) | |
download | kutter-4e7fcc27040da2ae72bf44b445a97bf9a981dd98.tar.gz kutter-4e7fcc27040da2ae72bf44b445a97bf9a981dd98.tar.xz kutter-4e7fcc27040da2ae72bf44b445a97bf9a981dd98.zip |
check-software-div: Add a new build check for software divide
Update the build checks to include a check for unexpected software
divide operations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check-software-div.sh | 22 | ||||
-rwxr-xr-x | scripts/ci-build.sh | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/scripts/check-software-div.sh b/scripts/check-software-div.sh new file mode 100755 index 00000000..210e6e3c --- /dev/null +++ b/scripts/check-software-div.sh @@ -0,0 +1,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 diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh index ec37cbe0..b09b3ef7 100755 --- a/scripts/ci-build.sh +++ b/scripts/ci-build.sh @@ -56,6 +56,7 @@ for TARGET in test/configs/*.config ; do make olddefconfig make V=1 size out/*.elf + ./scripts/check-software-div.sh .config out/*.elf finish_test mcu_compile "$TARGET" cp out/klipper.dict ${DICTDIR}/$(basename ${TARGET} .config).dict done |