I got the impression that the math library is linked statically because it -l namerefers to libname.a, however, if I try to compile a flag -static, suddenly GCC will not be able to find math functions.
-l name
libname.a
-static
Does this mean that math is not necessarily statically related? Or is something else happening here?
If it compiles statically, you should write gcc libname.ainstead gcc -l libname.
gcc libname.a
gcc -l libname
And to your question, yes, the math library is linked dynamically.