0

I have a ELF executable a.out that uses some floating point constants. After some investigation I found the address of these constants and then I do,

$ objdump -s a.out | grep 4a9940

which gives me the following output,

 4a9940 9c577727 266ca137 00000000 0000e03f  .Ww'&l.7.......?

Here, the 00000000 0000e03f part is just the floating point number 0.5.

If I use od directly on the executable with the appropriate address,

$ od a.out -Ax -tf | grep 0a9940

I get the corresponding floating number,

0a9940                    1e-40                      0.5

I am wondering how to get objdump to directly give the data in the floating point format, in the form similar to the output of od, or whether there are better alternatives that I can use.

I also want to know if there are any ready-to-use commands that I can pipe the output of objdump to convert it to double-precision floating point number in order to achieve this. Right now I am piping it through something like

xargs -I@ perl -le 'print unpack "d*", pack "H*", "@"' 

Maybe related: https://stackoverflow.com/questions/14314021/why-linux-gnu-linker-chose-address-0x400000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.