From 6a50d470b71ce26110ef91d2679d4565d3a3192e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 14 Jun 2013 13:24:41 +0000 Subject: [PATCH] gas/ Revert: 2011-09-05 Richard Sandiford PR gas/13024 * dwarf2dbg.c (pending_lines, pending_lines_tail): New variables. (dwarf2_gen_line_info_1): Delete. (dwarf2_push_line, dwarf2_flush_pending_lines): New functions. (dwarf2_gen_line_info, dwarf2_emit_label): Use them. (dwarf2_consume_line_info): Call dwarf2_flush_pending_lines. (dwarf2_directive_loc): Push previous .locs instead of generating them immediately. --- gas/ChangeLog | 15 ++++++++++++++ gas/dwarf2dbg.c | 61 +++++++++++++-------------------------------------------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 4ce92ce..dbe82bb 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +2013-06-14 Richard Sandiford + + Revert: + + 2011-09-05 Richard Sandiford + + PR gas/13024 + * dwarf2dbg.c (pending_lines, pending_lines_tail): New variables. + (dwarf2_gen_line_info_1): Delete. + (dwarf2_push_line, dwarf2_flush_pending_lines): New functions. + (dwarf2_gen_line_info, dwarf2_emit_label): Use them. + (dwarf2_consume_line_info): Call dwarf2_flush_pending_lines. + (dwarf2_directive_loc): Push previous .locs instead of generating + them immediately. + 2013-06-13 Chao-ying Fu * config/tc-mips.c (ISA_SUPPORTS_VIRT_ASE): Support micromips. diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index df93bac..f5623f6 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -216,10 +216,6 @@ static struct dwarf2_line_info current = { 0 }; -/* Lines that are at the same location as CURRENT, and which are waiting - for a label. */ -static struct line_entry *pending_lines, **pending_lines_tail = &pending_lines; - /* The size of an address on the target. */ static unsigned int sizeof_address; @@ -293,47 +289,22 @@ get_line_subseg (segT seg, subsegT subseg) return lss; } -/* Push LOC onto the pending lines list. */ +/* Record an entry for LOC occurring at LABEL. */ static void -dwarf2_push_line (struct dwarf2_line_info *loc) +dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc) { + struct line_subseg *lss; struct line_entry *e; e = (struct line_entry *) xmalloc (sizeof (*e)); e->next = NULL; - e->label = NULL; + e->label = label; e->loc = *loc; - *pending_lines_tail = e; - pending_lines_tail = &(*pending_lines_tail)->next; -} - -/* Emit all pending line information. LABEL is the label with which the - lines should be associated, or null if they should be associated with - the current position. */ - -static void -dwarf2_flush_pending_lines (symbolS *label) -{ - if (pending_lines) - { - struct line_subseg *lss; - struct line_entry *e; - - if (!label) - label = symbol_temp_new_now (); - - for (e = pending_lines; e; e = e->next) - e->label = label; - - lss = get_line_subseg (now_seg, now_subseg); - *lss->ptail = pending_lines; - lss->ptail = pending_lines_tail; - - pending_lines = NULL; - pending_lines_tail = &pending_lines; - } + lss = get_line_subseg (now_seg, now_subseg); + *lss->ptail = e; + lss->ptail = &e->next; } /* Record an entry for LOC occurring at OFS within the current fragment. */ @@ -344,6 +315,8 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) static unsigned int line = -1; static unsigned int filenum = -1; + symbolS *sym; + /* Early out for as-yet incomplete location information. */ if (loc->filenum == 0 || loc->line == 0) return; @@ -359,7 +332,6 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) line = loc->line; filenum = loc->filenum; - dwarf2_push_line (loc); if (linkrelax) { char name[120]; @@ -367,10 +339,11 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) /* Use a non-fake name for the line number location, so that it can be referred to by relocations. */ sprintf (name, ".Loc.%u.%u", line, filenum); - dwarf2_flush_pending_lines (symbol_new (name, now_seg, ofs, frag_now)); + sym = symbol_new (name, now_seg, ofs, frag_now); } else - dwarf2_flush_pending_lines (symbol_temp_new (now_seg, ofs, frag_now)); + sym = symbol_temp_new (now_seg, ofs, frag_now); + dwarf2_gen_line_info_1 (sym, loc); } /* Returns the current source information. If .file directives have @@ -431,11 +404,6 @@ dwarf2_emit_insn (int size) void dwarf2_consume_line_info (void) { - /* If the consumer has stashed the current location away for later use, - assume that any earlier location information should be associated - with ".". */ - dwarf2_flush_pending_lines (NULL); - /* Unless we generate DWARF2 debugging information for each assembler line, we only emit one line symbol for one LOC. */ dwarf2_loc_directive_seen = FALSE; @@ -467,8 +435,7 @@ dwarf2_emit_label (symbolS *label) loc.flags |= DWARF2_FLAG_BASIC_BLOCK; - dwarf2_push_line (&loc); - dwarf2_flush_pending_lines (label); + dwarf2_gen_line_info_1 (label, &loc); dwarf2_consume_line_info (); } @@ -628,7 +595,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) /* If we see two .loc directives in a row, force the first one to be output now. */ if (dwarf2_loc_directive_seen) - dwarf2_push_line (¤t); + dwarf2_emit_insn (0); filenum = get_absolute_expression (); SKIP_WHITESPACE (); -- 2.7.4