[PATCH] D73255: [ELF][PowerPC] Support R_PPC_COPY and R_PPC64_COPY

Brandon Bergren via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 09:25:30 PST 2020


Bdragon28 added a comment.

For anyone who is curious about this, copy relocations are especially needed on powerpc32, where they are used to implement global data (such as sharing a pointer between a .so and the main program) in situations where the main program's copy lives in .bss.

Given that FreeBSD libc's API uses this extensively for things such as providing stderr in stdio, this fix is critical on ppc32, as the lack of it prevents anything more complex than /bin/echo from running without crashing due to dereferencing a null pointer.

I am currently running though a powerpc32 buildworld and testing on a G4 so I can see just how much closer that gets us to switching FreeBSD powerpc32 to lld.

On PPC64, the need for copy relocations is much reduced, as generally things go through the TOC in the first place (when using PIC), so it is sufficient to generate an R_PPC64_ADDR64 relocation against the TOC entry, instead of a copy relocation against an offset into .bss.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73255





More information about the llvm-commits mailing list