From: Jakub Jelinek Date: Sat, 11 Jul 2009 17:41:59 +0000 (+0200) Subject: re PR debug/40713 (Overlapping .debug_ranges (C++)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e3a9a6ac1608dcafc4ef5c96a8f30c1d5243dc5;p=gcc.git re PR debug/40713 (Overlapping .debug_ranges (C++)) PR debug/40713 * dwarf2out.c (dw_fde_struct): Add in_std_section and cold_in_std_section bits. (dwarf2out_begin_prologue): Initialize them. (dwarf2out_finish): Don't emit FDE range into .debug_ranges if already covered by text_section or cold_text_section range. From-SVN: r149514 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3d298e7ea3..e84fabcd950 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2009-07-11 Jakub Jelinek + PR debug/40713 + * dwarf2out.c (dw_fde_struct): Add in_std_section and + cold_in_std_section bits. + (dwarf2out_begin_prologue): Initialize them. + (dwarf2out_finish): Don't emit FDE range into .debug_ranges + if already covered by text_section or cold_text_section range. + PR rtl-optimization/40667 * defaults.h (MINIMUM_ALIGNMENT): Define if not defined. * doc/tm.texi (MINIMUM_ALIGNMENT): Document it. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index fce8b92e346..f7afc17ef31 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -283,6 +283,11 @@ typedef struct GTY(()) dw_fde_struct { unsigned stack_realign : 1; /* Whether dynamic realign argument pointer register has been saved. */ unsigned drap_reg_saved: 1; + /* True iff dw_fde_begin label is in text_section or cold_text_section. */ + unsigned in_std_section : 1; + /* True iff dw_fde_unlikely_section_label is in text_section or + cold_text_section. */ + unsigned cold_in_std_section : 1; } dw_fde_node; @@ -3587,6 +3592,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, char label[MAX_ARTIFICIAL_LABEL_BYTES]; char * dup_label; dw_fde_ref fde; + section *fnsec; current_function_func_begin_label = NULL; @@ -3602,7 +3608,8 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, return; #endif - switch_to_section (function_section (current_function_decl)); + fnsec = function_section (current_function_decl); + switch_to_section (fnsec); ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL, current_function_funcdef_no); ASM_OUTPUT_DEBUG_LABEL (asm_out_file, FUNC_BEGIN_LABEL, @@ -3646,6 +3653,27 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, fde->all_throwers_are_sibcalls = crtl->all_throwers_are_sibcalls; fde->drap_reg = INVALID_REGNUM; fde->vdrap_reg = INVALID_REGNUM; + if (flag_reorder_blocks_and_partition) + { + section *unlikelysec; + if (first_function_block_is_cold) + fde->in_std_section = 1; + else + fde->in_std_section + = (fnsec == text_section + || (cold_text_section && fnsec == cold_text_section)); + unlikelysec = unlikely_text_section (); + fde->cold_in_std_section + = (unlikelysec == text_section + || (cold_text_section && unlikelysec == cold_text_section)); + } + else + { + fde->in_std_section + = (fnsec == text_section + || (cold_text_section && fnsec == cold_text_section)); + fde->cold_in_std_section = 0; + } args_size = old_args_size = 0; @@ -17128,12 +17156,14 @@ dwarf2out_finish (const char *filename) if (fde->dw_fde_switched_sections) { - add_ranges_by_labels (fde->dw_fde_hot_section_label, - fde->dw_fde_hot_section_end_label); - add_ranges_by_labels (fde->dw_fde_unlikely_section_label, - fde->dw_fde_unlikely_section_end_label); + if (!fde->in_std_section) + add_ranges_by_labels (fde->dw_fde_hot_section_label, + fde->dw_fde_hot_section_end_label); + if (!fde->cold_in_std_section) + add_ranges_by_labels (fde->dw_fde_unlikely_section_label, + fde->dw_fde_unlikely_section_end_label); } - else + else if (!fde->in_std_section) add_ranges_by_labels (fde->dw_fde_begin, fde->dw_fde_end); }