]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dbxout.c (dbxout_symbol_location): Resolve constant pool references even for variable...
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 27 Jan 2005 02:02:06 +0000 (02:02 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Thu, 27 Jan 2005 02:02:06 +0000 (02:02 +0000)
ChangeLog:
* dbxout.c (dbxout_symbol_location): Resolve constant pool references
even for variables with NULL DECL_INITIAL.

testsuite/ChangeLog:
* gcc.dg/20041216-1.c: New test.

From-SVN: r94305

gcc/ChangeLog
gcc/dbxout.c
gcc/testsuite/ChangeLog

index 18f766416c6e5cd564cff5aab4b07d8cdaa70bf7..b489880b9025474a06dfe5a241a5abd35d74fc77 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-26  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       Backport from mainline:
+       * dbxout.c (dbxout_symbol_location): Resolve constant pool references
+       even for variables with NULL DECL_INITIAL.
+
 2005-01-25  Richard Earnshaw  <rearnsha@arm.com>
 
        PR target/19393
index 99a9def8a40728cfcc790dc3448fa98e5d22a305..b12ea5cbf329d25c10fbe8b84179932d796e64fc 100644 (file)
@@ -2447,6 +2447,37 @@ dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
 
          letter = decl_function_context (decl) ? 'V' : 'S';
 
+         /* Some ports can transform a symbol ref into a label ref,
+            because the symbol ref is too far away and has to be
+            dumped into a constant pool.  Alternatively, the symbol
+            in the constant pool might be referenced by a different
+            symbol.  */
+         if (GET_CODE (current_sym_addr) == SYMBOL_REF
+             && CONSTANT_POOL_ADDRESS_P (current_sym_addr))
+           {
+             bool marked;
+             rtx tmp = get_pool_constant_mark (current_sym_addr, &marked);
+
+             if (GET_CODE (tmp) == SYMBOL_REF)
+               {
+                 current_sym_addr = tmp;
+                 if (CONSTANT_POOL_ADDRESS_P (current_sym_addr))
+                   get_pool_constant_mark (current_sym_addr, &marked);
+                 else
+                   marked = true;
+               }
+             else if (GET_CODE (tmp) == LABEL_REF)
+               {
+                 current_sym_addr = tmp;
+                 marked = true;
+               }
+
+             /* If all references to the constant pool were optimized
+                out, we just ignore the symbol.  */
+             if (!marked)
+               return 0;
+           }
+
          /* This should be the same condition as in assemble_variable, but
             we don't have access to dont_output_data here.  So, instead,
             we rely on the fact that error_mark_node initializers always
@@ -2461,37 +2492,6 @@ dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
            current_sym_code = DBX_STATIC_CONST_VAR_CODE;
          else
            {
-             /* Some ports can transform a symbol ref into a label ref,
-                because the symbol ref is too far away and has to be
-                dumped into a constant pool.  Alternatively, the symbol
-                in the constant pool might be referenced by a different
-                symbol.  */
-             if (GET_CODE (current_sym_addr) == SYMBOL_REF
-                 && CONSTANT_POOL_ADDRESS_P (current_sym_addr))
-               {
-                 bool marked;
-                 rtx tmp = get_pool_constant_mark (current_sym_addr, &marked);
-
-                 if (GET_CODE (tmp) == SYMBOL_REF)
-                   {
-                     current_sym_addr = tmp;
-                     if (CONSTANT_POOL_ADDRESS_P (current_sym_addr))
-                       get_pool_constant_mark (current_sym_addr, &marked);
-                     else
-                       marked = true;
-                   }
-                 else if (GET_CODE (tmp) == LABEL_REF)
-                   {
-                     current_sym_addr = tmp;
-                     marked = true;
-                   }
-
-                  /* If all references to the constant pool were optimized
-                     out, we just ignore the symbol.  */
-                 if (!marked)
-                   return 0;
-               }
-
              /* Ultrix `as' seems to need this.  */
 #ifdef DBX_STATIC_STAB_DATA_SECTION
              data_section ();
index 29042b42ccad92d737d88cbb312841189be9ffda..a923a6a7fbbfa9e986af7d753d6c454cc6cfb04f 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-26  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       Backport from mainline:
+       * gcc.dg/20041216-1.c: New test.
+
 2005-01-24  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.c-torture/compile/20050113-1.c: XFAIL on SPARC.