The extern symbol declaration should be on the BTF_SET_START macro, not on BTF_SET_START_GLOBAL, since in the global case the symbol will be declared in a header somewhere. Fixes: eae2e83e6263 ("bpf: Add BTF_SET_START/END macros") Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxxx> --- include/linux/btf_ids.h | 6 +++--- tools/include/linux/btf_ids.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index 210b086188a3..42aa667d4433 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -121,7 +121,8 @@ asm( \ #define BTF_SET_START(name) \ __BTF_ID_LIST(name, local) \ -__BTF_SET_START(name, local) +__BTF_SET_START(name, local) \ +extern struct btf_id_set name; #define BTF_SET_START_GLOBAL(name) \ __BTF_ID_LIST(name, globl) \ @@ -131,8 +132,7 @@ __BTF_SET_START(name, globl) asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ ".size __BTF_ID__set__" #name ", .-" #name " \n" \ -".popsection; \n"); \ -extern struct btf_id_set name; +".popsection; \n"); #else diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h index 210b086188a3..42aa667d4433 100644 --- a/tools/include/linux/btf_ids.h +++ b/tools/include/linux/btf_ids.h @@ -121,7 +121,8 @@ asm( \ #define BTF_SET_START(name) \ __BTF_ID_LIST(name, local) \ -__BTF_SET_START(name, local) +__BTF_SET_START(name, local) \ +extern struct btf_id_set name; #define BTF_SET_START_GLOBAL(name) \ __BTF_ID_LIST(name, globl) \ @@ -131,8 +132,7 @@ __BTF_SET_START(name, globl) asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ ".size __BTF_ID__set__" #name ", .-" #name " \n" \ -".popsection; \n"); \ -extern struct btf_id_set name; +".popsection; \n"); #else -- 2.25.1