LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] tools headers: Make linux/btf_ids.h self-contained
@ 2024-03-25  1:10 Gaosheng Cui
  2024-03-28  3:49 ` Yicong Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Gaosheng Cui @ 2024-03-25  1:10 UTC (permalink / raw
  To: ast, dxu, andrii, cuigaosheng1, ndesaulniers, vmalik; +Cc: linux-kernel

Add the missing #include <linux/types.h>.

Fix the following compile error:
  In file included from main.c:73:
  tools/include/linux/btf_ids.h:7:9: error: unknown type name ‘u32’
    7 |         u32 cnt;
      |         ^~~
  tools/include/linux/btf_ids.h:8:9: error: unknown type name ‘u32’
    8 |         u32 ids[];
      |         ^~~

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 tools/include/linux/btf_ids.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h
index 72535f00572f..7969607efe0d 100644
--- a/tools/include/linux/btf_ids.h
+++ b/tools/include/linux/btf_ids.h
@@ -3,6 +3,8 @@
 #ifndef _LINUX_BTF_IDS_H
 #define _LINUX_BTF_IDS_H
 
+#include <linux/types.h>
+
 struct btf_id_set {
 	u32 cnt;
 	u32 ids[];
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] tools headers: Make linux/btf_ids.h self-contained
  2024-03-25  1:10 [PATCH -next] tools headers: Make linux/btf_ids.h self-contained Gaosheng Cui
@ 2024-03-28  3:49 ` Yicong Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Yicong Yang @ 2024-03-28  3:49 UTC (permalink / raw
  To: Gaosheng Cui, ast, dxu, andrii, ndesaulniers, vmalik
  Cc: yangyicong, linux-kernel, alexei.starovoitov

Hi,

On 2024/3/25 9:10, Gaosheng Cui wrote:
> Add the missing #include <linux/types.h>.
> 
> Fix the following compile error:
>   In file included from main.c:73:
>   tools/include/linux/btf_ids.h:7:9: error: unknown type name ‘u32’
>     7 |         u32 cnt;
>       |         ^~~
>   tools/include/linux/btf_ids.h:8:9: error: unknown type name ‘u32’
>     8 |         u32 ids[];
>       |         ^~~
> 

I also met this on 6.9-rc1 and this patch could solve the issue.

I suspect this is introduced by 9707ac4fe2f5 ("tools/resolve_btfids: Refactor set sorting with types from btf_ids.h")?

Since we didn't contain this header before and compiling was fine, could we only include
this header in tools/bpf/resolve_btfids/main.c where error happens (tested fine)?

There's a same fix in [1] and the glibc/compiler version was blamed there. I compiled on
Ubuntu 18.04.1 with gcc 10.2.0 and glibc 2.27.

[1] https://lore.kernel.org/all/20240315091434.10622-1-dmitrii.bundin.a@gmail.com/#t

> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  tools/include/linux/btf_ids.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h
> index 72535f00572f..7969607efe0d 100644
> --- a/tools/include/linux/btf_ids.h
> +++ b/tools/include/linux/btf_ids.h
> @@ -3,6 +3,8 @@
>  #ifndef _LINUX_BTF_IDS_H
>  #define _LINUX_BTF_IDS_H
>  
> +#include <linux/types.h>
> +
>  struct btf_id_set {
>  	u32 cnt;
>  	u32 ids[];
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28  3:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25  1:10 [PATCH -next] tools headers: Make linux/btf_ids.h self-contained Gaosheng Cui
2024-03-28  3:49 ` Yicong Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).