When optimizing, GCC converts calls to cos() and sin() (and probably others, these were the ones I saw) into calls to cosf() and sinf() when cos() and sin() are called with a "float" argument. The problem with this is that neither libgcc nor uClibc provide cosf and sinf! The bug can be worked around by passing -fno-builtin-cos and -fno-builtin-sin.
The trivial code: extern double cos(double); float do_cos(float f) { return cos(f); } Produces this assembly code output: .file "test.c" .text .align 2 .global do_cos .type do_cos, %function do_cos: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. @ lr needed for prologue b cosf .size do_cos, .-do_cos .ident "GCC: (GNU) 3.4.2" When run as "arm-linux-gcc -S -O2 test.c" Output of "arm-linux-gcc -v:" Reading specs from /home/jonathan/workspace/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/bin-ccache/../lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/jonathan/workspace/gumstix/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/jonathan/workspace/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 -- Summary: GCC incorrectly issues calls to sinf, cosf Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jbrandmeyer at earthlink dot net CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i386-pc-linux-gnu GCC target triplet: arm-linux-uclibc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20353