<br><br><div class="gmail_quote">On Fri, May 7, 2010 at 10:02 AM, Aaron Gray <span dir="ltr"><<a href="mailto:aaronngray.lists@googlemail.com">aaronngray.lists@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div><div></div><div class="h5">On 7 May 2010 17:53, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">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 style="word-wrap:break-word"><div><br><div><div>On May 7, 2010, at 9:51 AM, Nathan Jeffords wrote:</div><br><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><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></div><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></blockquote><div><br></div><div>I don't know, I see common and it makes me think that things are getting merged together, but as you say it is local so the fact that its also common becomes irrelevant. In MachO do you just put these into the .bss section?</div>
</span><br></blockquote></div><br></div><div>Macho has a special zerofill directive (targeted at the BSS section) for this. You can see this by running your example like this:</div><div><br></div><div><div>$ llc t.ll -o - -mtriple=i386-apple-darwin10</div>
<div><span style="white-space:pre"> </span>.section<span style="white-space:pre"> </span>__TEXT,__text,regular,pure_instructions</div><div>.zerofill __DATA,__bss,_tst1,4,0 ## @tst1</div><div><span style="white-space:pre"> </span>.section<span style="white-space:pre"> </span>__DATA,__data</div>
<div>_tst2: ## @tst2</div><div><span style="white-space:pre"> </span>.ascii<span style="white-space:pre"> </span> "\000\001\002\003"</div></div></div></blockquote><div><br></div>
</div></div><div>I think we should have an 'EmitZeroFill()' and 'EmitASCII()' OutStream methods, the latter to deal with dllexports in '<span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">lib/Target/X86/AsmPrinter/AsmPrinter.cpp:569'.</span></div>
</div></blockquote><div><br></div><div>I agree, I was going to put EmitASCII in, not sure about the zero fill, though I use the zero fill fragment when handling common symbols.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote">
<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">We also need to sort out COFF TLOF, and get rid of the directive stuff.</span></div>
</div></blockquote><div><br></div><div>I think this Peter's patch takes care of this nicely.</div><div> </div><div>-Nathan</div></div><br>