An undefined symbol in a shared object can be versioned, like f@v1.
We currently insert f as an Undefined into the symbol table, but we
should insert f@v1 instead.
The string v1 is inferred from SHT_GNU_versym and SHT_GNU_verneed.
This patch implements the functionality.
Failing to do this can cause two issues:
- If a versioned symbol referenced by a shared object is defined in the executable, we will fail to export it.
- If a versioned symbol referenced by a shared object in another object file, --no-allow-shlib-undefined may spuriously report an "undefined reference to " error. See https://bugs.llvm.org/show_bug.cgi?id=44842 (Linking -lfftw3 -lm on Arch Linux can cause undefined reference to __log_finite)