From 6ea166c2efd01e59fb52e74cfe4af2fd52b190b3 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 19 Jul 2017 00:05:33 -0300 Subject: [PATCH] LVU: revert loc insn flushes; emit it right away if with view --- gas/config/tc-mips.c | 1 - gas/config/tc-sh.c | 2 -- gas/doc/as.texinfo | 23 +++++++++++------------ gas/dwarf2dbg.c | 4 ++++ gas/read.c | 19 ------------------- gas/subsegs.c | 7 +------ gas/testsuite/gas/elf/dwarf2-8.l | 2 +- gas/testsuite/gas/elf/dwarf2-9.l | 2 +- 8 files changed, 18 insertions(+), 42 deletions(-) diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 176d635e06f..4eeb5ee6b20 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -15865,7 +15865,6 @@ mips_align (int to, int *fill, struct insn_label_list *labels) { mips_emit_delays (); mips_record_compressed_mode (); - dwarf2_emit_insn (0); if (fill == NULL && subseg_text_p (now_seg)) frag_align_code (to, 0); else diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 8baae268e42..cb5fb24bc9e 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -831,8 +831,6 @@ sh_elf_cons (int nbytes) return; } - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (nbytes); #endif diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index a6ddc7cdbf3..65b14a42ca7 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -5834,18 +5834,17 @@ This directive will set the @code{discriminator} register in the @code{.debug_li state machine to @var{value}, which must be an unsigned integer. @item view @var{value} -This directive will verify that the @code{view} register in the -@code{.debug_line} state machine matches @var{value}. In general, the -@code{view} register counts how many prior @code{.loc} directives are at the -same program location, but there are a few exceptions, such as that view -numbers may be forced reset e.g. at function entry points, or they may not be -reset even when the location changes. The assembler will determine the view -number for that @code{.loc}. Then, if @var{value} is a label, it will set the -label to the @var{value}. Otherwise, @var{value} may be either @code{0}, in -which case the assembler will error out if the computed view number is not -zero, or @code{-0}, that will cause the assembler to arrange for the -@code{view} register to be reset for this @code{.loc} even if for @code{0} it -would have issued an error. +This option causes a row to be added to @code{.debug_line} in reference to the +current address (which might not be the same as that of the following assembly +instruction), and to associate @var{value} with the @code{view} register in the +@code{.debug_line} state machine. If @var{value} is a label, both the +@code{view} register and the label are set to the number of prior @code{.loc} +directives at the same program location. If @var{value} is the literal +@code{0}, the @code{view} register is set to zero, and the assembler asserts +that there aren't any prior @code{.loc} directives at the same program +location. If @var{value} is the literal @code{-0}, the assembler arrange for +the @code{view} register to be reset in this row, even if there are prior +@code{.loc} directives at the same program location. @end table diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 04d7ef9e08f..c3d6043ff0f 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -957,6 +957,10 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); dwarf2_loc_directive_seen = TRUE; debug_type = DEBUG_NONE; + + /* If we were given a view id, emit the row right away. */ + if (current.view) + dwarf2_emit_insn (0); } void diff --git a/gas/read.c b/gas/read.c index 629e1a017ad..9627ef513bf 100644 --- a/gas/read.c +++ b/gas/read.c @@ -37,7 +37,6 @@ #include "macro.h" #include "obstack.h" #include "ecoff.h" -#include "dwarf2dbg.h" #include "dw2gencfi.h" #include "wchar.h" @@ -779,8 +778,6 @@ do_align (unsigned int n, char *fill, unsigned int len, unsigned int max) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_do_align md_do_align (n, fill, len, max, just_record_alignment); #endif @@ -2201,8 +2198,6 @@ s_fill (int ignore ATTRIBUTE_UNUSED) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (1); #endif @@ -2853,8 +2848,6 @@ s_org (int ignore ATTRIBUTE_UNUSED) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - /* The m68k MRI assembler has a different meaning for .org. It means to create an absolute section at a given address. We can't support that--use a linker script instead. */ @@ -3325,8 +3318,6 @@ s_space (int mult) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (1); #endif @@ -3976,8 +3967,6 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */ md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - if (flag_mri) stop = mri_comment_field (&stopc); @@ -4970,8 +4959,6 @@ float_cons (/* Clobbers input_line-pointer, checks end-of-line. */ md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (1); #endif @@ -5395,8 +5382,6 @@ s_leb128 (int sign) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - do { deferred_expression (&exp); @@ -5466,8 +5451,6 @@ stringer (int bits_appendzero) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (1); #endif @@ -5862,8 +5845,6 @@ s_incbin (int x ATTRIBUTE_UNUSED) md_flush_pending_output (); #endif - dwarf2_emit_insn (0); - #ifdef md_cons_align md_cons_align (1); #endif diff --git a/gas/subsegs.c b/gas/subsegs.c index 76e3c6b8584..73bc3493b62 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -25,8 +25,6 @@ #include "subsegs.h" #include "obstack.h" -#include "dwarf2dbg.h" - frchainS *frchain_now; static struct obstack frchains; @@ -82,10 +80,7 @@ subseg_set_rest (segT seg, subsegT subseg) mri_common_symbol = NULL; if (frag_now && frchain_now) - { - frchain_now->frch_frag_now = frag_now; - dwarf2_emit_insn (0); - } + frchain_now->frch_frag_now = frag_now; gas_assert (frchain_now == 0 || frchain_now->frch_last == frag_now); diff --git a/gas/testsuite/gas/elf/dwarf2-8.l b/gas/testsuite/gas/elf/dwarf2-8.l index 457f648951d..60c73e5a0a8 100644 --- a/gas/testsuite/gas/elf/dwarf2-8.l +++ b/gas/testsuite/gas/elf/dwarf2-8.l @@ -1,2 +1,2 @@ [^:]*: Assembler messages: -[^:]*:26: Error: view number mismatch +[^:]*:25: Error: view number mismatch diff --git a/gas/testsuite/gas/elf/dwarf2-9.l b/gas/testsuite/gas/elf/dwarf2-9.l index 43eb6065ae7..7f107fa5148 100644 --- a/gas/testsuite/gas/elf/dwarf2-9.l +++ b/gas/testsuite/gas/elf/dwarf2-9.l @@ -1,2 +1,2 @@ [^:]*: Assembler messages: -[^:]*:31: Error: view number mismatch +[^:]*:30: Error: view number mismatch -- 2.47.2