Fix partial discarding of input for PGO function hash, see Clang PR: https://reviews.llvm.org/D79961
Note that we do not include versioning code for our PGO files: PGO files from older LDC versions are not guarantee to work with newer versions of LDC. The user will see warnings about different function hashes, so he is aware the profile is not applied for those functions. Hash clashes may occur (old version hash corresponding to different function newer version hash), which is unfortunate but I think we do not need to go to the length of solving that as it only concerns optimization, not miscompilation. (it is similar that we don't guarantee object files from older compiler to work with newer compiler due to potential ABI changes which may also be silent)
Emulation for @weak global variables is still left out but should be
analogous.
The test adaptations are mostly a revert of 3893840f. The testcase has
shown that @weak hasn't worked properly for ELF (linker apparently
prefers the version in the 1st object file, independent of whether it's
weak or not), because the functions are emitted in COMDATs.
clang emits COMDATs for templates and inline functions only, not for
regular functions.