]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove -fwritable-strings.
authorZack Weinberg <zack@codesourcery.com>
Mon, 23 Feb 2004 21:43:18 +0000 (21:43 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 23 Feb 2004 21:43:18 +0000 (21:43 +0000)
gcc/
Remove -fwritable-strings.
* c-common.c (fix_string_type): Don't check
flag_writable_strings.
(fix_string_type): Likewise.
* c-opts.c (set_std_c89): Don't initialize
flag_writable_strings.
(set_std_c99): Likewise.
* common.opt (fwritable-strings): Remove.
* flags.h: Remove the external declaration of
flag_writable_strings.
* opts.c (common_handle_option) <OPT_fwritable_strings>:
Remove.
* toplev.c (flag_writable_strings): Remove.
(f_options): Remove an entry for writable-strings.
* varasm.c (const_hash_1) <STRING_CST>: Don't check
flag_writable_strings.
(compare_constant) <STRING_CST>: Likewise.
(build_constant_desc): Likewise.
* config/darwin.c (machopic_select_section): Likewise.
* config/arm/arm.c (AOF_ASSEMBLER): Likewise.
* config/arm/pe.c (arm_pe_encode_section_info): Likewise.
* config/iq2000/iq2000.c (iq2000_select_section): Likewise.
* config/mips/mips.c (mips_select_section): Likewise.
(mips_encode_section_info): Likewise.
* config/pa/pa.c (pa_select_section): Likewise.
* config/pa/pa.h (TEXT_SPACE_P): Likewise.
* config/v850/v850.c (v850_select_section): Likewise.
* doc/invoke.texi (-fwritable-strings): Remove.
(-fno-const-strings): Don't mention -fwritable-strings.
* doc/trouble.texi: Don't mention -fwritable-strings.

gcc/cp/
* decl.c (cxx_init_decl_processing): Don't check
flag_writable_strings.

gcc/testsuite/
* gcc.dg/fwritable-strings-1.c: Remove.

Co-Authored-By: Kazu Hirata <kazu@cs.umass.edu>
From-SVN: r78333

22 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-opts.c
gcc/common.opt
gcc/config/arm/arm.c
gcc/config/arm/pe.c
gcc/config/darwin.c
gcc/config/iq2000/iq2000.c
gcc/config/mips/mips.c
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/v850/v850.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/doc/invoke.texi
gcc/doc/trouble.texi
gcc/flags.h
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/fwritable-strings-1.c
gcc/toplev.c
gcc/varasm.c

index 8c624ea62a7437d360d5c5a293a18bf106c7e498..79cf6b0ebf892e62709095c4762ee6a7fbc83307 100644 (file)
@@ -1,3 +1,37 @@
+2004-02-23  Zack Weinberg  <zack@codesourcery.com>
+           Kazu Hirata  <kazu@cs.umass.edu>
+
+       Remove -fwritable-strings.
+       * c-common.c (fix_string_type): Don't check
+       flag_writable_strings.
+       (fix_string_type): Likewise.
+       * c-opts.c (set_std_c89): Don't initialize
+       flag_writable_strings.
+       (set_std_c99): Likewise.
+       * common.opt (fwritable-strings): Remove.
+       * flags.h: Remove the external declaration of
+       flag_writable_strings.
+       * opts.c (common_handle_option) <OPT_fwritable_strings>:
+       Remove.
+       * toplev.c (flag_writable_strings): Remove.
+       (f_options): Remove an entry for writable-strings.
+       * varasm.c (const_hash_1) <STRING_CST>: Don't check
+       flag_writable_strings.
+       (compare_constant) <STRING_CST>: Likewise.
+       (build_constant_desc): Likewise.
+       * config/darwin.c (machopic_select_section): Likewise.
+       * config/arm/arm.c (AOF_ASSEMBLER): Likewise.
+       * config/arm/pe.c (arm_pe_encode_section_info): Likewise.
+       * config/iq2000/iq2000.c (iq2000_select_section): Likewise.
+       * config/mips/mips.c (mips_select_section): Likewise.
+       (mips_encode_section_info): Likewise.
+       * config/pa/pa.c (pa_select_section): Likewise.
+       * config/pa/pa.h (TEXT_SPACE_P): Likewise.
+       * config/v850/v850.c (v850_select_section): Likewise.
+       * doc/invoke.texi (-fwritable-strings): Remove.
+       (-fno-const-strings): Don't mention -fwritable-strings.
+       * doc/trouble.texi: Don't mention -fwritable-strings.
+
 2003-02-23  Nathanael Nerode  <neroden@gcc.gnu.org>
 
        * doc/install.texi: Update for switch of boehm-gc to autoconf 2.57.
index 2ebb915f1ec377e247319d3a99db768833b10e00..3d9dbfa3297b374661ec810bb2309d9b5677a35b 100644 (file)
@@ -1164,7 +1164,7 @@ fix_string_type (tree value)
      -Wwrite-strings says make the string constant an array of const char
      so that copying it to a non-const pointer will get a warning.
      For C++, this is the standard behavior.  */
-  if (flag_const_strings && ! flag_writable_strings)
+  if (flag_const_strings)
     {
       tree elements
        = build_type_variant (wide_flag ? wchar_type_node : char_type_node,
@@ -1179,7 +1179,7 @@ fix_string_type (tree value)
                          build_index_type (build_int_2 (nchars - 1, 0)));
 
   TREE_CONSTANT (value) = 1;
-  TREE_READONLY (value) = ! flag_writable_strings;
+  TREE_READONLY (value) = 1;
   TREE_STATIC (value) = 1;
   return value;
 }
index c9b34db492169a61b745c76971de9f2ac18df9a0..b4f3851786380a04223936e6320818d7c9ebfdb6 100644 (file)
@@ -1521,7 +1521,6 @@ set_std_c89 (int c94, int iso)
   flag_no_nonansi_builtin = iso;
   flag_isoc94 = c94;
   flag_isoc99 = 0;
-  flag_writable_strings = 0;
 }
 
 /* Set the C 99 standard (without GNU extensions if ISO).  */
