Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Fix Bug 139 - writes all-zero initialisers in the rodata section
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jul 12, 2014
1 parent 28d9830 commit 0fcf8ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-07-12 Iain Buclaw <ibuclaw@gdcproject.org>

* d-objfile.cc(d_finish_symbol): Don't set DECL_INITIAL if the
initialiser is all zeros.

2014-07-10 Iain Buclaw <ibuclaw@gdcproject.org>

* d-builtins.cc(lookup_ctype_name): Remove function.
Expand Down
5 changes: 4 additions & 1 deletion gcc/d/d-objfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,10 @@ d_finish_symbol (Symbol *sym)
TYPE_NAME (TREE_TYPE (decl)) = get_identifier (sym->Sident);
}

DECL_INITIAL (decl) = sinit;
// No gain setting DECL_INITIAL if the initialiser is all zeros.
// Let the backend put the symbol in bss instead, if supported.
if (!initializer_zerop (sinit))
DECL_INITIAL (decl) = sinit;
}
gcc_assert (COMPLETE_TYPE_P (TREE_TYPE (decl)));
}
Expand Down

0 comments on commit 0fcf8ba

Please sign in to comment.