libbpf: btf_decl_tag attribute for btf dump in C format
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 9 repliesIn review
- v23 patches 1 replySuperseded
- v12 patches 7 repliesSuperseded
Changes in v3 from the cover letter
- rebase to fix merge issues after recent hashmap interface update;
- call to btf_dump_assign_decl_tags removed from btf_dump__new as redundant.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | libbpf: __attribute__((btf_decl_tag("..."))) for btf dump in C formattools/ | +173 | 7 replies | |
| 2/3 | selftests/bpf: Dump data sections as part of btf_dump_test_case teststools/ | +104 | 1 reply | |
| 3/3 | selftests/bpf: Tests for BTF_KIND_DECL_TAG dump in C formattools/ tools/ | +144 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH bpf-next v3 0/3] libbpf: btf_decl_tag attribute for btf dump in C format
Support for clang's __attribute__((btf_decl_tag("..."))) by btf_dump__dump_type and btf_dump__dump_type_data functions. Decl tag attributes are restored for:
- structs and unions
- struct and union fields
- typedefs
- global variables
- function prototype parameters
The attribute is restored using __btf_decl_tag macro that is printed upon first call to btf_dump__dump_type function:
#if __has_attribute(btf_decl_tag)
#define __btf_decl_tag(x) __attribute__((btf_decl_tag(x))) #else
#define __btf_decl_tag(x)
#endif
To simplify testing of the btf_dump__dump_type_data the prog_tests/btf_dump.c:test_btf_dump_case is extended to invoke btf_dump__dump_type_data for each DATASEC object in the test case binary file.
Changelog:
v2 -> v3:
- rebase to fix merge issues after recent hashmap interface update;
- call to btf_dump_assign_decl_tags removed from btf_dump__new as redundant.
v1 -> v2:
- prog_tests/btf_dump.c:test_btf_dump_case modified to print DATASECs using btf_dump__dump_type_data;
- support for decl tags applied to global variables and function prototype parameters;
- update to support interleaved calls to btf_dump__dump_type and btf__add_decl_tag (incremental dump);
- fix for potential double free error in btf_dump_assign_decl_tags;
- styling fixes suggested by Andrii.
RFC -> v1:
- support for decl tags applied to struct / union fields and typedefs;
- __btf_decl_tag macro;
- btf_dump->decl_tags hash and equal functions updated to use integer key instead of a pointer;
- realloc_decl_tags function removed;
- update for allocation logic in btf_dump_assign_decl_tags.
[v2] https://lore.kernel.org/bpf/[email protected]/
[v1] https://lore.kernel.org/bpf/[email protected]/
[RFC] https://lore.kernel.org/bpf/[email protected]/
Eduard Zingerman (3):
libbpf: __attribute__((btf_decl_tag("..."))) for btf dump in C format selftests/bpf: Dump data sections as part of btf_dump_test_case tests selftests/bpf: Tests for BTF_KIND_DECL_TAG dump in C format
tools/lib/bpf/btf_dump.c | 181 +++++++++++++++- .../selftests/bpf/prog_tests/btf_dump.c | 197 ++++++++++++++++-- .../bpf/progs/btf_dump_test_case_decl_tag.c | 65 ++++++ 3 files changed, 421 insertions(+), 22 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/btf_dump_test_case_decl_tag.c
Signature · 1 line
2.34.1