@@ -1534,7 +1533,6 @@ set_std_c99 (int iso)
   flag_iso = iso;
   flag_isoc99 = 1;
   flag_isoc94 = 1;
-  flag_writable_strings = 0;
 }
 
 /* Set the C++ 98 standard (without GNU extensions if ISO).  */
index 8598d8c479c0c7379fa28eebef9ed5e59beda843..cc7f218426cfe312d1c130c0c0733eb0a80ca39b 100644 (file)
@@ -738,10 +738,6 @@ fwrapv
 Common
 Assume signed arithmetic overflow wraps around
 
-fwritable-strings
-Common
-Store strings in writable data section
-
 fzero-initialized-in-bss
 Common
 Put zero initialized data in the bss section
index 7ae53123c77941cd9f65368c0b9ebfdf96d165b2..c774f19b75773d7b7f146dd4826f262ed945384d 100644 (file)
@@ -13948,8 +13948,7 @@ arm_encode_section_info (tree decl, rtx rtl, int first)
   /* This doesn't work with AOF syntax, since the string table may be in
      a different AREA.  */
 #ifndef AOF_ASSEMBLER
-  if (optimize > 0 && TREE_CONSTANT (decl)
-      && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST))
+  if (optimize > 0 && TREE_CONSTANT (decl))
     SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 #endif
 
