https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89490

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
funny, how I managed to overlook this...

--- varasm.c.orig       2019-01-25 17:57:32.000000000 +0100
+++ varasm.c    2019-02-25 13:13:55.652051780 +0100
@@ -7634,6 +7634,8 @@

   /* Output the objects themselves.  */
   offset = 0;
+  bool merge_strings = (block->sect->common.flags & SECTION_MERGE)
+                        && (block->sect->common.flags & SECTION_STRINGS);
   FOR_EACH_VEC_ELT (*block->objects, i, symbol)
     {
       /* Move to the object's offset, padding with zeros if necessary.  */
@@ -7652,7 +7654,7 @@
          HOST_WIDE_INT size;
          decl = SYMBOL_REF_DECL (symbol);
          assemble_constant_contents (DECL_INITIAL (decl), XSTR (symbol, 0),
-                                     DECL_ALIGN (decl), false);
+                                     DECL_ALIGN (decl), merge_strings);

          size = get_constant_size (DECL_INITIAL (decl));
          offset += size;
@@ -7669,7 +7671,8 @@
        {
          HOST_WIDE_INT size;
          decl = SYMBOL_REF_DECL (symbol);
-         assemble_variable_contents (decl, XSTR (symbol, 0), false, false);
+         assemble_variable_contents (decl, XSTR (symbol, 0), false,
+                                     merge_strings);
          size = tree_to_uhwi (DECL_SIZE_UNIT (decl));
          offset += size;
          if ((flag_sanitize & SANITIZE_ADDRESS)

Reply via email to