]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
include, libctf: add cth_parent_strlen CTFv4 header field
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Jul 2024 20:01:40 +0000 (21:01 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 28 Feb 2025 14:47:24 +0000 (14:47 +0000)
commit6c776899632eab5d513d81364efc7a167a2838b2
tree482112a139dacbe0df04e14b5950dcdcca1b3050
parent70d05ab0b2c6ba8d16521a22f557ca86421f1281
include, libctf: add cth_parent_strlen CTFv4 header field

The first format difference between v3 and v4 is a cth_parent_strlen header
field.  This field (obviously not present in BTF) is populated from the
string table length of the parent at serialization time (protection against
being serialized before the parent is will be added in a later commit in
this series), and will be used at open time to prohibit opening of dicts
with a different strlen (which would corrupt the child's string table
if it was shared with the parent).

For now, just add the field, populate it at serialization time when linking
(when not linking, no deduplication is done and the correct value remains
unchanged), and dump it.

include/
* ctf.h (ctf_header) [cth_parent_strlen]: New.

libctf/
* ctf-dump.c (ctf_dump_header_sizefield): New.
(ctf_dump_header): Use to dump the cth_parent_strlen.
* ctf-open.c (upgrade_header_v2): Populate cth_parent_strlen.
(upgrade_header_v3): Likewise.
(ctf_flip_header): Flip it.
(ctf_bufopen): Drop unnecessary initialization.
* ctf-serialize.c (ctf_serialize): Write it out when linking.

ld/
* testsuite/ld-ctf/data-func-conflicted-vars.d: Skip the nwe dump output.
* testsuite/ld-ctf/data-func-conflicted.d: Likewise.
include/ctf.h
ld/testsuite/ld-ctf/data-func-conflicted-vars.d
ld/testsuite/ld-ctf/data-func-conflicted.d
libctf/ctf-dump.c
libctf/ctf-open.c
libctf/ctf-serialize.c