index 2d38d1fc5e310d99a50137f064c71c1c831a0812..702ea3e43fa691ee49ec09b075a6b3b4c0b6abb8 100644 (file)
@@ -213,8 +213,7 @@ arm_pe_encode_section_info (decl, rtl, first)
      int first ATTRIBUTE_UNUSED;
 {
   /* This bit is copied from arm_encode_section_info.  */
-  if (optimize > 0 && TREE_CONSTANT (decl)
-      && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST))
+  if (optimize > 0 && TREE_CONSTANT (decl))
     SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 
   /* Mark the decl so we can tell from the rtl whether the object is
index fd5d8b6272da68cb5c76e42e9a0c254d3b3010a4..667c21e9b8760329294fd025914899b799496987 100644 (file)
@@ -1215,8 +1215,7 @@ machopic_select_section (tree exp, int reloc,
 
   if (TREE_CODE (exp) == STRING_CST
       && ((size_t) TREE_STRING_LENGTH (exp)
-         == strlen (TREE_STRING_POINTER (exp)) + 1)
-      && ! flag_writable_strings)
+         == strlen (TREE_STRING_POINTER (exp)) + 1))
     cstring_section ();
   else if ((TREE_CODE (exp) == INTEGER_CST || TREE_CODE (exp) == REAL_CST)
           && flag_merge_constants)
index 90efc4b44d37522ea8452d340d4f3737b763391f..55bda5fdf4c3b48949ca75f57ff01ef0481e3457 100644 (file)
@@ -2623,15 +2623,13 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
     {
       /* For embedded applications, always put an object in read-only data
         if possible, in order to reduce RAM usage.  */
-      if (((TREE_CODE (decl) == VAR_DECL
-           && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
-           && DECL_INITIAL (decl)
-           && (DECL_INITIAL (decl) == error_mark_node
-               || TREE_CONSTANT (DECL_INITIAL (decl))))
-          /* Deal with calls from output_constant_def_contents.  */
-          || (TREE_CODE (decl) != VAR_DECL
-              && (TREE_CODE (decl) != STRING_CST
-                  || !flag_writable_strings))))
+      if ((TREE_CODE (decl) == VAR_DECL
+          && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+          && DECL_INITIAL (decl)
+          && (DECL_INITIAL (decl) == error_mark_node
+              || TREE_CONSTANT (DECL_INITIAL (decl))))
+         /* Deal with calls from output_constant_def_contents.  */
+         || TREE_CODE (decl) != VAR_DECL)
        readonly_data_section ();
       else
        data_section ();
