.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 (http://www.sco.com/developers/gabi/latest/ch4.sheader.html):
A symbol table entry with STB_LOCAL binding that is defined relative to one of a group's sections, and that is contained in a symbol table section that is not part of the group, must be discarded if the group members are discarded. References to this symbol table entry from outside the group are not allowed.
lld .toc hacks (rL363126 and 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