<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 18, 2009, at 6:16 PM, Dale Johannesen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 18, 2009, at 5:52 PMPST, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 17, 2009, at 11:08 PM, Evan Cheng wrote:</div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><a href="rdar://">rdar://</a>6479858. It's a minor size win, but more importantly it avoids linker warning. That means fewer complaints about llvm-gcc (and it has been reported at least twice so far at Apple).</div><div></div></div></blockquote></div><br><div>Then this is not an optimization, this is a semantic property.  Whatever is creating that literal string should pin it in the section that it requires it to be in.</div></div></blockquote><div><br></div>I don't understand your objection. What's wrong with putting constant array of i8 terminated with zero into cstring sections? Do we need to have the frontend pre-determine the sections for all of these strings?</div><div><br></div></div></blockquote><br></div><div>Evan and I discussed this offline.  The result is that I agree that there is nothing wrong with this patch, but that there is another underlying bug that this is being used to hide.</div><div><br></div><div>The problem is that darwin really needs the STRING_CST to be emitted to a specific section.  The "right" answer is to change darwin_build_constant_cfstring in config/darwin.c to tag the node as needing to be in the cstring section, and then the codegen will do the right thing.</div><div><br></div><div>The problem is that DECL_SECTION cannot be used on STRING_CST.  Does anyone know a good solution for this?  This is easy to fix in clang, but it would be nice for llvm-gcc to not rely on subtle behavior of the code generator for its correctness.</div></div></blockquote><br></div><div>The most straightforward would be add a section_name field to the STRING_CST node (struct tree_string in tree.h).</div><div></div></div></blockquote></div><br><div>Another option that occurred to me: we could just setSection() on *all* STRING_CSTs.  Duncan, what do you think about that?</div><div><br></div><div>-Chris </div></body></html>