When reporting an "undefined symbol" diagnostic:
- We don't print @ for the reference.
- We don't print @ or @@ for the definition. https://bugs.llvm.org/show_bug.cgi?id=45318
This can lead to confusing diagnostics:
// foo may be foo@v2 ld.lld: error: undefined symbol: foo >>> referenced by t1.o:(.text+0x1) // foo may be foo@v1 or foo@@v1 >>> did you mean: foo >>> defined in: t.so
There are 2 ways a symbol in symtab may get truncated:
- A @@ definition may be truncated *early* by SymbolTable::insert(). The name ends with a '\0'.
- A @ definition/reference may be truncated *later* by Symbol::parseSymbolVersion(). The name ends with a '@'.
This patch detects the second case and improves the diagnostics. The first case is not improved but the second case is sufficient to make diagnostics not confusing.
"Print"? Perhaps "Returns" as it does not actually pring anything to an output.