public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/27578] New: --odr mode fails for a Libreoffice shared library
@ 2021-03-15  7:51 mliska at suse dot cz
  2021-03-15 11:02 ` [Bug default/27578] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mliska at suse dot cz @ 2021-03-15  7:51 UTC (permalink / raw)
  To: dwz

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

            Bug ID: 27578
           Summary: --odr mode fails for a Libreoffice shared library
           Product: dwz
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: nobody at sourceware dot org
          Reporter: mliska at suse dot cz
                CC: dwz at sourceware dot org
  Target Milestone: ---

Created attachment 13310
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13310&action=edit
Shared library

I see the following assert:

$ ./dwz --odr libvclplug_genlo.so-7.1.1.2-0.x86_64.debug
dwz: dwz.c:8826: remove_import_edges: Assertion `i == cucount' failed.
Aborted (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
@ 2021-03-15 11:02 ` vries at gcc dot gnu.org
  2021-03-15 12:27 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-15 11:02 UTC (permalink / raw)
  To: dwz

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
With --no-import-optimize, we run instead into:
...
$ dwz ./libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z -lnone --odr
--no-import-optimize
dwz: /home/vries/dwz/dwz.git/dwz.c:12685: write_die: Assertion `IMPLIES
(cu->cu_kind == CU_PU, die_cu (refd)->cu_kind == CU_PU)' failed.
Aborted
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
  2021-03-15 11:02 ` [Bug default/27578] " vries at gcc dot gnu.org
@ 2021-03-15 12:27 ` vries at gcc dot gnu.org
  2021-03-15 12:53 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-15 12:27 UTC (permalink / raw)
  To: dwz

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> With --no-import-optimize, we run instead into:
> ...
> $ dwz ./libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z -lnone
> --odr --no-import-optimize
> dwz: /home/vries/dwz/dwz.git/dwz.c:12685: write_die: Assertion `IMPLIES
> (cu->cu_kind == CU_PU, die_cu (refd)->cu_kind == CU_PU)' failed.
> Aborted
> ...

Fixed by:
...
diff --git a/dwz.c b/dwz.c
index 54b4bda..fcbc3aa 100644
--- a/dwz.c
+++ b/dwz.c
@@ -8433,7 +8433,12 @@ merged_singleton (dw_die_ref die)
       {
       case ODR_DEF:
        if (res)
-         return NULL;
+         {
+           if (die_cu (res) == die_cu (d))
+             continue;
+           else
+             return NULL;
+         }
        else
          res = d;
        break;
...

But that doesn't fix the assert reported in comment 0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
  2021-03-15 11:02 ` [Bug default/27578] " vries at gcc dot gnu.org
  2021-03-15 12:27 ` vries at gcc dot gnu.org
@ 2021-03-15 12:53 ` vries at gcc dot gnu.org
  2021-03-15 13:14 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-15 12:53 UTC (permalink / raw)
  To: dwz

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Martin Liska from comment #0)
> Created attachment 13310 [details]
> Shared library
> 
> I see the following assert:
> 
> $ ./dwz --odr libvclplug_genlo.so-7.1.1.2-0.x86_64.debug
> dwz: dwz.c:8826: remove_import_edges: Assertion `i == cucount' failed.
> Aborted (core dumped)

That's triggered in phase 2.  When using --devel-verify-edges, we get an assert
at the end of phase 1:
...
$ ./dwz ./libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z -lnone --odr
--devel-verify-edges 
dwz: dwz.c:8923: verify_edges_1: Assertion `count == 0 || e1->icu->idx >
last_idx' failed.
Aborted (core dumped)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
                   ` (2 preceding siblings ...)
  2021-03-15 12:53 ` vries at gcc dot gnu.org
@ 2021-03-15 13:14 ` vries at gcc dot gnu.org
  2021-03-15 14:19 ` vries at gcc dot gnu.org
  2021-03-16 16:12 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-15 13:14 UTC (permalink / raw)
  To: dwz

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
OK, that's due to:
...
idx: 48
cu: 0xbc
incoming: 200
incoming: 201
incoming: 201
incoming: 203
incoming: 204
incoming: 208
...

There are two incoming edges from the same CU.  So, one CU is importing the
same PU twice.  We can see this in the output if we do --no-import-optimize:
...
 <1><4742f>: Abbrev Number: 51 (DW_TAG_imported_unit)
    <47430>   DW_AT_import      : <0x7f02>      [Abbrev Number: 18
(DW_TAG_partial_unit)]
 <1><47434>: Abbrev Number: 51 (DW_TAG_imported_unit)
    <47435>   DW_AT_import      : <0x7f02>      [Abbrev Number: 18
(DW_TAG_partial_unit)]
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
                   ` (3 preceding siblings ...)
  2021-03-15 13:14 ` vries at gcc dot gnu.org
@ 2021-03-15 14:19 ` vries at gcc dot gnu.org
  2021-03-16 16:12 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-15 14:19 UTC (permalink / raw)
  To: dwz

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
@@ -9130,11 +9135,18 @@ create_import_tree (void)
       ipu->cu = pu;
       pu->u1.cu_icu = ipu;
       assert (rdie->die_toplevel);
+      dw_die_ref firstdie = NULL;
+      dw_cu_ref firstdiecu = NULL;
       for (die = rdie->die_nextdup, prev_cu = NULL;
           die; die = die->die_nextdup)
        {
          dw_cu_ref diecu = die_cu (die);
-         if (diecu == prev_cu)
+         if (firstdie == NULL)
+           {
+             firstdie = die;
+             firstdiecu = die_cu (firstdie);
+           }
+         if (diecu == prev_cu || (die != firstdie && diecu == firstdiecu))
            continue;
          ipu->incoming_count++;
          size += 1 + (diecu->cu_version == 2 ? ptr_size : 4);
@@ -9144,11 +9156,18 @@ create_import_tree (void)
                       obstack_alloc (&ob2,
                                      ipu->incoming_count
                                      * sizeof (*ipu->incoming));
+      firstdie = NULL;
+      firstdiecu = NULL;
       for (die = rdie->die_nextdup, i = 0, prev_cu = NULL;
           die; die = die->die_nextdup)
        {
          dw_cu_ref diecu = die_cu (die);
-         if (diecu == prev_cu)
+         if (firstdie == NULL)
+           {
+             firstdie = die;
+             firstdiecu = die_cu (firstdie);
+           }
+         if (diecu == prev_cu || (die != firstdie && diecu == firstdiecu))
            continue;
          icu = diecu->u1.cu_icu;
          if (icu == NULL)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug default/27578] --odr mode fails for a Libreoffice shared library
  2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
                   ` (4 preceding siblings ...)
  2021-03-15 14:19 ` vries at gcc dot gnu.org
@ 2021-03-16 16:12 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-16 16:12 UTC (permalink / raw)
  To: dwz

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commits:

https://sourceware.org/git/?p=dwz.git;a=commit;h=f765cd976583d98fcbc9b562671007653c651272

https://sourceware.org/git/?p=dwz.git;a=commit;h=4e7ce44a4f7d0e12a029a7a2f115ccf48746d686

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-03-16 16:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  7:51 [Bug default/27578] New: --odr mode fails for a Libreoffice shared library mliska at suse dot cz
2021-03-15 11:02 ` [Bug default/27578] " vries at gcc dot gnu.org
2021-03-15 12:27 ` vries at gcc dot gnu.org
2021-03-15 12:53 ` vries at gcc dot gnu.org
2021-03-15 13:14 ` vries at gcc dot gnu.org
2021-03-15 14:19 ` vries at gcc dot gnu.org
2021-03-16 16:12 ` vries at gcc dot gnu.org

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