ld versus gcc
I was having a problem with a Makefile in Linux.
I had a line something like:
to link a shared library. I would get all sorts of missing references at runtime, for instance fstat and fstat64 for large file support.
Finally, I switched to gcc for linking and it solved the problem.
LINK = gcc -shared
$(LINK) -o ../lib/mylib.so $(OBJECTS) $(LIBS)