Commit 0bcc6fc7 by Richard Kenner

(make_decl_rtl,assemble_variable): Allow named sections for

uninitialized variables.

From-SVN: r13053
parent 5507b94b
...@@ -706,23 +706,13 @@ make_decl_rtl (decl, asmspec, top_level) ...@@ -706,23 +706,13 @@ make_decl_rtl (decl, asmspec, top_level)
globalize_reg (reg_number + --nregs); globalize_reg (reg_number + --nregs);
} }
} }
/* Specifying a section attribute on an uninitialized variable does not /* Specifying a section attribute on a variable forces it into a
(and cannot) cause it to be put in the given section. The linker non-.bss section, and thus it cannot be common. */
can only put initialized objects in specific sections, everything
else goes in bss for the linker to sort out later (otherwise the
linker would give a duplicate definition error for each compilation
unit that behaved thusly). So warn the user. */
else if (TREE_CODE (decl) == VAR_DECL else if (TREE_CODE (decl) == VAR_DECL
&& DECL_SECTION_NAME (decl) != NULL_TREE && DECL_SECTION_NAME (decl) != NULL_TREE
&& DECL_INITIAL (decl) == NULL_TREE && DECL_INITIAL (decl) == NULL_TREE
&& DECL_COMMON (decl)) && DECL_COMMON (decl))
{ DECL_COMMON (decl) = 0;
warning_with_decl (decl,
"section attribute ignored for uninitialized variable `%s'");
/* Remove the section name so subsequent declarations won't see it.
We are ignoring it, remember. */
DECL_SECTION_NAME (decl) = NULL_TREE;
}
/* Now handle ordinary static variables and functions (in memory). /* Now handle ordinary static variables and functions (in memory).
Also handle vars declared register invalidly. */ Also handle vars declared register invalidly. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment