<div dir="ltr">I'm not really concerned about GCC LTO compatibility, myself. It seems that gold doesn't actually care that LTO output still has COMDAT groups. I was more thinking about any optimizations that might not be possible due to COMDAT, but it seems like that might be a non-issue. While it might be nice to drop COMDAT just for simplicity, that could be more trouble than it's worth.<div><br></div><div>If we could drop COMDAT, it would simplify the way I'm trying to control function layout for pagerando (<a href="https://reviews.llvm.org/D37581#inline-344896">https://reviews.llvm.org/D37581#inline-344896</a>). However, if other linkers don't resolve COMDAT in the same way and this isn't an option, I'll try to figure out another way to deal with laying out COMDAT functions.</div><div><br></div><div>Thanks,</div><div>Stephen</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 7:56 AM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">+rafael for comments on lld, which is the other linker using the LTO API and +pcc for LTO handling<div><br></div><div>Any change we make wouldn't be gold-plugin specific - that's all in the underlying LLVM IR linking and LTO handling. Currently, the LTO API which is guided by linker symbol resolution does strip non-prevailing symbols from COMDATs. However, as you note, prevailing COMDAT are left in place. Is your concern just for gcc LTO compatibility?</div><div><br></div><div>There are some other places in LLVM where we check for COMDAT membership, but it is mostly around ensuring that DCE and similar optimizations don't yield incomplete COMDAT. I suppose for LTO since the linker has already decided to drop other COMDAT copies we could presumably remove these prevailing symbols from their the COMDAT group and optimize the symbols normally?</div><div><br></div><div>Teresa</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Dec 20, 2017 at 2:59 PM, Stephen Crane via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">I've been digging into COMDAT with regular LTO, specifically in the<br>
context of the LLVM gold plugin. The GCC WHOPR documentation specifies<br>
that the linker will resolve all COMDAT groups to the IR-provided<br>
definitions, if available. Additionally it specifies that "When the<br>
WPA phase produces the definition of the COMDAT symbol in a new object<br>
file, that definition should not be in a COMDAT group."<br>
(<a href="https://gcc.gnu.org/wiki/whopr/driver#COMDAT_Sections" rel="noreferrer" target="_blank">https://gcc.gnu.org/wiki/whop<wbr>r/driver#COMDAT_Sections</a>)<br>
<br>
The gold LTO plugin does not currently remove COMDAT groups from<br>
symbols emitted to the new object file. This doesn't actually seem to<br>
matter, as the linker ignores the COMDAT groups. However, it might be<br>
nice to strip the COMDAT group early in module linking since we know<br>
we won't need them.<br>
<br>
Do other linkers that use the LTO api also resolve COMDAT symbols to<br>
the LTO definition? Would it be possible to drop COMDAT groups for<br>
prevailing symbols, at least when linking with the gold plugin?<br>
<br>
- stephen<br></div></div>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-2589929506055503498m_-7419321193977680751m_6398449575195417311gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</font></span></div></div>
</blockquote></div><br></div>