aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index de8bcd6..6a8fb81 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1150,7 +1150,18 @@ get_variable_section (tree decl, bool prefer_noswitch_p)
resolve_unique_section (decl, reloc, flag_data_sections);
if (IN_NAMED_SECTION (decl))
- return get_named_section (decl, NULL, reloc);
+ {
+ section *sect = get_named_section (decl, NULL, reloc);
+
+ if ((sect->common.flags & SECTION_BSS) && !bss_initializer_p (decl))
+ {
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "only zero initializers are allowed in section %qs",
+ sect->named.name);
+ DECL_INITIAL (decl) = error_mark_node;
+ }
+ return sect;
+ }
if (ADDR_SPACE_GENERIC_P (as)
&& !DECL_THREAD_LOCAL_P (decl)