re PR target/47997 (gcc on macosx: "ld: warning: -fwritable-strings not compatible...
authorIain Sandoe <iains@gcc.gnu.org>
Sun, 26 Jun 2011 16:25:29 +0000 (16:25 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Sun, 26 Jun 2011 16:25:29 +0000 (16:25 +0000)
PR target/47997
* config/darwin.c (darwin_mergeable_string_section): Place string
constants in '.cstring' rather than '.const' when CF/NSStrings are
active.

From-SVN: r175410

gcc/ChangeLog
gcc/config/darwin.c

index 2737249a0e7d988e2e0d1ad6d09d7a6c7a7df30b..12a90b7d084a54ca2ac3fdb9f222e46455ad2379 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-25  Iain Sandoe  <iains@gcc.gnu.org>
+
+       PR target/47997
+       * config/darwin.c (darwin_mergeable_string_section): Place string
+       constants in '.cstring' rather than '.const' when CF/NSStrings are
+       active.
+
 2011-06-26  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.c (save_local_or_in_reg_p): Adjust comment.
index b47e806af0629a9530235be92ab9869b16fc907a..bedda1ec65be16a225e4828ba0705502efe0cbc9 100644 (file)
@@ -1195,7 +1195,11 @@ static section *
 darwin_mergeable_string_section (tree exp,
                                 unsigned HOST_WIDE_INT align)
 {
-  if (flag_merge_constants
+  /* Darwin's ld expects to see non-writable string literals in the .cstring 
+     section.  Later versions of ld check and complain when CFStrings are 
+     enabled.  Therefore we shall force the strings into .cstring since we
+     don't support writable ones anyway.  */
+  if ((darwin_constant_cfstrings || flag_merge_constants)
       && TREE_CODE (exp) == STRING_CST
       && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
       && align <= 256