]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf, link: fix spurious conflicts of variables in the variable section
authorNick Alcock <nick.alcock@oracle.com>
Wed, 11 Mar 2020 00:01:41 +0000 (00:01 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 22 Jul 2020 17:02:18 +0000 (18:02 +0100)
When we link a CTF variable, we check to see if it already exists in the
parent dict first: if it does, and it has a type the same as the type we
would populate it with, we assume we don't need to do anything:
otherwise, we populate it in a per-CU child.

Or that's what we should be doing.  Instead, we check if the type is the
same as the type in *source dict*, which is going to be a completely
different value!  So we end up concluding all variables are conflicting,
bloating up output possibly quite a lot (variables aren't big in and of
themselves, but each drags around a strtab entry, and CTF dicts in a CTF
archive do not share their strtabs -- one of many problems with CTF
archives as presently constituted.)

Fix trivial: check the right type.

libctf/
* ctf-link.c (ctf_link_one_variable): Check the dst_type for
conflicts, not the source type.

libctf/ChangeLog
libctf/ctf-link.c

index ba6664fa0aedb53cc9f606cc9d4c0f11d9f4abb9..d6649986d480c36dab26f88756b86b0e8d349c40 100644 (file)
@@ -1,3 +1,8 @@
+2020-07-22  Nick Alcock  <nick.alcock@oracle.com>
+
+       * ctf-link.c (ctf_link_one_variable): Check the dst_type for
+       conflicts, not the source type.
+
 2020-07-22  Nick Alcock  <nick.alcock@oracle.com>
 
        * ctf-impl.h (ctf_file_t): Improve comments.
index 3c96604b36aa42b18592cb390fa9a78f9ba35046..7b0ac386dece8ab6c6d757fc03b184e3d01a2187 100644 (file)
@@ -584,7 +584,7 @@ ctf_link_one_variable (const char *name, ctf_id_t type, void *arg_)
            }
 
          /* Already present?  Nothing to do.  */
-         if (dvd && dvd->dvd_type == type)
+         if (dvd && dvd->dvd_type == dst_type)
            return 0;
        }
     }