@@ -2640,15 +2638,13 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
     {
       /* For hosted applications, always put an object in small data if
         possible, as this gives the best performance.  */
-      if (((TREE_CODE (decl) == VAR_DECL
-                && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
-                && DECL_INITIAL (decl)
-                && (DECL_INITIAL (decl) == error_mark_node
-                    || TREE_CONSTANT (DECL_INITIAL (decl))))
-               /* Deal with calls from output_constant_def_contents.  */
-               || (TREE_CODE (decl) != VAR_DECL
-                   && (TREE_CODE (decl) != STRING_CST
-                       || !flag_writable_strings))))
+      if ((TREE_CODE (decl) == VAR_DECL
+          && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
+          && DECL_INITIAL (decl)
+          && (DECL_INITIAL (decl) == error_mark_node
+              || TREE_CONSTANT (DECL_INITIAL (decl))))
+         /* Deal with calls from output_constant_def_contents.  */
+         || TREE_CODE (decl) != VAR_DECL)
        readonly_data_section ();
       else
        data_section ();
index 88dca984837abc0d2781467ac4fc943fb67d22aa..aba66399611178f6f7de3cefdb887ed9bb3eed93 100644 (file)
@@ -7283,8 +7283,7 @@ mips_select_section (tree decl, int reloc,
                     unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
 {
   if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16)
-      && TREE_CODE (decl) == STRING_CST
-      && !flag_writable_strings)
+      && TREE_CODE (decl) == STRING_CST)
     /* For embedded position independent code, put constant strings in the
        text section, because the data section is limited to 64K in size.
        For mips16 code, put strings in the text section so that a PC
@@ -7366,7 +7365,6 @@ mips_encode_section_info (tree decl, rtx rtl, int first)
   if (TARGET_MIPS16)
     {
       if (first && TREE_CODE (decl) == STRING_CST
-          && ! flag_writable_strings
           /* If this string is from a function, and the function will
              go in a gnu linkonce section, then we can't directly
              access the string.  This gets an assembler error
@@ -7393,8 +7391,7 @@ mips_encode_section_info (tree decl, rtx rtl, int first)
         SYMBOL_REF_FLAG (symbol) = 1;
       else if (TREE_CODE (decl) == FUNCTION_DECL)
         SYMBOL_REF_FLAG (symbol) = 0;
-      else if (TREE_CODE (decl) == STRING_CST
-               && ! flag_writable_strings)
+      else if (TREE_CODE (decl) == STRING_CST)
         SYMBOL_REF_FLAG (symbol) = 0;
       else
         SYMBOL_REF_FLAG (symbol) = 1;
index 0f9a2dbaff82fb5cb49658ccf2f83ee65e7ff663..e2074a13bcbd38051f69cfc7b53d6e02993e576b 100644 (file)
@@ -9076,7 +9076,6 @@ pa_select_section (tree exp, int reloc,
       && !reloc)
     readonly_data_section ();
   else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
-          && !(TREE_CODE (exp) == STRING_CST && flag_writable_strings)
           && !reloc)
     readonly_data_section ();
   else
index 308842511d58a0088bdbc2d7b28aeacddd91da9e..b83acbce8a69ca38d44e12aab105659206318f77 100644 (file)
@@ -1666,8 +1666,7 @@ do {                                                                      \
        && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL)           \
        && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
        && !flag_pic)                                                   \
-   || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c'                       \
-       && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
+   || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c'))
 
 #define FUNCTION_NAME_P(NAME)  (*(NAME) == '@')
 
index 08adab1293d08646b6a5907b690c66c5fd08c2ee..83372624309152916eb827837376746be846f425 100644 (file)
@@ -3399,13 +3399,6 @@ v850_select_section (tree exp,
          break;
         }
     }
-  else if (TREE_CODE (exp) == STRING_CST)
-    {
-      if (! flag_writable_strings)
-       readonly_data_section ();
-      else
-       data_section ();
-    }
   else
     readonly_data_section ();
 }
index 3930fd42487c8c17196ad1919e172cf0fe27a224..875f7a57bcc15a1d03352c36b1c2baa91b4e6ecc 100644 (file)
@@ -1,3 +1,9 @@
+2004-02-23  Zack Weinberg  <zack@codesourcery.com>
+           Kazu Hirata  <kazu@cs.umass.edu>
+
+       * decl.c (cxx_init_decl_processing): Don't check
+       flag_writable_strings.
+
 2004-02-23  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR c++/14156
index 1db274eddd198991c4212dd236c12ae78efb6bfb..6a4d6efe80a446d5b8e74c23e19250791573b428 100644 (file)
@@ -3104,11 +3104,6 @@ cxx_init_decl_processing (void)
 
   /* Show we use EH for cleanups.  */
   using_eh_for_cleanups ();
