<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 9:51 AM, Nathan Jeffords wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-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; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 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 class="h5"><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 class="Apple-interchange-newline"></blockquote></div><br><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 class="Apple-tab-span" style="white-space:pre">       </span>.section<span class="Apple-tab-span" style="white-space:pre">    </span>__TEXT,__text,regular,pure_instructions</div><div>.zerofill __DATA,__bss,_tst1,4,0        ## @tst1</div><div><span class="Apple-tab-span" style="white-space:pre">   </span>.section<span class="Apple-tab-span" style="white-space:pre">    </span>__DATA,__data</div><div>_tst2:                                  ## @tst2</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>.ascii<span class="Apple-tab-span" style="white-space:pre">      </span> "\000\001\002\003"</div><div><br></div><div>-Chris</div></div></body></html>