[llvm-commits] [llvm-gcc-4.2] r126913 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Bill Wendling
isanbard at gmail.com
Wed Mar 2 17:32:38 PST 2011
Author: void
Date: Wed Mar 2 19:32:38 2011
New Revision: 126913
URL: http://llvm.org/viewvc/llvm-project?rev=126913&view=rev
Log:
Constant CFString literals should be aligned at 1-byte boundaries in the
"__TEXT,__cstring,cstring_literal" section. <rdar://problem/8961909>
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=126913&r1=126912&r2=126913&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Mar 2 19:32:38 2011
@@ -8757,10 +8757,12 @@
// Support -fwritable-strings.
bool StringIsConstant = !flag_writable_strings;
+ bool IsConstCFString = false;
#ifdef CONFIG_DARWIN_H
// However, ignores it if exp is a CFString and
// -fconstant-cfstring (default) is set.
- StringIsConstant |= darwin_constant_cfstring_p(exp);
+ IsConstCFString = darwin_constant_cfstring_p(exp);
+ StringIsConstant |= IsConstCFString;
#endif
// Literal cstrings in data section needs a label the linker can
@@ -8784,7 +8786,14 @@
StringIsConstant, Linkage, Init,
".str");
GV->setUnnamedAddr(true);
- GV->setAlignment(get_constant_alignment(exp) / 8);
+ if (!IsConstCFString) {
+ GV->setAlignment(get_constant_alignment(exp) / 8);
+ } else {
+ // CFStrings don't need to be over-aligned. Align them to 1.
+ // <rdar://problem/8961909>
+ GV->setAlignment(1);
+ GV->setSection("__TEXT,__cstring,cstring_literals");
+ }
if (SlotP) *SlotP = GV;
return GV;
More information about the llvm-commits
mailing list