[PATCH] D114982: [ELF][PPC32] Make R_PPC32_PLTREL retain .got

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 15:27:31 PST 2021


MaskRay added a comment.



In D114982#3167885 <https://reviews.llvm.org/D114982#3167885>, @kernigh wrote:

> I don't have commit access to LLVM.
>
> You might wonder why this diff adds R_PPC32_PLTREL but not R_PPC64_CALL_PLT. My problem (where .got is missing) happened only in 32-bit code. Code that calls the plt must set register r30 in 32-bit code, or r2 in 64-bit. Most 64-bit code sets r2 = .TOC. = address of .got; LLD might keep .got because it sees this .TOC. reference. 32-bit -fPIC code can set r30 = somewhere in .got2, so there is no reference to .got, and LLD can discard .got unless we add R_PPC32_PLTREL to the list.

Seems that OpenBSD ld.so doesnot reference `.got / _GLOBAL_OFFSET_TABLE_` at all. Other ld.so implementations all reference `.got/_GLOBAL_OFFSET_TABLE_` somehow.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114982/new/

https://reviews.llvm.org/D114982



More information about the llvm-commits mailing list