]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: dedup: add strtab deduplicator
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Jul 2024 22:21:20 +0000 (23:21 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 28 Feb 2025 14:47:24 +0000 (14:47 +0000)
commit9daceda7960df4b142d5c925eb16e813469978c3
tree9cd96bcbbe5a2a982a049f38def99a8fae4fec8e
parentba66e0cc32d749119485025e7f050021094e1b15
libctf: dedup: add strtab deduplicator

This is a pretty simple two-phase process (count duplicates that are
actually going to end up in the strtab and aren't e.g. strings without refs,
strings with external refs etc, and move them into the parent) with one
wrinkle: we sorta-abuse the csa_external_offset field in the deduplicated
child atom (normally used to indicate that this string is located in the ELF
strtab) to indicate that this atom is in the *parent*.  If you think of
"external" as meaning simply "is in some other strtab, we don't care which
one", this still makes enough sense to not need to change the name, I hope.

This is still not called from anywhere, so strings are (still!) not
deduplicated, and none of the dedup machinery added in earlier commits does
anything yet.

libctf/
* ctf-dedup.c (ctf_dedup_emit_struct_members): Note that strtab
dedup happens (well) after struct member emission.
(ctf_dedup_strings): New.
* ctf-impl.h (ctf_dedup_strings): Declare.
libctf/ctf-dedup.c
libctf/ctf-impl.h