[PATCH] D75416: [PowerPC][ELF] Place .toc in the same COMDAT group as the target object

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 29 18:17:17 PST 2020


MaskRay created this revision.
MaskRay added reviewers: PowerPC, Bdragon28, jhibbits.
Herald added subscribers: llvm-commits, steven.zhang, shchenz, jsji, dexonsmith, kbarton, hiraditya, nemanjai.
Herald added a project: LLVM.

.text.foo (SHF_GROUP) references .toc
.toc references .rodata.foo (SHF_GROUP)
If .text.foo and .rodata.foo are discarded by the section group rule =>
.toc referencing .rodata.foo (STB_LOCAL) is disallowed by the ELF spec.

lld .toc hacks (rL363126 <https://reviews.llvm.org/rL363126> and rL364391 <https://reviews.llvm.org/rL364391>) allow this, but we should
eventually get rid of the hacks.

New PowerPC/ppc32-pic-large.ll tests check that we don't place .got2 in a COMDAT GROUP =>
lwz 3, .LC0-.LTOC(30) is not representable if .LC0 and .LTOC are in different .got2 sections


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75416

Files:
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/mcm-1.ll
  llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75416.247471.patch
Type: text/x-patch
Size: 5594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200301/9b0ed7e9/attachment.bin>


More information about the llvm-commits mailing list