Skip to content

Commit a352a82

Browse files
author
Alexei Starovoitov
committed
Merge branch 'libbpf-extern-followups'
Andrii Nakryiko says: ==================== Based on latest feedback and discussions, this patch set implements the following changes: - Kconfig-provided externs have to be in .kconfig section, for which bpf_helpers.h provides convenient __kconfig macro (Daniel); - instead of allowing to override Kconfig file path, switch this to ability to extend and override system Kconfig with user-provided custom values (Alexei); - BTF is required when externs are used. ==================== Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents d695870 + 630628c commit a352a82

File tree

8 files changed

+194
-161
lines changed

8 files changed

+194
-161
lines changed

tools/bpf/bpftool/gen.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ static const char *get_map_ident(const struct bpf_map *map)
8383
return "rodata";
8484
else if (str_has_suffix(name, ".bss"))
8585
return "bss";
86-
else if (str_has_suffix(name, ".extern"))
87-
return "externs"; /* extern is a C keyword */
86+
else if (str_has_suffix(name, ".kconfig"))
87+
return "kconfig";
8888
else
8989
return NULL;
9090
}
@@ -112,8 +112,8 @@ static int codegen_datasec_def(struct bpf_object *obj,
112112
sec_ident = "bss";
113113
else if (strcmp(sec_name, ".rodata") == 0)
114114
sec_ident = "rodata";
115-
else if (strcmp(sec_name, ".extern") == 0)
116-
sec_ident = "externs"; /* extern is a C keyword */
115+
else if (strcmp(sec_name, ".kconfig") == 0)
116+
sec_ident = "kconfig";
117117
else
118118
return 0;
119119

tools/lib/bpf/bpf_helpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@ enum libbpf_tristate {
5353
TRI_MODULE = 2,
5454
};
5555

56+
#define __kconfig __attribute__((section(".kconfig")))
57+
5658
#endif

0 commit comments

Comments
 (0)