GCC's -ffast-math behavior

xunxun xunxun1982@gmail.com
Thu Feb 9 08:33:00 GMT 2012


Hi, all

There is something with -ffast-math I don't understand.

     I want to know why gcc don't use other math lib when using 
-ffast-math.

     Take the test.c for example,

        gcc -O3 -c test.c -o test1.o
        nm test1.o  shows:
------------------------
00000000 b .bss
00000000 d .data
00000000 i .drectve
00000000 r .eh_frame
00000000 r .rdata
00000000 t .text
00000000 t .text.startup
          U ___main
          U _exp
00000000 D _in
00000000 T _main
00000080 C _out
          U _printf
------------------------

        gcc -O3 -ffast-math -c test.c -o test2.o
        nm test.2.o shows:
------------------------
00000000 b .bss
00000000 d .data
00000000 i .drectve
00000000 r .eh_frame
00000000 r .rdata
00000000 t .text
00000000 t .text.startup
          U ___main
00000000 D _in
00000000 T _main
00000080 C _out
          U _printf
------------------------

        When using -ffast-math, gcc don't generate the math function 
symbol: U _exp

              That causes the problem: if I have other optimization math 
lib (such as Intel Math Lib), gcc can't link the obj with the lib, but 
when no using -ffast-math, the lib can be linked with.

              So I want to know: are there some methods when using 
-ffast-math, I also can link it with the optimization math lib?

              Many thanks.

-- 
Best Regards,
xunxun

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120209/b7c967f6/attachment.c>


More information about the Gcc-help mailing list