This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Change DWARF5 .debug_loclists location description sizes from 2-byte length to uleb128 lengths
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>, Jan Kratochvil <jan dot kratochvil at redhat dot com>, Mark Wielaard <mark at klomp dot org>
- Date: Wed, 4 Jan 2017 14:49:30 -0500
- Subject: Re: [PATCH] Change DWARF5 .debug_loclists location description sizes from 2-byte length to uleb128 lengths
- Authentication-results: sourceware.org; auth=none
- References: <20170103231547.GE21933@tucnak>
OK.
On Tue, Jan 3, 2017 at 6:15 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> http://dwarfstd.org/ShowIssue.php?issue=161102.1
> got accepted today, so DWARF5 is going to use uleb128 sizes instead of
> 2-byte sizes in .debug_loclists section.
> On a randomly chosen *.i file I had around, this results in shrinking
> of .debug_loclists section size from 0xef7df to 0xddd65, so around 7.5%
> saving, not too bad.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> Jan/Mark, are you going to adjust the consumers accordingly? Thanks.
>
> 2017-01-03 Jakub Jelinek <jakub@redhat.com>
>
> * dwarf2out.c (output_loc_list): Don't throw away 64K+ location
> descriptions for -gdwarf-5 and emit them as uleb128 instead of
> 2-byte data.
>
> --- gcc/dwarf2out.c.jj 2017-01-03 19:41:45.000000000 +0100
> +++ gcc/dwarf2out.c 2017-01-03 20:58:21.304628767 +0100
> @@ -9590,7 +9590,7 @@ output_loc_list (dw_loc_list_ref list_he
> perhaps put it into DW_TAG_dwarf_procedure and refer to that
> in the expression, but >= 64KB expressions for a single value
> in a single range are unlikely very useful. */
> - if (size > 0xffff)
> + if (dwarf_version < 5 && size > 0xffff)
> continue;
> if (dwarf_version >= 5)
> {
> @@ -9642,8 +9642,6 @@ output_loc_list (dw_loc_list_ref list_he
> if (strcmp (curr2->begin, curr2->end) == 0
> && !curr2->force)
> continue;
> - if ((unsigned long) size_of_locs (curr2->expr) > 0xffff)
> - continue;
> break;
> }
> if (curr2 == NULL || curr->section != curr2->section)
> @@ -9744,8 +9742,13 @@ output_loc_list (dw_loc_list_ref list_he
> }
>
> /* Output the block length for this list of location operations. */
> - gcc_assert (size <= 0xffff);
> - dw2_asm_output_data (2, size, "%s", "Location expression size");
> + if (dwarf_version >= 5)
> + dw2_asm_output_data_uleb128 (size, "Location expression size");
> + else
> + {
> + gcc_assert (size <= 0xffff);
> + dw2_asm_output_data (2, size, "Location expression size");
> + }
>
> output_loc_sequence (curr->expr, -1);
> }
>
> Jakub