If it works, why not. ... some versions require -lm to be in a certain place in command sequence or it could be because a default flag in the linker.
Does the old version of GCC have TLS enabled?