aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-02-09 06:47:24 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-02-09 06:47:24 +0100
commitebd06e5ca705e69711eb58277b6f820132bb7b67 (patch)
tree4b0528d68555212c7996fffdc4ae21b6d20e1c9a /gcc/varasm.c
parentebe4bf41d2b96a6b2f1de6a184eb0a7f5c2e5d00 (diff)
downloadgcc-ebd06e5ca705e69711eb58277b6f820132bb7b67.zip
gcc-ebd06e5ca705e69711eb58277b6f820132bb7b67.tar.gz
gcc-ebd06e5ca705e69711eb58277b6f820132bb7b67.tar.bz2
re PR middle-end/84237 (xen build faiulre only zero initializers are allowed in section '.bss.page_aligned.const')
PR middle-end/84237 * output.h (bss_initializer_p): Add NAMED argument, defaulted to false. * varasm.c (bss_initializer_p): Add NAMED argument, if true, ignore TREE_READONLY bit. (get_variable_section): For decls in named .bss* sections pass true as second argument to bss_initializer_p. * gcc.dg/pr84237.c: New test. From-SVN: r257513
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b045efa..6e345d3 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -983,11 +983,11 @@ decode_reg_name (const char *name)
/* Return true if DECL's initializer is suitable for a BSS section. */
bool
-bss_initializer_p (const_tree decl)
+bss_initializer_p (const_tree decl, bool named)
{
/* Do not put non-common constants into the .bss section, they belong in
- a readonly section. */
- return ((!TREE_READONLY (decl) || DECL_COMMON (decl))
+ a readonly section, except when NAMED is true. */
+ return ((!TREE_READONLY (decl) || DECL_COMMON (decl) || named)
&& (DECL_INITIAL (decl) == NULL
/* In LTO we have no errors in program; error_mark_node is used
to mark offlined constructors. */
@@ -1165,7 +1165,8 @@ get_variable_section (tree decl, bool prefer_noswitch_p)
{
section *sect = get_named_section (decl, NULL, reloc);
- if ((sect->common.flags & SECTION_BSS) && !bss_initializer_p (decl))
+ if ((sect->common.flags & SECTION_BSS)
+ && !bss_initializer_p (decl, true))
{
error_at (DECL_SOURCE_LOCATION (decl),
"only zero initializers are allowed in section %qs",