Maninder Singh <maninder1.s at samsung dot com> changed:

           What    |Removed                     |Added
                 CC|                            |maninder1.s at samsung dot com

--- Comment #1 from Maninder Singh <maninder1.s at samsung dot com> ---
Fixing [#89347] gc-sections doesn't remove unused bss section variables.

gc-section works well only for bss section if global variables initialised
with 0 explicitly and not with uninitalised one.
Reason is -fdata-sections does not make separate section for bss symbols
which are not initialised with 0 explicitly.
due to which gc-section does not remove bss symbols which are not
getting used in binary.

Signed-off-by: Vaneet Narang <>
Signed-off-by: Maninder Singh <>
 gcc/varasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/varasm.c b/gcc/varasm.c
index 0be44f1..1f68c3a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1164,7 +1164,7 @@ get_variable_section (tree decl, bool prefer_noswitch_p)
                  && ADDR_SPACE_GENERIC_P (as));
       if (DECL_THREAD_LOCAL_P (decl))
        return tls_comm_section;
-      else if (TREE_PUBLIC (decl) && bss_initializer_p (decl))
+      else if (TREE_PUBLIC (decl) && bss_initializer_p (decl) &&
        return comm_section;


Reply via email to