<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 9:39 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Apr 19, 2016, at 9:36 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>> wrote:</div><br><div><br><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Tue, Apr 19, 2016 at 9:18 PM, Mehdi Amini via llvm-commits<span> </span><span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span><span> </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: mehdi_amini<br>Date: Tue Apr 19 23:18:11 2016<br>New Revision: 266856<br><br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=266856&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=266856&view=rev</a><br>Log:<br>ThinLTO: never promote as external weak<br><br>This linkage is *not* intended to express that a declaration refers<br>to a weak symbol, but that the symbol might not be present at link<br>time. I don't believe it was the intent.<br></blockquote><br>In fact, this was the intent. WeakAny linkage is used for defined symbols with __attribute__((weak)), which may not have a definition. The corresponding declaration should be ExternalWeak.</div></div></blockquote><div><br></div></span><div>It is not clear to me: how can you during the link be in a situation where you have a weak definition that will not be present?</div><div>I don't see a case where we *introduce* an external_weak that is not present in the original program.</div></div></div></blockquote><div><br></div><div>Yep, I just responded to my own email after rereading it. I think this is ok. Since WeakAny must be a definition, there is no need to indicate that there might not be a definition. At the time when I wrote up the linkage changes this linkage change made sense to me, but I think you are right.</div><div><br></div><div>Teresa</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><br></div><div>CC Rafael.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>-- </div><div>Mehdi</div></font></span><div><div class="h5"><div><br></div><br><blockquote type="cite"><div><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><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"><br>From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br><br>Modified:<br>   <span> </span>llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp<br>   <span> </span>llvm/trunk/test/Linker/funcimport.ll<br><br>Modified: llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp?rev=266856&r1=266855&r2=266856&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp?rev=266856&r1=266855&r2=266856&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp (original)<br>+++ llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp Tue Apr 19 23:18:11 2016<br>@@ -132,7 +132,7 @@ FunctionImportGlobalProcessing::getLinka<br>     // linker. The module linking caller needs to enforce this.<br>     assert(!doImportAsDefinition(SGV));<br>     // If imported as a declaration, it becomes external_weak.<br>-    return GlobalValue::ExternalWeakLinkage;<br>+    return SGV->getLinkage();<br><br>   case GlobalValue::WeakODRLinkage:<br>     // For weak_odr linkage, there is a guarantee that all copies will be<br><br>Modified: llvm/trunk/test/Linker/funcimport.ll<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/funcimport.ll?rev=266856&r1=266855&r2=266856&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/funcimport.ll?rev=266856&r1=266855&r2=266856&view=diff</a><br>==============================================================================<br>--- llvm/trunk/test/Linker/funcimport.ll (original)<br>+++ llvm/trunk/test/Linker/funcimport.ll Tue Apr 19 23:18:11 2016<br>@@ -98,7 +98,7 @@<br> ; reference should turned into an external_weak declaration.<br> ; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=callweakfunc:%t.bc -import=weakfunc:%t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORTWEAKFUNC<br> ; IMPORTWEAKFUNC-DAG: Ignoring import request for weak-any function weakfunc<br>-; IMPORTWEAKFUNC-DAG: declare extern_weak void @weakfunc<br>+; IMPORTWEAKFUNC-DAG: declare void @weakfunc<br> ; IMPORTWEAKFUNC-DAG: define available_externally void @callweakfunc<br> ; IMPORTWEAKFUNC-NOT: @weakvar = extern_weak global i32, align 4<br><br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br></blockquote></div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br clear="all" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">--<span> </span></span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:times;font-size:inherit"><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></div></blockquote></div></div></div><br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="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"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>