The man page of gcc has a section to describe position of -l option:
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus,
foo.o -lz bar.osearches libraryzafter filefoo.obut beforebar.o. Ifbar.orefers to functions inz, those functions may not be loaded.
The question is:
If linker search & process file list in order, then shouldn't the command specify -l option before any source code & object file, instead of after them, so that the library could be used for all object files.