* varasm.c (assemble_variable): Handle thread-local COMMON data.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jan 2006 16:19:21 +0000 (16:19 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jan 2006 16:19:21 +0000 (16:19 +0000)
        * defaults.h (ASM_OUTPUT_TLS_COMMON): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109282 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/defaults.h
gcc/varasm.c

index b0aa2ab..d2e57ce 100644 (file)
@@ -1,3 +1,10 @@
+2006-01-03  Jakub Jelinek  <jakub@redhat.com>
+           Richard Henderson  <rth@redhat.com>
+
+       Merge from gomp-branch:
+        * varasm.c (assemble_variable): Handle thread-local COMMON data.
+        * defaults.h (ASM_OUTPUT_TLS_COMMON): Define.
+
 2006-01-03  Paolo Bonzini  <bonzini@gnu.org>
 
        PR rtl-optimization/25578
index eb7733d..1207b7b 100644 (file)
@@ -114,6 +114,18 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #endif
 #endif
 
+#if defined (HAVE_AS_TLS) && !defined (ASM_OUTPUT_TLS_COMMON)
+#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE)                  \
+  do                                                                   \
+    {                                                                  \
+      fprintf ((FILE), "\t.tls_common\t");                             \
+      assemble_name ((FILE), (NAME));                                  \
+      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",         \
+              (SIZE), DECL_ALIGN (DECL) / BITS_PER_UNIT);              \
+    }                                                                  \
+  while (0)
+#endif
+
 /* Decide whether to defer emitting the assembler output for an equate
    of two values.  The default is to not defer output.  */
 #ifndef TARGET_DEFERRED_OUTPUT_DEFS
index eafba6b..5f58bf4 100644 (file)
@@ -1537,11 +1537,20 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
      isn't common, and shouldn't be handled as such.  */
   if (DECL_SECTION_NAME (decl) || dont_output_data)
     ;
-  /* We don't implement common thread-local data at present.  */
   else if (DECL_THREAD_LOCAL_P (decl))
     {
       if (DECL_COMMON (decl))
-       sorry ("thread-local COMMON data not implemented");
+       {
+#ifdef ASM_OUTPUT_TLS_COMMON
+         unsigned HOST_WIDE_INT size;
+
+         size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
+         ASM_OUTPUT_TLS_COMMON (asm_out_file, decl, name, size);
+         return;
+#else
+         sorry ("thread-local COMMON data not implemented");
+#endif
+       }
     }
   else if (DECL_INITIAL (decl) == 0
           || DECL_INITIAL (decl) == error_mark_node