Patchwork dwarf2out.c (size_of_aranges): Skip DECL_IGNORED_P functions.

login
register
mail settings
Submitter Mark Wielaard
Date March 21, 2013, 8:23 p.m.
Message ID <20130321202333.GA24573@toonder.wildebeest.org>
Download mbox | patch
Permalink /patch/229831/
State New
Headers show

Comments

Mark Wielaard - March 21, 2013, 8:23 p.m.
Hi,

The following change

  2012-05-03  Jason Merrill  <jason@redhat.com>

       * config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the
       pc thunk.
       * dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions.
       (dwarf2out_finish): Likewise.

caused the length field of a debug aranges table to sometimes be too
big. This causes DWARF readers that rely on the length field (dwz/binutils)
and not just on the terminator of the table (elfutils) to read the wrong
values on subsequent aranges tables.

This can be fixed by making the same change in size_of_aranges:

  2013-03-21  Mark Wielaard  <mjw@redhat.com>

        * dwarf2out.c (size_of_aranges): Skip DECL_IGNORED_P functions.

Cheers,

Mark
Jakub Jelinek - March 21, 2013, 8:31 p.m.
On Thu, Mar 21, 2013 at 09:23:34PM +0100, Mark Wielaard wrote:
> The following change
> 
>   2012-05-03  Jason Merrill  <jason@redhat.com>
> 
>        * config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the
>        pc thunk.
>        * dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions.
>        (dwarf2out_finish): Likewise.
> 
> caused the length field of a debug aranges table to sometimes be too
> big. This causes DWARF readers that rely on the length field (dwz/binutils)
> and not just on the terminator of the table (elfutils) to read the wrong
> values on subsequent aranges tables.
> 
> This can be fixed by making the same change in size_of_aranges:
> 
>   2013-03-21  Mark Wielaard  <mjw@redhat.com>
> 
>         * dwarf2out.c (size_of_aranges): Skip DECL_IGNORED_P functions.

This is ok for trunk and 4.8.  Thanks.

> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index 9be7728..b298cd9 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -7848,6 +7848,8 @@ size_of_aranges (void)
>  
>        FOR_EACH_VEC_ELT (*fde_vec, fde_idx, fde)
>  	{
> +	  if (DECL_IGNORED_P (fde->decl))
> +	    continue;
>  	  if (!fde->in_std_section)
>  	    size += 2 * DWARF2_ADDR_SIZE;
>  	  if (fde->dw_fde_second_begin && !fde->second_in_std_section)

	Jakub

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9be7728..b298cd9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7848,6 +7848,8 @@  size_of_aranges (void)
 
       FOR_EACH_VEC_ELT (*fde_vec, fde_idx, fde)
 	{
+	  if (DECL_IGNORED_P (fde->decl))
+	    continue;
 	  if (!fde->in_std_section)
 	    size += 2 * DWARF2_ADDR_SIZE;
 	  if (fde->dw_fde_second_begin && !fde->second_in_std_section)