[llvm] [Bolt] fix a wrong relocation update issue with weak references (PR #69136)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 06:45:23 PST 2023


yota9 wrote:

> BTW I was re-reading https://reviews.llvm.org/D118088 on why are we redirecting these relocs to PLT entries in the first place, and I can't really tell why. @yota9 do you remember why?

Sorry, I fill like I didn't quite understand your question.  I think you're talking about these lines:
>   if (!SymbolAddress && (IsAArch64 || BC->isRISCV())) {
>      const BinaryData *BD = BC->getPLTBinaryDataByName(SymbolName);
>      SymbolAddress = BD ? BD->getAddress() : 0;
>    }

The logic behind this is simple: we found the symbol, but the symbol has no address. Usually it means that the symbol is UND and it would be found it PLT. Yes, I didn't take into account the case like weak reference fixed here. 
As for the non-preemtable symbols (visibility protected I think you're talking about) - these symbols won't be UND and we won't search for the PLT entries.

Maybe I misunderstand you, sorry, please give more more information and I would try to answer :)

https://github.com/llvm/llvm-project/pull/69136


More information about the llvm-commits mailing list