Re: [PATCH] tools/resolve_btfids: Include linux/types.h

From: Khazhy Kumykov
Date: Mon Mar 18 2024 - 12:56:19 EST


On Fri, Mar 15, 2024 at 10:09 AM Dmitrii Bundin
<dmitrii.bundin.a@xxxxxxxxx> wrote:
>
> On Fri, Mar 15, 2024 at 6:41 PM Alexei Starovoitov
> <alexei.starovoitov@xxxxxxxxx> wrote:
> > No one reported this, though lots of people
I'm also seeing this, on clang.

> > are building resolve_btfids that uses this header
> > as part of the kernel build.
>
> GCC version 7.5.0, GNU Make 4.1
> Steps to reproduce:
> 1. Check out the commit e5eb28f6d1afebed4bb7d740a797d0390bd3a357
> 2. cd tools/bpf/resolve_btfids/
> 3. make
>
> The steps above produces the following error messages (similar error
> output truncated for clarity):
>
> In file included from main.c:73:0:
> /linux/tools/include/linux/btf_ids.h:7:2: error: unknown type name ‘u32’
> u32 cnt;
yup, that's the error I'm seeing.
> ^~~
>
> The other sources including <linux/btf_ids.h> usually includes
> (directly or indirectly) <linux/types.h> before which is not the case
> for tools/bpf/resolve_btfids/main.c. So that looks reasonable to me to
> bring all the required type definitions into scope explicitly in
> linux/btf_ids.h. Any thoughts on this?
>