From: Daniel Jacobowitz Date: Wed, 2 Aug 2006 13:31:56 +0000 (+0000) Subject: re PR debug/28063 (Dwarf no longer uses merged strings for DW_AT_comp_dir) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19450f2b21f7f5ecaae61060aa45fbf9ee138afe;p=gcc.git re PR debug/28063 (Dwarf no longer uses merged strings for DW_AT_comp_dir) gcc/ PR debug/28063 * dwarf2out.c (prune_unused_types_prune): Move call to prune_unused_types_update_strings to cover the parent DIE also. gcc/testuite/ PR debug/28063 * gcc.dg/debug/dwarf2/dwarf-merge.c: New test. * lib/target-supports.exp (get_compiler_messages): Add WANT_OUTPUT. Optionally return assembly text. Update callers. (check_no_compiler_messages): Update verbose messages. (check_no_messages_and_pattern): New. (check_effective_target_string_merging): New. From-SVN: r115874 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af8165e13cf..3688cbdec8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-08-02 Daniel Jacobowitz + + PR debug/28063 + * dwarf2out.c (prune_unused_types_prune): Move call to + prune_unused_types_update_strings to cover the parent DIE also. + 2006-08-02 Jan Hubicka PR gcov/profile/28480 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 41aa5ace0cb..acec8863be1 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -14044,6 +14044,7 @@ prune_unused_types_prune (dw_die_ref die) dw_die_ref c; gcc_assert (die->die_mark); + prune_unused_types_update_strings (die); if (! die->die_child) return; @@ -14068,7 +14069,6 @@ prune_unused_types_prune (dw_die_ref die) if (c != prev->die_sib) prev->die_sib = c; - prune_unused_types_update_strings (c); prune_unused_types_prune (c); } while (c != die->die_child); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48701d0b781..8aa4e1a1778 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2006-08-02 Daniel Jacobowitz + + PR debug/28063 + * gcc.dg/debug/dwarf2/dwarf-merge.c: New test. + * lib/target-supports.exp (get_compiler_messages): Add WANT_OUTPUT. + Optionally return assembly text. Update callers. + (check_no_compiler_messages): Update verbose messages. + (check_no_messages_and_pattern): New. + (check_effective_target_string_merging): New. + 2006-08-01 Volker Reichelt PR c++/28250 diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c new file mode 100644 index 00000000000..767d38b173b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-merge.c @@ -0,0 +1,10 @@ +/* Verify that mergeable strings are used in the CU DIE. */ +/* { dg-do compile } */ +/* { dg-require-effective-target string_merging } */ +/* { dg-options "-O2 -gdwarf-2 -dA" } */ +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" } } */ +/* { dg-final { scan-assembler-not "GNU C\[^\\n\\r\]*DW_AT_producer" } } */ + +void func (void) +{ +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index cd00b14f31f..57cfa7fdde8 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -20,14 +20,20 @@ # This file defines procs for determining features supported by the target. -# Try to compile some code and return the messages printed by the compiler. +# Try to compile some code and return the messages printed by the compiler, +# and optionally the contents for assembly files. Either a string or +# a list of two strings are returned, depending on WANT_OUTPUT. # # BASENAME is a basename to use for temporary files. +# WANT_OUTPUT is a flag which is 0 to request returning just the +# compiler messages, or 1 to return the messages and the contents +# of the assembly file. TYPE should be "assembly" if WANT_OUTPUT +# is set. # TYPE is the type of compilation to perform (see target_compile). # CONTENTS gives the contents of the input file. # The rest is optional: # OPTIONS: additional compiler options to use. -proc get_compiler_messages {basename type contents args} { +proc get_compiler_messages {basename want_output type contents args} { global tool if { [llength $args] > 0 } { @@ -46,9 +52,28 @@ proc get_compiler_messages {basename type contents args} { close $f set lines [${tool}_target_compile $src $output $type "$options"] file delete $src - remote_file build delete $output - return $lines + if { $want_output } { + if { $type != "assembly" } { + error "WANT_OUTPUT can only be used with assembly output" + } elseif { ![string match "" $lines] } { + # An error occurred. + set result [list $lines ""] + } else { + set text "" + set chan [open "$output"] + while {[gets $chan line] >= 0} { + append text "$line\n" + } + close $chan + set result [list $lines $text] + } + } else { + set result $lines + } + + remote_file build delete $output + return $result } proc current_target_name { } { @@ -71,13 +96,33 @@ proc check_no_compiler_messages {prop args} { set target [current_target_name] if {![info exists et_cache($prop,target)] || $et_cache($prop,target) != $target} { - verbose "check_effective_target $prop: compiling source for $target" 2 + verbose "check_no_compiler_messages $prop: compiling source for $target" 2 + set et_cache($prop,target) $target + set et_cache($prop,value) \ + [string match "" [eval get_compiler_messages $prop 0 $args]] + } + set value $et_cache($prop,value) + verbose "check_no_compiler_messages $prop: returning $value for $target" 2 + return $value +} + +# Similar to check_no_compiler_messages, but also verify that the regular +# expression PATTERN matches the compiler's output. +proc check_no_messages_and_pattern {prop pattern args} { + global et_cache + + set target [current_target_name] + if {![info exists et_cache($prop,target)] + || $et_cache($prop,target) != $target} { + verbose "check_no_messages_and_pattern $prop: compiling source for $target" 2 set et_cache($prop,target) $target + set results [eval get_compiler_messages $prop 1 $args] set et_cache($prop,value) \ - [string match "" [eval get_compiler_messages $prop $args]] + [expr [string match "" [lindex $results 0]] \ + && [regexp $pattern [lindex $results 1]]] } set value $et_cache($prop,value) - verbose "check_effective_target $prop: returning $value for $target" 2 + verbose "check_no_messages_and_pattern $prop: returning $value for $target" 2 return $value } @@ -1074,7 +1119,7 @@ proc check_effective_target_lp64 { } { proc check_effective_target_dfp_nocache { } { verbose "check_effective_target_dfp_nocache: compiling source" 2 - set ret [string match "" [get_compiler_messages dfp object { + set ret [string match "" [get_compiler_messages dfp 0 object { _Decimal32 x; _Decimal64 y; _Decimal128 z; }]] verbose "check_effective_target_dfp_nocache: returning $ret" 2 @@ -1783,3 +1828,11 @@ proc check_effective_target_short_enums { } { }] } +# Return 1 if target supports merging string constants at link time. + +proc check_effective_target_string_merging { } { + return [check_no_messages_and_pattern string_merging \ + "rodata\\.str" assembly { + const char *var = "String"; + } {-O2}] +}