detecting software float method

Submitted by Anonymous
on March 26, 2008 - 8:25am

Anyone know how/if I can detect in runtime which software float method is being used, kernel emulation or -msoft-float ?

your architecture?

on
March 26, 2008 - 2:18pm

which architecture are you talking about? it depends on the individual programs: if the kernel supports emulation you can still build programs with -msoft-float. to find out what the kernel supports look at the usual places like /proc or the boot messages, or write a little test program and look if it catches an exception.

It's ARM and the kernel

Anonymous (not verified)
on
March 27, 2008 - 4:23am

It's ARM and the kernel supports emulation, I'll test your solution. Thanks.

If -msoft-float is not used,

Anonymous (not verified)
on
April 10, 2008 - 8:03am

If -msoft-float is not used, you will find, of course, floating point instructions in the assembler dump (objdump -DS myprogram or object file).
Now if the kernel has floating point emulation disabled and you do not have an FPU, your program gets signalled and usually terminates.
Whether you have an FPU can be seen in /proc/cpuinfo, whether it is used too (and /proc/cmdline in case you used nofpu or similar)

This method does not answer all questions, but quite a lot :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.