Commit 68a26bc7 authored by Jiri Olsa's avatar Jiri Olsa Committed by Alexei Starovoitov

bpf: Update .BTF_ids section in btf.rst with sets info

Updating btf.rst doc with info about BTF_SET_START/END macros.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200825192124.710397-12-jolsa@kernel.org
parent 6e22ab9d
...@@ -724,6 +724,31 @@ want to define unused entry in BTF_ID_LIST, like:: ...@@ -724,6 +724,31 @@ want to define unused entry in BTF_ID_LIST, like::
BTF_ID_UNUSED BTF_ID_UNUSED
BTF_ID(struct, task_struct) BTF_ID(struct, task_struct)
The ``BTF_SET_START/END`` macros pair defines sorted list of BTF ID values
and their count, with following syntax::
BTF_SET_START(set)
BTF_ID(type1, name1)
BTF_ID(type2, name2)
BTF_SET_END(set)
resulting in following layout in .BTF_ids section::
__BTF_ID__set__set:
.zero 4
__BTF_ID__type1__name1__3:
.zero 4
__BTF_ID__type2__name2__4:
.zero 4
The ``struct btf_id_set set;`` variable is defined to access the list.
The ``typeX`` name can be one of following::
struct, union, typedef, func
and is used as a filter when resolving the BTF ID value.
All the BTF ID lists and sets are compiled in the .BTF_ids section and All the BTF ID lists and sets are compiled in the .BTF_ids section and
resolved during the linking phase of kernel build by ``resolve_btfids`` tool. resolved during the linking phase of kernel build by ``resolve_btfids`` tool.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment