public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
@ 2022-08-06  8:53 Sergei Trofimovich
  2022-08-07 15:32 ` Martin Liška
  2022-08-07 18:31 ` [PATCH v2] " Sergei Trofimovich
  0 siblings, 2 replies; 6+ messages in thread
From: Sergei Trofimovich @ 2022-08-06  8:53 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Sergei Trofimovich

binutils started producing 0-sized DIEs on functions interspersed
by nested sections (".section ...; .previous). This led to
run-low_high_pc.sh failure in form of:

    FAIL: run-low_high_pc.sh
    ========================

    [b] main.c
    [2d] main

    [b] ../sysdeps/i386/start.S
    [26] _start
    [40] ../sysdeps/x86/abi-note.c
    [b52] init.c
    [b8e] static-reloc.c
    [2dba] _dl_relocate_static_pie
    [2dd8] ../sysdeps/i386/crti.S
    [2def] _init
    lowpc: 8049000, highpc: 8049000lx
    ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
    FAIL run-low_high_pc.sh (exit status: 255)

To work it around let's allow lowpc == highpc special case.

https://sourceware.org/bugzilla/show_bug.cgi?id=29450

Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
---
 tests/ChangeLog     | 4 ++++
 tests/low_high_pc.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0c6f68ef..8296e0b6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2022-08-04  Sergei Trofimovich  <slyich@gmail.com>
+
+	* low_high_pc.c (handle_die): Allow zero sized DIEs for binutils-2.39.
+
 2022-08-01  Mark Wielaard  <mark@klomp.org>
 
 	* run-debuginfod-percent-escape.sh: Add initial scan wait_ready.
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index cd022b1c..80c83b6d 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
@@ -70,6 +70,9 @@ handle_die (Dwarf_Die *die, void *arg)
   if (dwarf_hasattr (die, DW_AT_low_pc)
       && dwarf_hasattr (die, DW_AT_high_pc)
       && highpc <= lowpc
+      /* gas-2.39 produces zero sized DIEs sometimes:
+         https://sourceware.org/PR29451.  */
+      && highpc != lowpc
       && ! (dwarf_tag (die) == DW_TAG_compile_unit && highpc == lowpc))
     {
       printf("lowpc: %" PRIx64 ", highpc: %" PRIx64 "\n", lowpc, highpc);
-- 
2.37.1


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

* Re: [PATCH] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
  2022-08-06  8:53 [PATCH] tests: do not fail on zero sized DIEs (binutils-2.39 compatible) Sergei Trofimovich
@ 2022-08-07 15:32 ` Martin Liška
  2022-08-07 18:31 ` [PATCH v2] " Sergei Trofimovich
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Liška @ 2022-08-07 15:32 UTC (permalink / raw)
  To: Sergei Trofimovich, elfutils-devel

On 8/6/22 10:53, Sergei Trofimovich via Elfutils-devel wrote:

Hi.

Thanks for catching this. Btw. I've also noticed the elfutils failure
in openSUSE staging project.

> binutils started producing 0-sized DIEs on functions interspersed
> by nested sections (".section ...; .previous). This led to
> run-low_high_pc.sh failure in form of:
> 
>     FAIL: run-low_high_pc.sh
>     ========================
> 
>     [b] main.c
>     [2d] main
> 
>     [b] ../sysdeps/i386/start.S
>     [26] _start
>     [40] ../sysdeps/x86/abi-note.c
>     [b52] init.c
>     [b8e] static-reloc.c
>     [2dba] _dl_relocate_static_pie
>     [2dd8] ../sysdeps/i386/crti.S
>     [2def] _init
>     lowpc: 8049000, highpc: 8049000lx
>     ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
>     FAIL run-low_high_pc.sh (exit status: 255)
> 
> To work it around let's allow lowpc == highpc special case.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=29450
> 
> Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
> ---
>  tests/ChangeLog     | 4 ++++
>  tests/low_high_pc.c | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/tests/ChangeLog b/tests/ChangeLog
> index 0c6f68ef..8296e0b6 100644
> --- a/tests/ChangeLog
> +++ b/tests/ChangeLog
> @@ -1,3 +1,7 @@
> +2022-08-04  Sergei Trofimovich  <slyich@gmail.com>
> +
> +	* low_high_pc.c (handle_die): Allow zero sized DIEs for binutils-2.39.
> +
>  2022-08-01  Mark Wielaard  <mark@klomp.org>
>  
>  	* run-debuginfod-percent-escape.sh: Add initial scan wait_ready.
> diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
> index cd022b1c..80c83b6d 100644
> --- a/tests/low_high_pc.c
> +++ b/tests/low_high_pc.c
> @@ -70,6 +70,9 @@ handle_die (Dwarf_Die *die, void *arg)
>    if (dwarf_hasattr (die, DW_AT_low_pc)
>        && dwarf_hasattr (die, DW_AT_high_pc)
>        && highpc <= lowpc
> +      /* gas-2.39 produces zero sized DIEs sometimes:
> +         https://sourceware.org/PR29451.  */
> +      && highpc != lowpc

What about rather changing 'highpc <= lowpc' to 'highpc < lowpc'
and note that ...

>        && ! (dwarf_tag (die) == DW_TAG_compile_unit && highpc == lowpc))

... here 'highpc == lowpc' would be always false and the entire condition:
'&& ! (dwarf_tag (die) == DW_TAG_compile_unit && highpc == lowpc))' always true.

Cheers,
Martin

>      {
>        printf("lowpc: %" PRIx64 ", highpc: %" PRIx64 "\n", lowpc, highpc);


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

* [PATCH v2] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
  2022-08-06  8:53 [PATCH] tests: do not fail on zero sized DIEs (binutils-2.39 compatible) Sergei Trofimovich
  2022-08-07 15:32 ` Martin Liška
@ 2022-08-07 18:31 ` Sergei Trofimovich
  2022-08-07 23:17   ` Mark Wielaard
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Trofimovich @ 2022-08-07 18:31 UTC (permalink / raw)
  To: Martin Liška, elfutils-devel; +Cc: Sergei Trofimovich

binutils started producing 0-sized DIEs on functions interspersed
by nested sections (".section ...; .previous). This led to
run-low_high_pc.sh failure in form of:

    FAIL: run-low_high_pc.sh
    ========================

    [b] main.c
    [2d] main

    [b] ../sysdeps/i386/start.S
    [26] _start
    [40] ../sysdeps/x86/abi-note.c
    [b52] init.c
    [b8e] static-reloc.c
    [2dba] _dl_relocate_static_pie
    [2dd8] ../sysdeps/i386/crti.S
    [2def] _init
    lowpc: 8049000, highpc: 8049000lx
    ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
    FAIL run-low_high_pc.sh (exit status: 255)

To work it around let's allow lowpc == highpc special case.

https://sourceware.org/bugzilla/show_bug.cgi?id=29450

Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
---
 tests/ChangeLog     | 4 ++++
 tests/low_high_pc.c | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0c6f68ef..59b4252a 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2022-08-07  Sergei Trofimovich  <slyich@gmail.com>
+
+	* low_high_pc.c (handle_die): Allow zero sized DIEs for binutils-2.39.
+
 2022-08-01  Mark Wielaard  <mark@klomp.org>
 
 	* run-debuginfod-percent-escape.sh: Add initial scan wait_ready.
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index 78b6ad08..63268f4c 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
@@ -66,11 +66,13 @@ handle_die (Dwarf_Die *die, void *arg)
     fail (off, name, "has DW_AT_high_pc but dwarf_highpc fails");
 
   /* GCC < 4.7 had a bug where no code CUs got a highpc == lowpc.
-     Allow that, because it is not the main purpose of this test.  */
+     Allow that, because it is not the main purpose of this test.
+     gas-2.39 produces zero sized DIEs for subprograms sometimes:
+         https://sourceware.org/PR29451.
+   */
   if (dwarf_hasattr (die, DW_AT_low_pc)
       && dwarf_hasattr (die, DW_AT_high_pc)
-      && highpc <= lowpc
-      && ! (dwarf_tag (die) == DW_TAG_compile_unit && highpc == lowpc))
+      && highpc < lowpc)
     {
       printf("lowpc: %" PRIx64 ", highpc: %" PRIx64 "lx\n", lowpc, highpc);
       fail (off, name, "highpc <= lowpc");
-- 
2.37.1


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

* Re: [PATCH v2] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
  2022-08-07 18:31 ` [PATCH v2] " Sergei Trofimovich
@ 2022-08-07 23:17   ` Mark Wielaard
  2022-10-13 14:40     ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Wielaard @ 2022-08-07 23:17 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: Martin Liška, elfutils-devel

Hi Sergei,

On Sun, Aug 07, 2022 at 07:31:38PM +0100, Sergei Trofimovich via Elfutils-devel wrote:
> binutils started producing 0-sized DIEs on functions interspersed
> by nested sections (".section ...; .previous). This led to
> run-low_high_pc.sh failure in form of:
> 
>     FAIL: run-low_high_pc.sh
>     ========================
> 
>     [b] main.c
>     [2d] main
> 
>     [b] ../sysdeps/i386/start.S
>     [26] _start
>     [40] ../sysdeps/x86/abi-note.c
>     [b52] init.c
>     [b8e] static-reloc.c
>     [2dba] _dl_relocate_static_pie
>     [2dd8] ../sysdeps/i386/crti.S
>     [2def] _init
>     lowpc: 8049000, highpc: 8049000lx
>     ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
>     FAIL run-low_high_pc.sh (exit status: 255)
> 
> To work it around let's allow lowpc == highpc special case.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=29450

Thanks for finding this and suggesting a workaround.  But lets first
try to fix binutils. This seems like a pretty bad bug, lets hope it
gets fixed soon. So we don't need these kind of workarounds.

I added a comment to the binutils bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=29451#c2

Cheers,

Mark

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

* Re: [PATCH v2] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
  2022-08-07 23:17   ` Mark Wielaard
@ 2022-10-13 14:40     ` Mark Wielaard
  2022-10-13 18:13       ` Sergei Trofimovich
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Wielaard @ 2022-10-13 14:40 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: elfutils-devel

Hi,

On Mon, 2022-08-08 at 01:17 +0200, Mark Wielaard wrote:
> On Sun, Aug 07, 2022 at 07:31:38PM +0100, Sergei Trofimovich via
> Elfutils-devel wrote:
> > binutils started producing 0-sized DIEs on functions interspersed
> > by nested sections (".section ...; .previous). This led to
> > run-low_high_pc.sh failure in form of:
> > 
> >     FAIL: run-low_high_pc.sh
> >     ========================
> > 
> >     [b] main.c
> >     [2d] main
> > 
> >     [b] ../sysdeps/i386/start.S
> >     [26] _start
> >     [40] ../sysdeps/x86/abi-note.c
> >     [b52] init.c
> >     [b8e] static-reloc.c
> >     [2dba] _dl_relocate_static_pie
> >     [2dd8] ../sysdeps/i386/crti.S
> >     [2def] _init
> >     lowpc: 8049000, highpc: 8049000lx
> >     ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
> >     FAIL run-low_high_pc.sh (exit status: 255)
> > 
> > To work it around let's allow lowpc == highpc special case.
> > 
> > https://sourceware.org/bugzilla/show_bug.cgi?id=29450
> 
> Thanks for finding this and suggesting a workaround.  But lets first
> try to fix binutils. This seems like a pretty bad bug, lets hope it
> gets fixed soon. So we don't need these kind of workarounds.
> 
> I added a comment to the binutils bug:
> https://sourceware.org/bugzilla/show_bug.cgi?id=29451#c2

Since this binutils bug was fixed I assume this patch isn't needed
anymore.

Thanks,

Mark

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

* Re: [PATCH v2] tests: do not fail on zero sized DIEs (binutils-2.39 compatible)
  2022-10-13 14:40     ` Mark Wielaard
@ 2022-10-13 18:13       ` Sergei Trofimovich
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Trofimovich @ 2022-10-13 18:13 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel

On Thu, 13 Oct 2022 16:40:36 +0200
Mark Wielaard <aegon@wildebeest.org> wrote:

> Hi,
> 
> On Mon, 2022-08-08 at 01:17 +0200, Mark Wielaard wrote:
> > On Sun, Aug 07, 2022 at 07:31:38PM +0100, Sergei Trofimovich via
> > Elfutils-devel wrote:  
> > > binutils started producing 0-sized DIEs on functions interspersed
> > > by nested sections (".section ...; .previous). This led to
> > > run-low_high_pc.sh failure in form of:
> > > 
> > >     FAIL: run-low_high_pc.sh
> > >     ========================
> > > 
> > >     [b] main.c
> > >     [2d] main
> > > 
> > >     [b] ../sysdeps/i386/start.S
> > >     [26] _start
> > >     [40] ../sysdeps/x86/abi-note.c
> > >     [b52] init.c
> > >     [b8e] static-reloc.c
> > >     [2dba] _dl_relocate_static_pie
> > >     [2dd8] ../sysdeps/i386/crti.S
> > >     [2def] _init
> > >     lowpc: 8049000, highpc: 8049000lx
> > >     ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc
> > >     FAIL run-low_high_pc.sh (exit status: 255)
> > > 
> > > To work it around let's allow lowpc == highpc special case.
> > > 
> > > https://sourceware.org/bugzilla/show_bug.cgi?id=29450  
> > 
> > Thanks for finding this and suggesting a workaround.  But lets first
> > try to fix binutils. This seems like a pretty bad bug, lets hope it
> > gets fixed soon. So we don't need these kind of workarounds.
> > 
> > I added a comment to the binutils bug:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=29451#c2  
> 
> Since this binutils bug was fixed I assume this patch isn't needed
> anymore.

Agreed. https://sourceware.org/PR29450#c8 cosed the bug as RESOLVED/MOVED
to declare it a binutils deficiency. Downstream use binutils-2.39 with a
gas patch and are able to run unmodified elfutils testsuite as is.

Thank you!

-- 

  Sergei

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

end of thread, other threads:[~2022-10-13 18:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-06  8:53 [PATCH] tests: do not fail on zero sized DIEs (binutils-2.39 compatible) Sergei Trofimovich
2022-08-07 15:32 ` Martin Liška
2022-08-07 18:31 ` [PATCH v2] " Sergei Trofimovich
2022-08-07 23:17   ` Mark Wielaard
2022-10-13 14:40     ` Mark Wielaard
2022-10-13 18:13       ` Sergei Trofimovich

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).