<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 9:18 PM, Mehdi Amini via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.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">Author: mehdi_amini<br>
Date: Tue Apr 19 23:18:11 2016<br>
New Revision: 266856<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=266856&view=rev" rel="noreferrer">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 class="gmail_quote"><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">mehdi.amini@apple.com</a>><br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp<br>
    llvm/trunk/test/Linker/funcimport.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp<br>
URL: <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">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: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/funcimport.ll?rev=266856&r1=266855&r2=266856&view=diff" rel="noreferrer">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">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</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">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>