Reputation: 11
I'm searching for an easy way to stop our project from using double-precision floating point operations. Currently, I'm trying the hard way, of using a regex to filter for double (long double,etc.) variables and constants in our project. But the flow of variables/constants/defines through the whole software is hard to follow. Our MCU supports single-precision floating point operations by hardware, but not double-precision. We want to strictly prohibit the unintended use of double-precision floating point operations by notifying the user (e.g. failed build process). Unfortunately, we need to include prebuilt SW modules, which prohibits the use of compiler flags (there is one to automatically convert double to float, etc.). Does anyone have a general way of checking for double-precision operations? e.g. in the Linker? Thanks a lot!
Upvotes: 0
Views: 117
Reputation: 21888
In case double precision operations are implemented via FP emulation i.e. through calls to library functions, you can check if they are present in final linked binary. For GNU targets you can use e.g. objdump
for that:
# TODO: add all functions from libgcc in grep
$ arm-none-eabi-objdump -d a.out | grep -E '\<bl .*(add|sub|mul)df3'
or readelf
:
# TODO: add all functions from libgcc in grep
$ arm-none-eabi-readelf -sW a.out | grep '(add|sub|mul)df3'
Upvotes: 0