aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-07-18 06:07:02 +0000
committerRichard Stallman <rms@gnu.org>1993-07-18 06:07:02 +0000
commitedbc355b88bb2e18409a5a7dde52d5fd779c3d1c (patch)
tree6612423dd6cb288711af708ec2dc0f28600a546c /gcc
parentcadcc1c11cb6301b68fa28fbc98cca85bcfdf8cf (diff)
downloadgcc-edbc355b88bb2e18409a5a7dde52d5fd779c3d1c.zip
gcc-edbc355b88bb2e18409a5a7dde52d5fd779c3d1c.tar.gz
gcc-edbc355b88bb2e18409a5a7dde52d5fd779c3d1c.tar.bz2
(assemble_variable): Move debugging output calls to after section has been selected.
(assemble_variable): Move debugging output calls to after section has been selected. Select the section again if the debugging output call changes the section. From-SVN: r4934
Diffstat (limited to 'gcc')
-rw-r--r--gcc/varasm.c85
1 files changed, 64 insertions, 21 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 67666c7..2938ea7 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -705,6 +705,7 @@ assemble_variable (decl, top_level, at_end)
int align;
tree size_tree;
int reloc = 0;
+ enum in_section saved_in_section;
if (GET_CODE (DECL_RTL (decl)) == REG)
{
@@ -781,27 +782,6 @@ assemble_variable (decl, top_level, at_end)
TREE_ASM_WRITTEN (decl) = 1;
-#ifdef DBX_DEBUGGING_INFO
- /* File-scope global variables are output here. */
- if (write_symbols == DBX_DEBUG && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
/* If storage size is erroneously variable, just continue.
Error message was already made. */
@@ -844,6 +824,28 @@ assemble_variable (decl, top_level, at_end)
rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
* (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
+
+#ifdef DBX_DEBUGGING_INFO
+ /* File-scope global variables are output here. */
+ if (write_symbols == DBX_DEBUG && top_level)
+ dbxout_symbol (decl, 0);
+#endif
+#ifdef SDB_DEBUGGING_INFO
+ if (write_symbols == SDB_DEBUG && top_level
+ /* Leave initialized global vars for end of compilation;
+ see comment in compile_file. */
+ && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
+ sdbout_symbol (decl, 0);
+#endif
+
+ /* Don't output any DWARF debugging information for variables here.
+ In the case of local variables, the information for them is output
+ when we do our recursive traversal of the tree representation for
+ the entire containing function. In the case of file-scope variables,
+ we output information for all of them at the very end of compilation
+ while we are doing our final traversal of the chain of file-scope
+ declarations. */
+
#if 0
if (flag_shared_data)
data_section ();
@@ -914,6 +916,47 @@ assemble_variable (decl, top_level, at_end)
data_section ();
#endif
+ /* Record current section so we can restore it if dbxout.c clobbers it. */
+ saved_in_section = in_section;
+
+ /* Output the dbx info now that we have chosen the section. */
+
+#ifdef DBX_DEBUGGING_INFO
+ /* File-scope global variables are output here. */
+ if (write_symbols == DBX_DEBUG && top_level)
+ dbxout_symbol (decl, 0);
+#endif
+#ifdef SDB_DEBUGGING_INFO
+ if (write_symbols == SDB_DEBUG && top_level
+ /* Leave initialized global vars for end of compilation;
+ see comment in compile_file. */
+ && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
+ sdbout_symbol (decl, 0);
+#endif
+
+ /* Don't output any DWARF debugging information for variables here.
+ In the case of local variables, the information for them is output
+ when we do our recursive traversal of the tree representation for
+ the entire containing function. In the case of file-scope variables,
+ we output information for all of them at the very end of compilation
+ while we are doing our final traversal of the chain of file-scope
+ declarations. */
+
+ if (in_section != saved_in_section)
+ {
+ /* Switch to the proper section for this data. */
+#ifdef SELECT_SECTION
+ SELECT_SECTION (decl, reloc);
+#else
+ if (TREE_READONLY (decl)
+ && ! TREE_THIS_VOLATILE (decl)
+ && ! (flag_pic && reloc))
+ readonly_data_section ();
+ else
+ data_section ();
+#endif
+ }
+
/* Compute and output the alignment of this data. */
align = DECL_ALIGN (decl);