Re: [PATCH v5 bpf-next 8/9] tools headers: Adopt verbatim copy of btf_ids.h from kernel sources

Andrii Nakryiko
2020-07-07T00:56:22Z

On Fri, Jul 3, 2020 at 2:53 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> It will be needed by bpf selftest for resolve_btfids tool.
>
> Also adding __PASTE macro as btf_ids.h dependency, which is
> defined in:
>
> include/linux/compiler_types.h
>
> but because tools/include do not have this header, I'm putting
> the macro into linux/compiler.h header.
>
> Acked-by: Andrii Nakryiko <andriin@fb.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/include/linux/btf_ids.h | 87 ++++++++++++++++++++++++++++++++++
> tools/include/linux/compiler.h | 4 ++
> 2 files changed, 91 insertions(+)
> create mode 100644 tools/include/linux/btf_ids.h
>
> diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h
> new file mode 100644
> index 000000000000..d317150bc9e3
> --- /dev/null
> +++ b/tools/include/linux/btf_ids.h
> @@ -0,0 +1,87 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _LINUX_BTF_IDS_H
> +#define _LINUX_BTF_IDS_H
> +
> +#include <linux/compiler.h> /* for __PASTE */
> +
> +/*
> + * Following macros help to define lists of BTF IDs placed
> + * in .BTF_ids section. They are initially filled with zeros

One more inconsistency with .BTF_ids vs .BTF.ids (probably same in the
original header, which I missed).

> + * (during compilation) and resolved later during the
> + * linking phase by btfid tool.

typo: resolve_btfids tool

> + *
> + * Any change in list layout must be reflected in btfid
> + * tool logic.
> + */
> + …