]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: strings: no external strings in BTF
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 11:56:58 +0000 (12:56 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:07:44 +0000 (18:07 +0100)
commit5ec23dfb74b1962e4a306031776a07c92d18c18a
treef11087cb3f4cbb0b1eb156d9fd0dbb83de309e78
parentc14bdfc7a4442c539258dfef437adec1b2efe5c9
libctf: strings: no external strings in BTF

One of the things BTF doesn't have is the concept of external strings which
can be shared with the ELF strtab.  Therefore, even if the linker has
reported strings which the dict is reusing, when we generate the strtab for
a BTF dict we should emit those strings into it (and we should certainly
not cause the presence of external strings to prevent BTF emission!)

Note that since already-written strtab entries are never erased, writing a
dict as BTF and then CTF will cause external strings to be emitted even for
the CTF.  This sort of repeated writing in different formats seems to be
very rare: in any case, the problem can be avoided by simply doing the CTF
writeout first (the following BTF writeout will spot the missing external-
in-CTF strings and add them).

We also throw away the internal-only function ctf_strraw_explicit(), which
was used to add strings with a hardwired strtab: it was only ever used to
write out the variable section, which is gone in v4.
libctf/ctf-dedup.c
libctf/ctf-impl.h
libctf/ctf-link.c
libctf/ctf-string.c