It's not "strange". It is simply a function of how incremental linking works. Look it up in your compilers documentation.
Note: the rules are different for static and dynamic linking and vary by platform/compiler/compiler-linker options (in some cases). But it is not magic; you just have to know the rules for the OS+compiler+linker combo that you are using.
As a general rule you should be fine if you always put objects that depend on other objects before the objects they depend on (if you have cyclic dependencies you are in for some trouble, so don't do that).