https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80182
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2017-03-25 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Do you that you were getting undefined symbols when having -lm before any object/source file? If so this is not a gcc bug (or a linker one). This is how single pass linker work. Note if libm is a shared library normally it would force the linker to link to it except on Linux distros where --as-needed is default.