97 lines
4.1 KiB
Diff
97 lines
4.1 KiB
Diff
|
2009-12-15 Jakub Jelinek <jakub@redhat.com>
|
||
|
|
||
|
* dwarf2out.c (loc_descriptor): For SYMBOL_REFs and LABEL_REFs
|
||
|
use DW_OP_addr+DW_OP_stack_value instead of DW_OP_implicit_value.
|
||
|
(add_const_value_attribute): For CONST_STRING, SYMBOL_REFs and
|
||
|
LABEL_REFs use DW_OP_addr+DW_OP_stack_value DW_AT_location instead of
|
||
|
DW_AT_const_value.
|
||
|
|
||
|
* gcc.dg/debug/dwarf2/const-1.c: Don't expect DW_AT_const_value,
|
||
|
but instead DW_AT_location with DW_OP_addr+DW_OP_stack_value. Add
|
||
|
-gno-strict-dwarf -fno-merge-debug-strings to dg-options.
|
||
|
* g++.dg/debug/dwarf2/const1.C: Likewise.
|
||
|
|
||
|
--- gcc/dwarf2out.c.jj 2009-12-14 17:55:28.000000000 +0100
|
||
|
+++ gcc/dwarf2out.c 2009-12-14 22:33:32.000000000 +0100
|
||
|
@@ -13775,10 +13775,10 @@ loc_descriptor (rtx rtl, enum machine_mo
|
||
|
if (mode != VOIDmode && GET_MODE_SIZE (mode) == DWARF2_ADDR_SIZE
|
||
|
&& (dwarf_version >= 4 || !dwarf_strict))
|
||
|
{
|
||
|
- loc_result = new_loc_descr (DW_OP_implicit_value,
|
||
|
- DWARF2_ADDR_SIZE, 0);
|
||
|
- loc_result->dw_loc_oprnd2.val_class = dw_val_class_addr;
|
||
|
- loc_result->dw_loc_oprnd2.v.val_addr = rtl;
|
||
|
+ loc_result = new_loc_descr (DW_OP_addr, 0, 0);
|
||
|
+ loc_result->dw_loc_oprnd1.val_class = dw_val_class_addr;
|
||
|
+ loc_result->dw_loc_oprnd1.v.val_addr = rtl;
|
||
|
+ add_loc_descr (&loc_result, new_loc_descr (DW_OP_stack_value, 0, 0));
|
||
|
VEC_safe_push (rtx, gc, used_rtx_array, rtl);
|
||
|
}
|
||
|
break;
|
||
|
@@ -15223,10 +15223,20 @@ add_const_value_attribute (dw_die_ref di
|
||
|
return true;
|
||
|
|
||
|
case CONST_STRING:
|
||
|
- resolve_one_addr (&rtl, NULL);
|
||
|
- add_AT_addr (die, DW_AT_const_value, rtl);
|
||
|
- VEC_safe_push (rtx, gc, used_rtx_array, rtl);
|
||
|
- return true;
|
||
|
+ if (dwarf_version >= 4 || !dwarf_strict)
|
||
|
+ {
|
||
|
+ dw_loc_descr_ref loc_result;
|
||
|
+ resolve_one_addr (&rtl, NULL);
|
||
|
+ rtl_addr:
|
||
|
+ loc_result = new_loc_descr (DW_OP_addr, 0, 0);
|
||
|
+ loc_result->dw_loc_oprnd1.val_class = dw_val_class_addr;
|
||
|
+ loc_result->dw_loc_oprnd1.v.val_addr = rtl;
|
||
|
+ add_loc_descr (&loc_result, new_loc_descr (DW_OP_stack_value, 0, 0));
|
||
|
+ add_AT_loc (die, DW_AT_location, loc_result);
|
||
|
+ VEC_safe_push (rtx, gc, used_rtx_array, rtl);
|
||
|
+ return true;
|
||
|
+ }
|
||
|
+ return false;
|
||
|
|
||
|
case CONST:
|
||
|
if (CONSTANT_P (XEXP (rtl, 0)))
|
||
|
@@ -15236,9 +15246,9 @@ add_const_value_attribute (dw_die_ref di
|
||
|
if (!const_ok_for_output (rtl))
|
||
|
return false;
|
||
|
case LABEL_REF:
|
||
|
- add_AT_addr (die, DW_AT_const_value, rtl);
|
||
|
- VEC_safe_push (rtx, gc, used_rtx_array, rtl);
|
||
|
- return true;
|
||
|
+ if (dwarf_version >= 4 || !dwarf_strict)
|
||
|
+ goto rtl_addr;
|
||
|
+ return false;
|
||
|
|
||
|
case PLUS:
|
||
|
/* In cases where an inlined instance of an inline function is passed
|
||
|
--- gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c.jj 2009-09-30 12:19:16.000000000 +0200
|
||
|
+++ gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c 2009-12-15 10:57:48.000000000 +0100
|
||
|
@@ -1,7 +1,7 @@
|
||
|
/* { dg-do compile } */
|
||
|
-/* { dg-options "-O -gdwarf-2 -dA" } */
|
||
|
+/* { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-merge-debug-strings" } */
|
||
|
/* { dg-require-visibility "" } */
|
||
|
-/* { dg-final { scan-assembler "DW_AT_const_value" } } */
|
||
|
+/* { dg-final { scan-assembler "DW_AT_location\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_addr\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*fnx\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_stack_value" } } */
|
||
|
|
||
|
-extern void x() __attribute__((visibility("hidden")));
|
||
|
-static void (*f)() = x;
|
||
|
+extern void fnx() __attribute__((visibility("hidden")));
|
||
|
+static void (*f)() = fnx;
|
||
|
--- gcc/testsuite/g++.dg/debug/dwarf2/const1.C.jj 2009-09-30 12:19:16.000000000 +0200
|
||
|
+++ gcc/testsuite/g++.dg/debug/dwarf2/const1.C 2009-12-15 11:02:24.000000000 +0100
|
||
|
@@ -1,7 +1,7 @@
|
||
|
/* { dg-do compile } */
|
||
|
-/* { dg-options "-O -gdwarf-2 -dA" } */
|
||
|
+/* { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-merge-debug-strings" } */
|
||
|
/* { dg-require-visibility "" } */
|
||
|
-/* { dg-final { scan-assembler "DW_AT_const_value" } } */
|
||
|
+/* { dg-final { scan-assembler "DW_AT_location\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_addr\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*fnx\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_stack_value" } } */
|
||
|
|
||
|
-extern void x () __attribute__((visibility ("hidden")));
|
||
|
-void (* const f) () = x;
|
||
|
+extern void fnx () __attribute__((visibility ("hidden")));
|
||
|
+void (* const f) () = fnx;
|