How to cope with 'undefined reference' errors taken the example of building VMkit x86_64 version

Hi all,

I haven’t found this trick anywhere (including llvm/docs/MakefileGuide.html)
so it maybe useful.
This occurs only in 64 bit version of linux, linker of 32 bit system understands everything correctly.

Situation:
While building, at link stage, a 64bit version of some executable, with several archive libraries, say, A.a, B.a, C.a
build fails with some “undefined reference to symbol” errors,
Error occurs in try to link-in some symbol defined in B, which is undefined symbol in A library.
Linker somehow looks for that symbol only in A library, where it is undefined, U-symbol, in terms of nm(1).

Solution is to add in USEDLIBS line name of B library immediately after name of A, for every such A for which linker gets so confused.