]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: link: BTF support
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:22:07 +0000 (18:22 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 20:23:07 +0000 (21:23 +0100)
commit9ea8bea7f0901b1eb6464aa1fcfb734945df08e1
treea5fb6872af3769ef3b8547614b15c51d836d1d50
parent343de78445289e7d85d5c7e40702d3d422ca6bad
libctf: link: BTF support

This is in two parts, one new API function and one change.

New API:
+int ctf_link_output_is_btf (ctf_dict_t *);

Changed API:
unsigned char *ctf_link_write (ctf_dict_t *, size_t *size,
-       size_t threshold);
+       size_t threshold, int *is_btf);

The idea here is that callers can call ctf_link_output_is_btf on a
ctf_link()ed (deduplicated) dict to tell whether a link will yield
BTF-compatible output before actually generating that output, so
they can e.g. decide whether to avoid trying to compress the dict
if they know it would be BTF otherwise (since compressing a dict
renders it non-BTF-compatible).

ctf_link_write() gains an optional is_btf output parameter that
reports whether the dict that was finally generated is actually BTF
after all, perhaps because the caller didn't call
ctf_link_output_is_btf or wants to be robust against possible future
changes that may add other reasons why a written-out dict can't be BTF
at the last minute.

These are simple wrappers around already-existing machinery earlier in
this series.
include/ctf-api.h
libctf/ctf-impl.h
libctf/ctf-link.c
libctf/libctf.ver