OSDN Git Service

PR target/33120
[pf3gnuchains/gcc-fork.git] / gcc / config / darwin.c
index 93f7bab..7794c10 100644 (file)
@@ -1460,8 +1460,9 @@ darwin_asm_named_section (const char *name,
       obstack_grow (&lto_section_names_obstack, "\\0\"\n", 4);
 
       /* Output the dummy section name.  */
-      fprintf (asm_out_file, "\t.section %s,__%08X,regular,debug\t# %s\n",
-              LTO_SEGMENT_NAME, lto_section_names_offset, name);
+      fprintf (asm_out_file, "\t# %s\n", name);
+      fprintf (asm_out_file, "\t.section %s,__%08X,regular,debug\n",
+              LTO_SEGMENT_NAME, lto_section_names_offset);
 
       /* Update the offset for the next section name.  Make sure we stay
         within reasonable length.  */  
@@ -1916,5 +1917,41 @@ darwin_patch_builtins (void)
 #undef PATCH_BUILTIN_VARIADIC
 }
 
+void
+darwin_output_aligned_bss(FILE *fp, tree decl, const char *name,
+                         unsigned HOST_WIDE_INT size, unsigned int align)
+{
+  bool weak = (DECL_P (decl)
+              && DECL_WEAK (decl)
+              && !lookup_attribute ("weak_import",
+                                    DECL_ATTRIBUTES (decl)));
+  if (size == 0)
+    size = 1;
+  align = floor_log2 (align / BITS_PER_UNIT);
+  if (DECL_ONE_ONLY (decl) || weak) {
+    if (TREE_READONLY (decl) || TREE_CONSTANT (decl))
+      switch_to_section (darwin_sections[const_data_coal_section]);
+    else
+      switch_to_section (darwin_sections[data_coal_section]);
+    ASM_OUTPUT_ALIGN (fp, align);
+    ASM_DECLARE_OBJECT_NAME (fp, name, decl);
+    ASM_OUTPUT_SKIP (fp, size);
+    return;
+  }
+
+  fputs (".zerofill ", fp);
+  /* We uniquely name sections based upon the alignment as otherwise
+     all symbols in the section would get that alignment.  */
+  if (TREE_READONLY (decl) || TREE_CONSTANT (decl))
+    fputs ("__TEXT, ", fp);
+  else
+    fputs ("__DATA, ", fp);
+  fprintf (fp, "__bss%d, ", align);
+  assemble_name (fp, name);
+  fprintf (fp, ", "HOST_WIDE_INT_PRINT_UNSIGNED", %u\n",
+          size, align);
+  (* targetm.encode_section_info) (decl, DECL_RTL (decl), false);
+  machopic_define_symbol (DECL_RTL (decl));
+}
 
 #include "gt-darwin.h"