<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 7, 2010, at 12:39 AM, Nathan Jeffords wrote:</div><blockquote type="cite"><div class="gmail_quote">On Fri, May 7, 2010 at 12:03 AM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@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><div></div><div class="h5"><br>
On May 6, 2010, at 10:01 PM, Nathan Jeffords wrote:<br>
<br>
> I compile these two lines in llc<br>
><br>
> @tst1 = internal global [4 x i8] zeroinitializer;<br>
> @tst2 = internal global [4 x i8] [i8 0, i8 1, i8 2, i8 3];<br>
><br>
> @tst1 is emited via MCStreamer::EmitCommonSymbol<br>
> while the other is emited via MCStreamer::EmitLabel followed by MCStreamer::EmitBytes<br>
><br>
> from what I can tell, only symbols with common linkage should me emitted by MCStreamer::EmitCommonSymbol,<br>
><br>
> is this the expected behavior or should I fix it?<br>
<br>
</div></div>This is expected behavior.  tst1 should be emitted with something like:<br>
<br>
.local _tst1<br>
.comm _tst1, ...<br>
<br>
based on the exact syntax of your target.  If your target supports .lcomm, you can also enable that.<br>
<font color="#888888"><br>
-Chris</font></blockquote></div><br><div>This seems counter intuitive to me, I can understand that C assigned that behavior somewhat arbitrarily to uninitialized global variables, but in LLVM there is explicitly a common linkage attribute to get that behavior. Nothing in the llvm language reference indicates the behavior of a global with the 'internal' linkage attribute should change based of the values used to initialize it.</div>
</blockquote></div><br><div>I don't follow.  The object file format provides a means for efficiently zero filling a local symbol.  The compiler is just using it.  What is the problem you're trying to solve here?  Since it is not exported out of the .o file (it is local) there whether it is "common" or not is undetectable, we just get a storage optimization.</div><div><br></div><div>-Chris</div></body></html>