Skip to content

Commit

Permalink
Merge branch 'libbpf-extern-followups'
Browse files Browse the repository at this point in the history
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 <ast@kernel.org>
  • Loading branch information
Alexei Starovoitov committed Dec 19, 2019
2 parents d695870 + 630628c commit a352a82
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 161 deletions.
8 changes: 4 additions & 4 deletions tools/bpf/bpftool/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ static const char *get_map_ident(const struct bpf_map *map)
return "rodata";
else if (str_has_suffix(name, ".bss"))
return "bss";
else if (str_has_suffix(name, ".extern"))
return "externs"; /* extern is a C keyword */
else if (str_has_suffix(name, ".kconfig"))
return "kconfig";
else
return NULL;
}
Expand Down Expand Up @@ -112,8 +112,8 @@ static int codegen_datasec_def(struct bpf_object *obj,
sec_ident = "bss";
else if (strcmp(sec_name, ".rodata") == 0)
sec_ident = "rodata";
else if (strcmp(sec_name, ".extern") == 0)
sec_ident = "externs"; /* extern is a C keyword */
else if (strcmp(sec_name, ".kconfig") == 0)
sec_ident = "kconfig";
else
return 0;

Expand Down
2 changes: 2 additions & 0 deletions tools/lib/bpf/bpf_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ enum libbpf_tristate {
TRI_MODULE = 2,
};

#define __kconfig __attribute__((section(".kconfig")))

#endif
Loading

0 comments on commit a352a82

Please sign in to comment.