<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 25, 2009, at 4:10 PM, Dale Johannesen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Feb 25, 2009, at 4:05 PMPST, Stuart Hastings wrote:<br><br><blockquote type="cite">Author: stuart<br></blockquote><blockquote type="cite">Date: Wed Feb 25 18:05:28 2009<br></blockquote><blockquote type="cite">New Revision: 65490<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=65490&view=rev">http://llvm.org/viewvc/llvm-project?rev=65490&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">Put all normal (no embedded NUL characters), constant STRING_CSTs in<br></blockquote><blockquote type="cite">the .cstring section.<br></blockquote><br>No, this needs to be Darwin-specific.  I thought somebody did this  <br>already?  If not you may want a new hook in TargetData.</div></blockquote><div><br></div>Right, this should be target-specific.   The idiom we're using in llvm-gcc is to define an LLVM target-macro (e.g. in darwin.h) and then change the code to something like:</div><div><br></div><div>#ifdef LLVM_STRING_SECTION</div><div><blockquote type="cite"><blockquote type="cite">+  // Try to put it into the .cstring (__TEXT, __cstring) section.<br></blockquote><blockquote type="cite">+  if (StringIsConstant && static_cast<ConstantArray*>(Init)->i<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">sCString())</span></blockquote><blockquote type="cite">+    GV->setSection(<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">LLVM_STRING_SECTION</span>);<br></blockquote><blockquote type="cite"> return GV;<br></blockquote><div><font class="Apple-style-span" color="#006312"><br></font></div></blockquote></div><div>#endif</div><div><br></div><div>Then darwin.h just gets a LLVM_STRING_SECTION #define.</div><div><br></div><div>-Chris</div><div><br><blockquote type="cite"><div><br><br><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite">   llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65490&r1=65489&r2=65490&view=diff">http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=65490&r1=65489&r2=65490&view=diff</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">= <br></blockquote><blockquote type="cite">======================================================================<br></blockquote><blockquote type="cite">--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)<br></blockquote><blockquote type="cite">+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Feb 25 18:05:28 2009<br></blockquote><blockquote type="cite">@@ -7181,6 +7181,9 @@<br></blockquote><blockquote type="cite">                                            TAI- <br></blockquote><blockquote type="cite"><blockquote type="cite">getStringConstantPrefix() :<br></blockquote></blockquote><blockquote type="cite">                                            ".str", TheModule);<br></blockquote><blockquote type="cite">  if (SlotP) *SlotP = GV;<br></blockquote><blockquote type="cite">+  // Try to put it into the .cstring (__TEXT, __cstring) section.<br></blockquote><blockquote type="cite">+  if (StringIsConstant && static_cast<ConstantArray*>(Init)- <br></blockquote><blockquote type="cite"><blockquote type="cite">isCString())<br></blockquote></blockquote><blockquote type="cite">+    GV->setSection("__TEXT, __cstring");<br></blockquote><blockquote type="cite">  return GV;<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">llvm-commits mailing list<br></blockquote><blockquote type="cite"><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br></blockquote><blockquote type="cite"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div></blockquote></div><br></body></html>