diff options
author | Eric Botcazou <ebotcazou@libertysurf.fr> | 2004-12-18 22:49:55 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2004-12-18 21:49:55 +0000 |
commit | 64270ab0561fce7eaa80684e0c71ee8184fbcf87 (patch) | |
tree | f12c29f73b3cb8794ea74aeb7771e9fe58367147 | |
parent | 36f5ada19abb481dff1a9e973f20e4dc77b8b979 (diff) | |
download | gcc-64270ab0561fce7eaa80684e0c71ee8184fbcf87.zip gcc-64270ab0561fce7eaa80684e0c71ee8184fbcf87.tar.gz gcc-64270ab0561fce7eaa80684e0c71ee8184fbcf87.tar.bz2 |
re PR middle-end/15486 (-fdata-sections moves common vars to .bss)
PR middle-end/15486
* varasm.c (asm_emit_uninitialised): Return early if
a custom section is requested.
(assemble_variable): Revert 2002-03-15 patch.
From-SVN: r92365
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/fdata-sections-1.c | 9 | ||||
-rw-r--r-- | gcc/varasm.c | 29 |
4 files changed, 38 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6851c9..e72b847 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-12-18 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR middle-end/15486 + * varasm.c (asm_emit_uninitialised): Return early if + a custom section is requested. + (assemble_variable): Revert 2002-03-15 patch. + 2004-12-18 Richard Henderson <rth@redhat.com> * stor-layout.c (layout_decl): Use unshare_expr, not unsave_expr. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5380e99..ab2a082 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-12-18 Eric Botcazou <ebotcazou@libertysurf.fr> + + * gcc.dg/fdata-sections-1.c: New test. + 2004-12-18 Roger Sayle <roger@eyesopen.com> PR middle-end/18548 diff --git a/gcc/testsuite/gcc.dg/fdata-sections-1.c b/gcc/testsuite/gcc.dg/fdata-sections-1.c new file mode 100644 index 0000000..d2b2b58 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fdata-sections-1.c @@ -0,0 +1,9 @@ +/* PR middle-end/15486 */ +/* Origin: Jonathan Larmour <jifl-bugzilla@jifvik.org> */ + +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-fdata-sections" } */ + +int x; + +/* { dg-final { scan-assembler "comm" } } */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 078959f..e6d018c 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1442,9 +1442,16 @@ asm_emit_uninitialised (tree decl, const char *name, destination = asm_dest_common; } + if (destination != asm_dest_common) + { + resolve_unique_section (decl, 0, flag_data_sections); + /* Custom sections don't belong here. */ + if (DECL_SECTION_NAME (decl)) + return false; + } + if (destination == asm_dest_bss) globalize_decl (decl); - resolve_unique_section (decl, 0, flag_data_sections); if (flag_shared_data) { @@ -1625,16 +1632,6 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, if (DECL_PRESERVE_P (decl)) targetm.asm_out.mark_decl_preserved (name); - /* 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 = compute_reloc_for_constant (DECL_INITIAL (decl)); - output_addressed_constants (DECL_INITIAL (decl)); - } - resolve_unique_section (decl, reloc, flag_data_sections); - /* Handle uninitialized definitions. */ /* If the decl has been given an explicit section name, then it @@ -1688,7 +1685,17 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, 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 = compute_reloc_for_constant (DECL_INITIAL (decl)); + output_addressed_constants (DECL_INITIAL (decl)); + } + /* Switch to the appropriate section. */ + resolve_unique_section (decl, reloc, flag_data_sections); variable_section (decl, reloc); /* dbxout.c needs to know this. */ |