This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

put zero-initialized thread local variables in .tbss


bootstrapped and tested on x86_64-unknown-linux-gnu.

2004-07-07 Jan Beulich <jbeulich@novell.com>

	* varasm.c (assemble_variable): Use assemble_zeros for
	zero-initialized variables.
	(categorize_decl_for_section): Transform SECCAT_BSS into
	SECCAT_TBSS also for zero-initialized thread local variables.

---
/home/jbeulich/src/gcc/mainline/2004-07-05.10.09/gcc/varasm.c	2004-07-02
15:14:19.000000000 +0200
+++ 2004-07-05.10.09/gcc/varasm.c	2004-07-06 17:18:47.116409536
+0200
@@ -135,11 +135,11 @@
 static void maybe_assemble_visibility (tree);
 static int in_named_entry_eq (const void *, const void *);
 static hashval_t in_named_entry_hash (const void *);
+#ifdef BSS_SECTION_ASM_OP
 #ifdef ASM_OUTPUT_BSS
 static void asm_output_bss (FILE *, tree, const char *,
 			    unsigned HOST_WIDE_INT, unsigned
HOST_WIDE_INT);
 #endif
-#ifdef BSS_SECTION_ASM_OP
 #ifdef ASM_OUTPUT_ALIGNED_BSS
 static void asm_output_aligned_bss (FILE *, tree, const char *,
 				    unsigned HOST_WIDE_INT, int)
@@ -1563,7 +1563,9 @@
 
   if (!dont_output_data)
     {
-      if (DECL_INITIAL (decl) && DECL_INITIAL (decl) !=
error_mark_node)
+      if (DECL_INITIAL (decl)
+	&& DECL_INITIAL (decl) != error_mark_node
+	&& !initializer_zerop (DECL_INITIAL (decl)))
 	/* Output the actual data.  */
 	output_constant (DECL_INITIAL (decl),
 			 tree_low_cst (DECL_SIZE_UNIT (decl), 1),
@@ -4653,7 +4655,9 @@
   /* There are no read-only thread-local sections.  */
   if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
     {
-      if (ret == SECCAT_BSS)
+      if (ret == SECCAT_BSS
+	  || (flag_zero_initialized_in_bss
+	      && initializer_zerop (DECL_INITIAL (decl))))
 	ret = SECCAT_TBSS;
       else
 	ret = SECCAT_TDATA;

Attachment: gcc-mainline-tbss.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]