BOLT uses MCAsmLayout to calculate the output values of functions and
basic blocks. This means output values are calculated based on a
pre-linking state and any changes to symbol values during linking will
cause incorrect values to be used.
This issue can be triggered by enabling linker relaxation on RISC-V.
Since linker relaxation can remove instructions, symbol values may
change. This causes, among other things, the symbol table created by
BOLT in the output executable to be incorrect.
This patch solves this issue by using BOLTLinker to get symbol values
instead of MCAsmLayout. This way, output values are calculated based
on a post-linking state. To make sure the linker can update all
necessary symbols, this patch also makes sure all these symbols are not
marked as temporary so that they end-up in the object file's symbol
table.
Note that this patch only deals with symbols of binary functions
(BinaryFunction::updateOutputValues). The technique described above
turned out to be too expensive for basic block symbols so those are
handled differently in D155604.
Depends on D155604
Use ADT's StringMap instead.