[lld] r250101 - [ELF2] Add a base set of PPC64 relocations

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 06:39:41 PDT 2015


> Lazy binding on PPC64 does not work the same way as it does on x86. On PPC64, lazy binding works by declaring a NOBITS .plt section, and ld.so actually generates the entire stub. You don't necessarily need any .got entries at all.
>
> The full logic should be that the TOC base is computed from the starting address of .got, .toc, .tocbss, .plt (in that order, whichever is first in that list and exists). At least, that's what it says in RuntimeDyldELF.cpp.

Interesting, thanks for the info!

>> In any case, even if it is needed for some reason, it is missing a
>> testcase for that reason. All tests pass if I convert the line to
>> just
>> "return S.isShared();".
>
> It is missing a test case, but this brings up a question: Why does the x86 logic do the right thing? It seems that lld resolves the weak symbol reference to 0 during linking, but is that right? Can't it still be provided by an LD_PRELOAD? When I link a program with ld.bfd on PPC64, it leaves a dynamic binding and stub to __gmon_start__ in the final executable.

My understanding is that resolving to 0 was the correct behaviour.
Weak symbols don't even fetch archive members, it seems strange that
they still show up in the dynamic reloc. I will run some tests,
thanks.

Cheers,
Rafael


More information about the llvm-commits mailing list