-
-  /* Maintain consistency.  Perhaps we should just complain if they
-     say -fwritable-strings?  */
-  if (flag_writable_strings)
-    flag_const_strings = 0;
 }
 
 /* Generate an initializer for a function naming variable from
index 3a062399a333247205e1e055b853b42ed58bcffb..b703dc39b99d62397a2122f8e9aea2dfcbdfcc32 100644 (file)
@@ -166,8 +166,7 @@ in the following sections.
 -trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
 -fallow-single-precision  -fcond-mismatch @gol
 -fsigned-bitfields  -fsigned-char @gol
--funsigned-bitfields  -funsigned-char @gol
--fwritable-strings}
+-funsigned-bitfields  -funsigned-char}
 
 @item C++ Language Options
 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
@@ -1210,17 +1209,6 @@ These options control whether a bit-field is signed or unsigned, when the
 declaration does not use either @code{signed} or @code{unsigned}.  By
 default, such a bit-field is signed, because this is consistent: the
 basic integer types such as @code{int} are signed types.
-
-@item -fwritable-strings
-@opindex fwritable-strings
-Store string constants in the writable data segment and don't uniquize
-them.  This is for compatibility with old programs which assume they can
-write into string constants.
-
-Writing into string constants is a very bad idea; ``constants'' should
-be constant.
-
-This option is deprecated.
 @end table
 
 @node C++ Dialect Options
@@ -1292,8 +1280,7 @@ been added for putting variables into BSS without making them common.
 Give string constants type @code{char *} instead of type @code{const
 char *}.  By default, G++ uses type @code{const char *} as required by
 the standard.  Even if you use @option{-fno-const-strings}, you cannot
-actually modify the value of a string constant, unless you also use
-@option{-fwritable-strings}.
+actually modify the value of a string constant.
 
 This option might be removed in a future release of G++.  For maximum
 portability, you should structure your code so that it works with
index ce62c9536e3618ee05e875785e95ef4cac402357..2af4525ac11e58fb21f672a3b3af8f7212378bee 100644 (file)
@@ -431,17 +431,14 @@ string its argument points to.
 @cindex @code{sscanf}, and constant strings
 @cindex @code{fscanf}, and constant strings
 @cindex @code{scanf}, and constant strings
-Another consequence is that @code{sscanf} does not work on some systems
-when passed a string constant as its format control string or input.
-This is because @code{sscanf} incorrectly tries to write into the string
-constant.  Likewise @code{fscanf} and @code{scanf}.
+Another consequence is that @code{sscanf} does not work on some very
+old systems when passed a string constant as its format control string
+or input.  This is because @code{sscanf} incorrectly tries to write
+into the string constant.  Likewise @code{fscanf} and @code{scanf}.
 
-@opindex fwritable-strings
-The best solution to these problems is to change the program to use
+The solution to these problems is to change the program to use
 @code{char}-array variables with initialization strings for these
-purposes instead of string constants.  But if this is not possible,
-you can use the @option{-fwritable-strings} flag, which directs GCC
-to handle string constants the same way most C compilers do.
+purposes instead of string constants.
 
 @item
 @code{-2147483648} is positive.
index 626993fca6e20e5388b6fd9b0d02c12eb502d103..81793a8e78e56cb7b27f8a62f2547e0c94374606 100644 (file)
@@ -317,11 +317,6 @@ extern int flag_cse_skip_blocks;
    perform miscellaneous relatively-expensive optimizations.  */
 extern int flag_expensive_optimizations;
 
-/* Nonzero for -fwritable-strings:
-   store string constants in data segment and don't uniquize them.  */
-
-extern int flag_writable_strings;
-
 /* Nonzero means don't put addresses of constant functions in registers.
    Used for compiling the Unix kernel, where strange substitutions are
    done on the assembly output.  */
