aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/bb-reorder.c5
-rw-r--r--gcc/dwarf2out.c11
-rw-r--r--gcc/output.h4
-rw-r--r--gcc/varasm.c8
5 files changed, 32 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 792d795..c2bc164 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2005-10-25 Eric Botcazou <ebotcazou@libertysurf.fr>
+ Caroline Tice <ctice@apple.com>
+
+ PR rtl-optimization/24460
+ * dwarf2out.c (have_switched_text_sections): New boolean variable.
+ (dwarf2out_switch_text_section): Set it to true instead of
+ incrementing separate_line_info_table_in_use.
+ (output_loc_list): Additionally test have_switched_text_sections.
+ (output_ranges): Likewise.
+ (dwarf2out_finish): Likewise.
+ * varasm.c (assemble_start_function): Do not call
+ insert_section_boundary_note.
+ (assemble_end_function): If flag_reorder_blocks_and_partition,
+ switch to the function's section before emitting the .size directive.
+ * bb-reorder.c (insert_section_boundary_note): Staticify.
+ (rest_of_handle_reorder_blocks): Call insert_section_boundary_note.
+ * output.h (insert_section_boundary_note): Delete.
+
2005-10-24 Andrew Pinski <pinskia@physics.uc.edu>
PR c/23103
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index a142fe2..40d0cdf 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1945,7 +1945,7 @@ reorder_basic_blocks (unsigned int flags)
encountering this note will make the compiler switch between the
hot and cold text sections. */
-void
+static void
insert_section_boundary_note (void)
{
basic_block bb;
@@ -2231,6 +2231,9 @@ rest_of_handle_reorder_blocks (void)
if (changed && HAVE_conditional_execution)
update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
PROP_DEATH_NOTES);
+
+ /* Add NOTE_INSN_SWITCH_TEXT_SECTIONS notes. */
+ insert_section_boundary_note ();
}
struct tree_opt_pass pass_reorder_blocks =
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7ee5edb..8a5c4c2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3778,6 +3778,9 @@ static GTY(()) unsigned line_info_table_allocated;
/* Number of elements in line_info_table currently in use. */
static GTY(()) unsigned line_info_table_in_use;
+/* True if the compilation unit contains more than one .text section. */
+static GTY(()) bool have_switched_text_section = false;
+
/* A pointer to the base of a table that contains line information
for each source code line outside of .text in the compilation unit. */
static GTY ((length ("separate_line_info_table_allocated")))
@@ -6850,7 +6853,7 @@ dwarf2out_switch_text_section (void)
fde->dw_fde_hot_section_end_label = cfun->hot_section_end_label;
fde->dw_fde_unlikely_section_label = cfun->cold_section_label;
fde->dw_fde_unlikely_section_end_label = cfun->cold_section_end_label;
- separate_line_info_table_in_use++;
+ have_switched_text_section = true;
}
/* Output the location list given to us. */
@@ -6866,7 +6869,7 @@ output_loc_list (dw_loc_list_ref list_head)
for (curr = list_head; curr != NULL; curr = curr->dw_loc_next)
{
unsigned long size;
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->begin, curr->section,
"Location list begin address (%s)",
@@ -7375,7 +7378,7 @@ output_ranges (void)
/* If all code is in the text section, then the compilation
unit base address defaults to DW_AT_low_pc, which is the
base of the text section. */
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, blabel,
text_section_label,
@@ -14096,7 +14099,7 @@ dwarf2out_finish (const char *filename)
/* We can only use the low/high_pc attributes if all of the code was
in .text. */
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, text_section_label);
add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
diff --git a/gcc/output.h b/gcc/output.h
index cb8d8c0..3cb091f 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -588,10 +588,6 @@ extern bool default_valid_pointer_mode (enum machine_mode);
extern int default_address_cost (rtx);
-/* When performing hot/cold basic block partitioning, insert note in
- instruction stream indicating boundary between hot and cold sections. */
-extern void insert_section_boundary_note (void);
-
/* dbxout helper functions */
#if defined DBX_DEBUGGING_INFO || defined XCOFF_DEBUGGING_INFO
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 2aa5e69..83f47ac 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1369,11 +1369,6 @@ assemble_start_function (tree decl, const char *fnname)
/* Standard thing is just output label for the function. */
ASM_OUTPUT_LABEL (asm_out_file, fnname);
#endif /* ASM_DECLARE_FUNCTION_NAME */
-
- /* Add NOTE_INSN_SWITCH_TEXT_SECTIONS notes. Don't do this if the current
- function is a thunk, because we don't have a CFG in that case. */
- if (!current_function_is_thunk)
- insert_section_boundary_note ();
}
/* Output assembler code associated with defining the size of the
@@ -1383,6 +1378,9 @@ void
assemble_end_function (tree decl, const char *fnname)
{
#ifdef ASM_DECLARE_FUNCTION_SIZE
+ /* We could have switched section in the middle of the function. */
+ if (flag_reorder_blocks_and_partition)
+ function_section (decl);
ASM_DECLARE_FUNCTION_SIZE (asm_out_file, fnname, decl);
#endif
if (! CONSTANT_POOL_BEFORE_FUNCTION)