3 ms·
I did not know that but that does suck. The typical contract is that it shouldn’t matter beyond being able to parse it.
by klysm 4y ago
I did not know that but that does suck. The typical contract is that it shouldn’t matter beyond being able to parse it.
- cstrahan 4y agoI believe it would be that way, if not for performance. The linker keeps track of unresolved symbols, and resolves those symbols while parsing subsequent object files. So if you list a dependency before it is used, that dependency won’t be linked at all, resulting in unresolved symbols — thus the need for object files to be listed in a particular order. Edit: and the need for listing a dependency twice is to resolve mutually dependent object files. If A depends on symbols from B and B depends on symbols from A, you can link A,B,A or B,A,B (per the aforementioned reasoning).