index a83357b72ddaee8118525e39c903f96400396db9..a4267f8772394ef0dc228e6ec78ebdbc3081b640 100644 (file)
@@ -1455,10 +1455,6 @@ common_handle_option (size_t scode, const char *arg,
       flag_wrapv = value;
       break;
 
-    case OPT_fwritable_strings:
-      flag_writable_strings = value;
-      break;
-
     case OPT_fzero_initialized_in_bss:
       flag_zero_initialized_in_bss = value;
       break;
index b912032e095f40f05ec9cbcefae0a747a6015499..f6089196ad99ac57e2d33a047caa156115acc252 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-23  Zack Weinberg  <zack@codesourcery.com>
+           Kazu Hirata  <kazu@cs.umass.edu>
+
+       * gcc.dg/fwritable-strings-1.c: Remove.
+
 2004-02-23  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR c/14156
index 652a0845fd058403161456728aa7d7e4dd5566bf..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,18 +0,0 @@
-/* PR c/12818 */
-/* Origin: <fnf@ninemoons.com> */
-
-/* { dg-do run } */
-/* { dg-options "-fwritable-strings" } */
-/* { dg-error "-fwritable-strings is deprecated" "" { target *-*-* } 0 } */
-
-extern void abort(void);
-
-char *names[] = {"alice", "bob", "john"};
-
-int main (void)
-{
-  if (names[1][0] != 'b')
-    abort();
-
-  return 0;
-}
index 071fb5d7e63ca9c6557cf890e6e58cab958e9518..9e10d01d52ffba98bc89b3d65918dc945088ad6b 100644 (file)
@@ -582,11 +582,6 @@ int flag_reduce_all_givs = 0;
 
 int flag_regmove = 0;
 
-/* Nonzero for -fwritable-strings:
-   store string constants in data segment and don't uniquize them.  */
-
-int flag_writable_strings = 0;
-
 /* Nonzero means don't put addresses of constant functions in registers.
    Used for compiling the Unix kernel, where strange substitutions are
    done on the assembly output.  */
@@ -1076,7 +1071,6 @@ static const lang_independent_options f_options[] =
   {"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1 },
   {"move-all-movables", &flag_move_all_movables, 1 },
   {"reduce-all-givs", &flag_reduce_all_givs, 1 },
-  {"writable-strings", &flag_writable_strings, 1 },
   {"peephole", &flag_no_peephole, 0 },
   {"force-mem", &flag_force_mem, 1 },
   {"force-addr", &flag_force_addr, 1 },
index 806224d5278c5bb56252a671406d81bd285c9e76..061cbcac3ef32e6cd0a7d35dfe5a9a7e4e0b66c5 100644 (file)
@@ -2029,16 +2029,8 @@ const_hash_1 (const tree exp)
       return real_hash (TREE_REAL_CST_PTR (exp));
 
     case STRING_CST:
-      if (flag_writable_strings)
-       {
-         p = (char *) &exp;
-         len = sizeof exp;
-       }
-      else
-       {
-         p = TREE_STRING_POINTER (exp);
-         len = TREE_STRING_LENGTH (exp);
-       }
+      p = TREE_STRING_POINTER (exp);
+      len = TREE_STRING_LENGTH (exp);
       break;
 
     case COMPLEX_CST:
@@ -2154,9 +2146,6 @@ compare_constant (const tree t1, const tree t2)
       return REAL_VALUES_IDENTICAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
 
     case STRING_CST:
-      if (flag_writable_strings)
-       return t1 == t2;
-
       if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
        return 0;
 
@@ -2359,10 +2348,7 @@ build_constant_desc (tree exp)
   struct constant_descriptor_tree *desc;
 
   desc = ggc_alloc (sizeof (*desc));
-  if (flag_writable_strings && TREE_CODE (exp) == STRING_CST)
-    desc->value = exp;
-  else
-    desc->value = copy_constant (exp);
+  desc->value = copy_constant (exp);
 
   /* Create a string containing the label name, in LABEL.  */
   labelno = const_labelno++;
@@ -2444,9 +2430,9 @@ maybe_output_constant_def_contents (struct constant_descriptor_tree *desc,
     /* Already output; don't do it again.  */
     return;
 
-  /* The only constants that cannot safely be deferred, assuming the
-     context allows it, are strings under flag_writable_strings.  */
-  if (defer && (TREE_CODE (exp) != STRING_CST || !flag_writable_strings))
+  /* We can always defer constants as long as the context allows
+     doing so.  */
+  if (defer)
     {
       /* Increment n_deferred_constants if it exists.  It needs to be at
         least as large as the number of constants actually referred to
@@ -4486,7 +4472,7 @@ default_select_section (tree decl, int reloc,
        readonly = true;
     }
   else if (TREE_CODE (decl) == STRING_CST)
-    readonly = !flag_writable_strings;
+    readonly = true;
   else if (! (flag_pic && reloc))
     readonly = true;
 
@@ -4544,12 +4530,7 @@ categorize_decl_for_section (tree decl, int reloc, int shlib)
   if (TREE_CODE (decl) == FUNCTION_DECL)
     return SECCAT_TEXT;
   else if (TREE_CODE (decl) == STRING_CST)
-    {
-      if (flag_writable_strings)
-       return SECCAT_DATA;
-      else
-       return SECCAT_RODATA_MERGE_STR;
-    }
+    return SECCAT_RODATA_MERGE_STR;
   else if (TREE_CODE (decl) == VAR_DECL)
     {
       if (DECL_INITIAL (decl) == NULL