Move object construction into [] so the temporary can be moved.

No functionality change.
Move getRealLinkageName to a common place and remove all the duplicates of it.

Also simplify code a bit while there. No functionality change.