<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 17, 2018 at 9:38 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Jan 17 21:38:43 2018<br>
New Revision: 322814<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=322814&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=322814&view=rev</a><br>
Log:<br>
Don't drop dso_local in LTO.<br>
<br>
LTO sets dso_local as an optimization, so don't clear it.<br>
<br>
This avoid clearing it from undefined hidden symbols, which would then<br>
fail the verifier.<br>
<br>
Added:<br>
llvm/trunk/test/LTO/<wbr>Resolution/X86/setting-dso-<wbr>local.ll<br>
Modified:<br>
llvm/trunk/lib/LTO/LTO.cpp<br>
<br>
Modified: llvm/trunk/lib/LTO/LTO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=322814&r1=322813&r2=322814&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/LTO/<wbr>LTO.cpp?rev=322814&r1=322813&<wbr>r2=322814&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/LTO/LTO.cpp (original)<br>
+++ llvm/trunk/lib/LTO/LTO.cpp Wed Jan 17 21:38:43 2018<br>
@@ -639,7 +639,8 @@ LTO::addRegularLTO(<wbr>BitcodeModule BM, Arr<br>
}<br>
<br>
// Set the 'local' flag based on the linker resolution for this symbol.<br>
- GV->setDSOLocal(Res.<wbr>FinalDefinitionInLinkageUnit);<br>
+ if (Res.<wbr>FinalDefinitionInLinkageUnit)<br>
+ GV->setDSOLocal(Res.<wbr>FinalDefinitionInLinkageUnit);<br></blockquote><div><br></div><div>Why not just set to "true" - since you already checked this flag.</div><div>Teresa</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"></span></span></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
// Common resolution: collect the maximum size/alignment over all commons.<br>
// We also record if we see an instance of a common as prevailing, so that<br>
<br>
Added: llvm/trunk/test/LTO/<wbr>Resolution/X86/setting-dso-<wbr>local.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/setting-dso-local.ll?rev=322814&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/LTO/<wbr>Resolution/X86/setting-dso-<wbr>local.ll?rev=322814&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/LTO/<wbr>Resolution/X86/setting-dso-<wbr>local.ll (added)<br>
+++ llvm/trunk/test/LTO/<wbr>Resolution/X86/setting-dso-<wbr>local.ll Wed Jan 17 21:38:43 2018<br>
@@ -0,0 +1,15 @@<br>
+; RUN: llvm-as -o %t.o %s<br>
+; RUN: llvm-lto2 run -o %t2.o %t.o -r=%t.o,_start,plx -r=%t.o,foobar,x<br>
+; RUN: llvm-readelf --symbols %t2.o.0 | FileCheck %s<br>
+<br>
+; We used to fail the verifier by clearing dso_local from foobar<br>
+<br>
+; CHECK: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND foobar<br>
+<br>
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:<wbr>32:64-S128"<br>
+target triple = "x86_64-unknown-linux-gnu"<br>
+<br>
+@foobar = external hidden global i32<br>
+define i32* @_start() {<br>
+ ret i32* @foobar<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<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" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>