This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to assemble_variable separate section handling
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 15 Mar 2002 18:42:43 +0000
- Subject: PATCH to assemble_variable separate section handling
More fallout from the bss stuff. In addition to weak symbols, we need to
handle variables that go in separate sections for whatever reason. So we
need to set DECL_SECTION_NAME appropriately before we check it.
Having fixed this, I ran into another problem; dynamically-initialized
variables in separate sections have been broken for a while, because
output_constant quite reasonably wasn't emitting anything for an
error_mark_node.
Booted and tested i686-pc-linux-gnu. All applied to trunk; last hunk also
applied to 3.1 branch.
2002-03-15 Jason Merrill <jason@redhat.com>
* varasm.c (assemble_variable): Call resolve_unique_section before
checking DECL_SECTION_NAME. Use zeros for a decl with DECL_INITIAL
of error_mark_node.
*** varasm.c.~1~ Fri Mar 15 10:01:26 2002
--- varasm.c Fri Mar 15 16:14:32 2002
*************** assemble_variable (decl, top_level, at_e
*** 1602,1607 ****
--- 1602,1614 ----
if (TREE_PUBLIC (decl))
maybe_assemble_visibility (decl);
+ /* Output any data that we will need to use the address of. */
+ if (DECL_INITIAL (decl) == error_mark_node)
+ reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
+ else if (DECL_INITIAL (decl))
+ reloc = output_addressed_constants (DECL_INITIAL (decl));
+ resolve_unique_section (decl, reloc);
+
/* Handle uninitialized definitions. */
if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node
*************** assemble_variable (decl, top_level, at_e
*** 1652,1665 ****
if (TREE_PUBLIC (decl) && DECL_NAME (decl))
globalize_decl (decl);
- /* Output any data that we will need to use the address of. */
- if (DECL_INITIAL (decl) == error_mark_node)
- reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
- else if (DECL_INITIAL (decl))
- reloc = output_addressed_constants (DECL_INITIAL (decl));
-
/* Switch to the appropriate section. */
- resolve_unique_section (decl, reloc);
variable_section (decl, reloc);
/* dbxout.c needs to know this. */
--- 1659,1665 ----
*************** assemble_variable (decl, top_level, at_e
*** 1684,1690 ****
if (!dont_output_data)
{
! if (DECL_INITIAL (decl))
/* Output the actual data. */
output_constant (DECL_INITIAL (decl),
tree_low_cst (DECL_SIZE_UNIT (decl), 1),
--- 1684,1690 ----
if (!dont_output_data)
{
! if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node)
/* Output the actual data. */
output_constant (DECL_INITIAL (decl),
tree_low_cst (DECL_SIZE_UNIT (decl), 1),