[PATCH] D91426: [PowerPC] Fix issue where binary uses a .got but is missing a .TOC.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 07:25:11 PST 2020


stefanp created this revision.
stefanp added reviewers: nemanjai, MaskRay.
Herald added subscribers: steven.zhang, shchenz, kbarton, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
stefanp requested review of this revision.

>From the PowerPC ELFv2 ABI section 4.2.3. Global Offset Table.

  The GOT consists of an 8-byte header that contains the TOC base (the first TOC
  base when multiple TOCs are present), followed by an array of 8-byte addresses.

Due to the introduction of PC Relative code it is now possible to require a GOT
without having a .TOC. symbol in the object that is being linked. Since LLD uses
the .TOC. symbol to determine whether or not a GOT is required the GOT header is
not setup correctly and the 8-byte header is missing.

This patch allows the Power PC GOT setup to happen when an element is added to
the GOT instead of at the very begining. When this header is added a .TOC.
symbol is also added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91426

Files:
  lld/ELF/SyntheticSections.cpp
  lld/ELF/SyntheticSections.h
  lld/test/ELF/ppc64-ld-got-dtprel.s
  lld/test/ELF/ppc64-reloc-got-pcrel34.s
  lld/test/ELF/ppc64-tls-gd.s
  lld/test/ELF/ppc64-tls-ie.s
  lld/test/ELF/ppc64-tls-pcrel-gd.s
  lld/test/ELF/ppc64-tls-pcrel-ie.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91426.305139.patch
Type: text/x-patch
Size: 13848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201113/6e3d09b9/attachment.bin>


More information about the llvm-commits mailing list