avr-gcc(4.4.2)/avr-libc linker issues
A little explanation of what's really going on:

The -l argument order does not normally matter on computers since most libraries are dynamically loaded (.dll, .dylib or .so) and are truly linked only at program startup time.

OTOH on the AVR all libraries are static. When linking with static libraries the linker adds to the program only the functions he currently needs from the library. 
If you pass -lm on the command line before a file that needs a particular function you will get unresolved symbols errors.