diff options
author | Jan Beulich <jbeulich@novell.com> | 2004-07-08 06:26:08 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-07-07 23:26:08 -0700 |
commit | 08a8c6b65b22e0c125c1bd8fcc5428f72b262ca0 (patch) | |
tree | 7e47b63aa99ca958a19cf2db7272dd7e69da0513 /gcc/varasm.c | |
parent | 78a47b1d2e0d7fc33dad3866446e5ddc2097e567 (diff) | |
download | gcc-08a8c6b65b22e0c125c1bd8fcc5428f72b262ca0.zip gcc-08a8c6b65b22e0c125c1bd8fcc5428f72b262ca0.tar.gz gcc-08a8c6b65b22e0c125c1bd8fcc5428f72b262ca0.tar.bz2 |
varasm.c (assemble_variable): Use assemble_zeros for zero-initialized variables.
* varasm.c (assemble_variable): Use assemble_zeros for
zero-initialized variables.
(categorize_decl_for_section): Honor flag_zero_initialized_in_bss
for SECCAT_BSS and SECCAT_TBSS.
Co-Authored-By: Richard Henderson <rth@redhat.com>
From-SVN: r84271
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 65875e5..37a7a7c 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1563,7 +1563,9 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, 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), @@ -4611,7 +4613,11 @@ categorize_decl_for_section (tree decl, int reloc, int shlib) else if (TREE_CODE (decl) == VAR_DECL) { if (DECL_INITIAL (decl) == NULL - || DECL_INITIAL (decl) == error_mark_node) + || DECL_INITIAL (decl) == error_mark_node + || (flag_zero_initialized_in_bss + /* Leave constant zeroes in .rodata so they can be shared. */ + && !TREE_READONLY (decl) + && initializer_zerop (DECL_INITIAL (decl)))) ret = SECCAT_BSS; else if (! TREE_READONLY (decl) || TREE_SIDE_EFFECTS (decl) @@ -4653,7 +4659,11 @@ categorize_decl_for_section (tree decl, int reloc, int shlib) /* There are no read-only thread-local sections. */ if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) { - if (ret == SECCAT_BSS) + /* Note that this would be *just* SECCAT_BSS, except that there's + no concept of a read-only thread-local-data section. */ + if (ret == SECCAT_BSS + || (flag_zero_initialized_in_bss + && initializer_zerop (DECL_INITIAL (decl)))) ret = SECCAT_TBSS; else ret = SECCAT_TDATA; |