]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf, archive, link: fix parent importing
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Jul 2024 19:33:24 +0000 (20:33 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 28 Feb 2025 14:47:24 +0000 (14:47 +0000)
commit30cced0da65baa170927b16f57fc930741a81d16
tree5d3051c39f34a71d7ed9146397a57ed9c0116a89
parent9a74ab12c8e7e24e2929696dba02f63ed115a2a0
libctf, archive, link: fix parent importing

We are about to move to a regime where there are very few things you can do
with most dicts before you ctf_import them.  So emit a warning if
ctf_archive_next()'s convenience ctf_import of parents fails.  Rip out the
buggy code in ctf_link_deduplicating_open_inputs which opened the parent by
hand (with a hardwired name), and instead rely on ctf_archive_next to do it
for us (which also means we don't end up opening it twice, once in
ctf_archive_next, once in ctf_link_deduplicating_open_inputs).

While we're there, arrange to close the inputs we already opened if opening
of some inputs fails, rather than leaking them.  (There are still some leaks
here, so add a comment to remind us to clean them up later.)

libctf/
* ctf-archive.c (ctf_arc_import_parent): Emit a warning if importing
fails.
* ctf-link.c (ctf_link_deduplicating_open_inputs): Rely on the
        ctf_archive_next to open parent dicts.
libctf/ctf-archive.c
libctf/ctf-link.c