public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove left over "negate" adjustment in compute_abbrevs.
@ 2021-02-14 15:34 Mark Wielaard
  2021-02-15  8:32 ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2021-02-14 15:34 UTC (permalink / raw)
  To: dwz; +Cc: Mark Wielaard

Before commit 47af8da7c "Assorted DW_FORM_implicit_const fixes" there
was a hack to track whether decl/call_file line numbers had been
translated already. This worked by negating the value once it was and
not translating again when the value was negative. Then in
compute_abbrevs all negated values we made positive again. Most of
this hack was removed in the above commit. Except for making all
negated values positive again in compute_abbrevs. Remove it there too.
No decl/call_file line number tables can ever be negative.

   * dwz.c (compute_abbrevs): Remove negate adjustment for
   DW_AT_decl_file and DW_AT_call_file attribute DW_FORM_implicit_const
   values.
---
 dwz.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/dwz.c b/dwz.c
index 992da77..0664052 100644
--- a/dwz.c
+++ b/dwz.c
@@ -11622,20 +11622,7 @@ compute_abbrevs (DSO *dso)
 	      abbrev_size += size_of_uleb128 (arr[i]->attr[j].attr);
 	      abbrev_size += size_of_uleb128 (arr[i]->attr[j].form);
 	      if (arr[i]->attr[j].form == DW_FORM_implicit_const)
-		{
-		  /* If this is a shared abbrev for a file reference
-		     attribute, update to the new file number (in the
-		     mulifile .debug_line).  Note that this might
-		     change the abbrev size...  */
-		  if (unlikely (wr_multifile || op_multifile)
-		      && (arr[i]->attr[j].attr == DW_AT_decl_file
-			  || arr[i]->attr[j].attr == DW_AT_call_file))
-		    {
-		      if (arr[i]->values[j] < 0)
-			arr[i]->values[j] = -arr[i]->values[j];
-		    }
-		  abbrev_size += size_of_sleb128 (arr[i]->values[j]);
-		}
+		abbrev_size += size_of_sleb128 (arr[i]->values[j]);
 	    }
 	  abbrev_size += 2;
 	}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Remove left over "negate" adjustment in compute_abbrevs.
  2021-02-14 15:34 [PATCH] Remove left over "negate" adjustment in compute_abbrevs Mark Wielaard
@ 2021-02-15  8:32 ` Tom de Vries
  2021-02-15  9:21   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2021-02-15  8:32 UTC (permalink / raw)
  To: Mark Wielaard, dwz

On 2/14/21 4:34 PM, Mark Wielaard wrote:
> Before commit 47af8da7c "Assorted DW_FORM_implicit_const fixes" there
> was a hack to track whether decl/call_file line numbers had been
> translated already. This worked by negating the value once it was

I'd add "translated" here, reads easier.

> and
> not translating again when the value was negative. Then in
> compute_abbrevs all negated values we made positive again. Most of

we -> were

> this hack was removed in the above commit. Except for making all
> negated values positive again in compute_abbrevs. Remove it there too.
> No decl/call_file line number tables can ever be negative.
> 

LGTM.

Thanks,
- Tom

>    * dwz.c (compute_abbrevs): Remove negate adjustment for
>    DW_AT_decl_file and DW_AT_call_file attribute DW_FORM_implicit_const
>    values.
> ---
>  dwz.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/dwz.c b/dwz.c
> index 992da77..0664052 100644
> --- a/dwz.c
> +++ b/dwz.c
> @@ -11622,20 +11622,7 @@ compute_abbrevs (DSO *dso)
>  	      abbrev_size += size_of_uleb128 (arr[i]->attr[j].attr);
>  	      abbrev_size += size_of_uleb128 (arr[i]->attr[j].form);
>  	      if (arr[i]->attr[j].form == DW_FORM_implicit_const)
> -		{
> -		  /* If this is a shared abbrev for a file reference
> -		     attribute, update to the new file number (in the
> -		     mulifile .debug_line).  Note that this might
> -		     change the abbrev size...  */
> -		  if (unlikely (wr_multifile || op_multifile)
> -		      && (arr[i]->attr[j].attr == DW_AT_decl_file
> -			  || arr[i]->attr[j].attr == DW_AT_call_file))
> -		    {
> -		      if (arr[i]->values[j] < 0)
> -			arr[i]->values[j] = -arr[i]->values[j];
> -		    }
> -		  abbrev_size += size_of_sleb128 (arr[i]->values[j]);
> -		}
> +		abbrev_size += size_of_sleb128 (arr[i]->values[j]);
>  	    }
>  	  abbrev_size += 2;
>  	}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Remove left over "negate" adjustment in compute_abbrevs.
  2021-02-15  8:32 ` Tom de Vries
@ 2021-02-15  9:21   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2021-02-15  9:21 UTC (permalink / raw)
  To: Tom de Vries, dwz

Hi Tom,

On Mon, 2021-02-15 at 09:32 +0100, Tom de Vries wrote:
> On 2/14/21 4:34 PM, Mark Wielaard wrote:
> > Before commit 47af8da7c "Assorted DW_FORM_implicit_const fixes" there
> > was a hack to track whether decl/call_file line numbers had been
> > translated already. This worked by negating the value once it was
> 
> I'd add "translated" here, reads easier.
> 
> > and
> > not translating again when the value was negative. Then in
> > compute_abbrevs all negated values we made positive again. Most of
> 
> we -> were
> 
> > this hack was removed in the above commit. Except for making all
> > negated values positive again in compute_abbrevs. Remove it there too.
> > No decl/call_file line number tables can ever be negative.
> > 
> 
> LGTM.

Thanks. Pushed with the suggested changes to the commit message.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-15  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 15:34 [PATCH] Remove left over "negate" adjustment in compute_abbrevs Mark Wielaard
2021-02-15  8:32 ` Tom de Vries
2021-02-15  9:21   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).