<div dir="ltr"><div>Back from vacation myself. It's that time of year. :)</div><div><br></div>lgtm</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 11:39 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"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 8:17 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Nico,<div><br></div><div>Sorry about that. Since I am heading out on vacation for a week tomorrow I went ahead and reverted for now. </div><div><br></div><div>Teresa</div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 6:07 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Teresa,<div><br></div><div>this (well, 239480 really) seems to break building dynamic libraries pretty decisively: <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__code.google.com_p_chromium_issues_detail-3Fid-3D499508-23c3&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=nLklP9NMAGixlJbrQWF1F6rtUA6mKItXsOb8T7NqwFE&s=mHWIFKad5y3IMW7SQRXwpLE6Fli2eAmc9Pn3wBOPi9k&e=" target="_blank">https://code.google.com/p/chromium/issues/detail?id=499508#c3</a> Can you take a look, and if it takes a while to investigate, revert this for now?</div><div><br></div><div>Thanks,</div><div>Nico</div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>I am back from vacation and found what was happening here. The attached patches are largely the same as the original ones but contain a fix for this issue (llvm patch) and a new test created from Nico's reduced test (clang patch). </div><div><br></div><div>The broken code was compiled -fvisibility=hidden, and this caused the thunk to SyncMessageFilter::Send (_ZThn16_N17SyncMessageFilter4SendEP7Message), which is available_externally, to also be marked hidden.</div><div><br></div><div>With my patch, we eliminated the function's body and turned it into a declaration, which was still marked hidden as I wasn't modifying visibility. During AsmPrinter::doFinalization, EmitVisibility is called on all function declarations in the module, which caused this symbol to get hidden visibility (via a resulting call to MCSymbolELF::setVisibility). The linker then complained because it was undefined and hidden.</div><div><br></div><div>Before my patch, code gen suppressed the emission of this function since it was available externally, and as a result, EmitVisibility, and thus MCSymbolELF::setVisibility, were simply never called. The undefined symbol then ended up with the default visibility. It seems to me that this essentially worked by luck. </div><div><br></div><div>I've fixed this by changing the visibility on globals to DefaultVisibility when we eliminate their definitions in the new EliminateAvailableExternally pass.</div><div><br></div><div>Patches attached. Tests (including the new one) all pass. Ok to commit?</div><div><br></div><div>Thanks,</div><div>Teresa</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_extra"><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 10, 2015 at 10:49 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: tejohnson<br>
Date: Wed Jun 10 12:49:45 2015<br>
New Revision: 239481<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239481-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=nLklP9NMAGixlJbrQWF1F6rtUA6mKItXsOb8T7NqwFE&s=PU4hQBOID6clyj2hhnjDeNb1nI28rg7QGMgniAk_3GM&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239481&view=rev</a><br>
Log:<br>
Pass down the -flto option to the -cc1 job, and from there into the<br>
CodeGenOptions and onto the PassManagerBuilder. This enables gating<br>
the new EliminateAvailableExternally module pass on whether we are<br>
preparing for LTO.<br>
<br>
If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not<br>
included as we want to preserve available externally functions for possible<br>
link time inlining.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div><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-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</font></span></div></div>
</blockquote></div><br></div>